Skip to content

Commit ecfed18

Browse files
authored
Merge pull request Homebrew#198405 from Homebrew/xsd-4.2.0
xsd 4.2.0, libcutl 1.11.0 (new formula), libxsd-frontend 2.1.0 (new formula)
2 parents 89d31c8 + 89ecb16 commit ecfed18

File tree

3 files changed

+127
-52
lines changed

3 files changed

+127
-52
lines changed

Formula/lib/libcutl.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
class Libcutl < Formula
2+
desc "C++ utility library"
3+
homepage "https://www.codesynthesis.com/projects/libcutl/"
4+
url "https://www.codesynthesis.com/download/xsd/4.2/libcutl-1.11.0.tar.gz"
5+
sha256 "bb78ff87d6cb1a2544543ffe7941f0aeb8f9dcaf7dd46e9acef3e032ed7881dc"
6+
license "MIT"
7+
head "https://git.codesynthesis.com/libcutl/libcutl.git", branch: "master"
8+
9+
livecheck do
10+
url :head
11+
regex(/^v?(\d+(?:\.\d+)+)$/i)
12+
end
13+
14+
bottle do
15+
sha256 cellar: :any, arm64_sequoia: "085cbb14470957513c5a48765d1f0f924cd6646b7cb6e5070863b3fe756f54d2"
16+
sha256 cellar: :any, arm64_sonoma: "e20cc790ca579e8ae7ab5f69774ad67bd58f1eb6343f1fd87db494beb7cfb3ba"
17+
sha256 cellar: :any, arm64_ventura: "bb7b24cba44acb490f955c4961d91bca0f8d32cef0fbd789288d267965f87df7"
18+
sha256 cellar: :any, sonoma: "a392b127303ec453757aa05d8cae2dbac76dba151c4b443a292fbbf87f49ee53"
19+
sha256 cellar: :any, ventura: "f3aabe420e6e8761a2b0ba98be18baed7d109ab1322a607372c774127ac7bc74"
20+
sha256 cellar: :any_skip_relocation, x86_64_linux: "f2f825e2f1b6e5e519c80bc8de1fcd0f65def78498b5c9c07e7f6acf436081ac"
21+
end
22+
23+
depends_on "build2" => :build
24+
25+
def install
26+
system "b", "configure", "config.install.root=#{prefix}"
27+
system "b", "install", "--jobs=#{ENV.make_jobs}", "-V"
28+
pkgshare.install "tests/re/driver.cxx" => "test.cxx"
29+
end
30+
31+
test do
32+
system ENV.cxx, "-std=c++11", pkgshare/"test.cxx", "-o", "test", "-L#{lib}", "-lcutl"
33+
system "./test"
34+
end
35+
end

Formula/lib/libxsd-frontend.rb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
class LibxsdFrontend < Formula
2+
desc "Compiler frontend for the W3C XML Schema definition language"
3+
homepage "https://www.codesynthesis.com/projects/libxsd-frontend/"
4+
url "https://www.codesynthesis.com/download/xsd/4.2/libxsd-frontend-2.1.0.tar.gz"
5+
sha256 "98321b9c2307d7c4e1eba49da6a522ffa81bdf61f7e3605e469aa85bfcab90b1"
6+
license "GPL-2.0-only"
7+
8+
bottle do
9+
sha256 cellar: :any, arm64_sequoia: "3631cb5e92f7b2d727f1fe7039482a1a5cd1d81e317674fa418795e4691d60fe"
10+
sha256 cellar: :any, arm64_sonoma: "cc7523a561914a469ed374865f6135e9756d7c08b8d3fd16a79d405523c5e338"
11+
sha256 cellar: :any, arm64_ventura: "2c8b2a9f341d970929e266b1c63ec298ec46029c7164ce41d554f24cb9ab84f4"
12+
sha256 cellar: :any, sonoma: "b1d8a828aa8fd14ba6c3c361fcbdea0422df3a9182b9f380f0cfa71b6f4d1cb5"
13+
sha256 cellar: :any, ventura: "820f8de1fffddd9f19537ffbdca74723121d8e751908a89bfd09fa6cce193328"
14+
sha256 cellar: :any_skip_relocation, x86_64_linux: "19114c72e4f6ecdd2628dd3f0a06c93b5554367b710f69ee8bf8fc060b1faba3"
15+
end
16+
17+
depends_on "build2" => :build
18+
depends_on "libcutl"
19+
depends_on "xerces-c"
20+
21+
def install
22+
system "b", "configure", "config.cc.loptions=-L#{HOMEBREW_PREFIX}/lib", "config.install.root=#{prefix}"
23+
system "b", "install", "--jobs=#{ENV.make_jobs}", "-V"
24+
pkgshare.install "tests/schema/driver.cxx" => "test.cxx"
25+
end
26+
27+
test do
28+
(testpath/"test.xsd").write <<~XSD
29+
<?xml version="1.0" encoding="UTF-8"?>
30+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
31+
targetNamespace="https://brew.sh/XSDTest" xmlns="https://brew.sh/XSDTest">
32+
<xs:element name="MeaningOfLife" type="xs:positiveInteger"/>
33+
</xs:schema>
34+
XSD
35+
36+
system ENV.cxx, "-std=c++11", pkgshare/"test.cxx", "-o", "test",
37+
"-L#{lib}", "-lxsd-frontend", "-L#{Formula["libcutl"].opt_lib}", "-lcutl"
38+
assert_equal <<~TEXT, shell_output("./test test.xsd")
39+
primary
40+
{
41+
namespace https://brew.sh/XSDTest
42+
{
43+
element MeaningOfLife http://www.w3.org/2001/XMLSchema#positiveInteger
44+
}
45+
}
46+
TEXT
47+
end
48+
end

Formula/x/xsd.rb

Lines changed: 44 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,82 @@
11
class Xsd < Formula
22
desc "XML Data Binding for C++"
33
homepage "https://www.codesynthesis.com/products/xsd/"
4-
url "https://www.codesynthesis.com/download/xsd/4.0/xsd-4.0.0+dep.tar.bz2"
5-
version "4.0.0"
6-
sha256 "eca52a9c8f52cdbe2ae4e364e4a909503493a0d51ea388fc6c9734565a859817"
4+
url "https://www.codesynthesis.com/download/xsd/4.2/xsd-4.2.0.tar.gz"
5+
sha256 "2bed17c601cfb984f9a7501fd5c672f4f18eac678f5bdef6016971966add9145"
76
license "GPL-2.0-only" => { with: "Classpath-exception-2.0" }
8-
revision 2
97

108
livecheck do
119
url "https://www.codesynthesis.com/products/xsd/download.xhtml"
1210
regex(/href=.*?xsd[._-]v?(\d+(?:\.\d+)+)\.t/i)
1311
end
1412

1513
bottle do
16-
sha256 cellar: :any, arm64_sequoia: "8119ae88416a48f44f45d39b54d6c14b8849bae8fed840a0e88456c7c2bff144"
17-
sha256 cellar: :any, arm64_sonoma: "a36a30cf1bdff08460969ddcc24fae52a5cc743d57253c564d4d89a828f4db64"
18-
sha256 cellar: :any, arm64_ventura: "4f2eb34d577abf123990d70c6ee5ff4b8d77e53778260f4b93325f68941d3e33"
19-
sha256 cellar: :any, sonoma: "a0154c4c947ed3117bc4c45530a90a4ff2ac6c9d748472371b955119dfac9363"
20-
sha256 cellar: :any, ventura: "5f941b47bc3bbd36bd6282e3d580f123056768597b66397e308e7aac5b991b09"
21-
sha256 cellar: :any_skip_relocation, x86_64_linux: "1617579f8c28bfe87fcb4a1630a34700bcf0266bb4a179969e49fcc62fde4eed"
14+
sha256 cellar: :any, arm64_sequoia: "9bab1b8a054ae9b32e68d6c0ab9ee59435715bcedbdc1206de8b54a5c8210ce5"
15+
sha256 cellar: :any, arm64_sonoma: "b095172797b397ec3afe2c05033aa138ef2449d982aa8e77b9b26b484cd7fbc9"
16+
sha256 cellar: :any, arm64_ventura: "515effcddd5163ba8ac3fc30f2daf51d5c9380209b376cd4fbbffc54eb823b9e"
17+
sha256 cellar: :any, sonoma: "dcd70b1bada26e56ead16eaceeced482d7e8c4b84a8894d34073d46ad0c2f57e"
18+
sha256 cellar: :any, ventura: "d6d34d7402ae33a991c7817a34d6f8bdec2f55bc68ec922b5e112d639f308dd0"
19+
sha256 cellar: :any_skip_relocation, x86_64_linux: "d2ce6cba3e04b1e0239789b2c57ab98fbf8b465dc8477fb43c184da992002322"
2220
end
2321

24-
depends_on "pkg-config" => :build
22+
depends_on "build2" => :build
23+
depends_on "libcutl"
24+
depends_on "libxsd-frontend"
2525
depends_on "xerces-c"
2626

2727
conflicts_with "mono", because: "both install `xsd` binaries"
2828

29-
# Patches:
30-
# 1. As of version 4.0.0, Clang fails to compile if the <iostream> header is
31-
# not explicitly included. The developers are aware of this problem, see:
32-
# https://www.codesynthesis.com/pipermail/xsd-users/2015-February/004522.html
33-
# 2. As of version 4.0.0, building fails because this makefile invokes find
34-
# with action -printf, which GNU find supports but BSD find does not. There
35-
# is no place to file a bug report upstream other than the xsd-users mailing
36-
# list ([email protected]). I have sent this patch there but have
37-
# received no response (yet).
38-
patch do
39-
url "https://raw.githubusercontent.com/Homebrew/formula-patches/85fa66a9/xsd/4.0.0.patch"
40-
sha256 "55a15b7a16404e659060cc2487f198a76d96da7ec74e2c0fac9e38f24b151fa7"
29+
resource "libxsd" do
30+
url "https://www.codesynthesis.com/download/xsd/4.2/libxsd-4.2.0.tar.gz"
31+
sha256 "55caf0038603883eb39ac4caeaacda23a09cf81cffc8eb55a854b6b06ef2c52e"
4132
end
4233

4334
def install
44-
# Rename version files so that the C++ preprocess doesn't try to include these as headers.
45-
mv "xsd/version", "xsd/version.txt"
46-
mv "libxsd-frontend/version", "libxsd-frontend/version.txt"
47-
mv "libcutl/version", "libcutl/version.txt"
35+
odie "`libxsd` resource needs to be updated!" if version != resource("libxsd").version
4836

49-
ENV.append "LDFLAGS", `pkg-config --libs --static xerces-c`.chomp
50-
ENV.cxx11
51-
system "make", "install", "install_prefix=#{prefix}"
37+
system "b", "configure", "config.cc.loptions=-L#{HOMEBREW_PREFIX}/lib", "config.install.root=#{prefix}"
38+
system "b", "install", "--jobs=#{ENV.make_jobs}", "-V"
39+
40+
resource("libxsd").stage do
41+
system "b", "configure", "config.install.root=#{prefix}"
42+
system "b", "install", "--jobs=#{ENV.make_jobs}", "-V"
43+
end
5244
end
5345

5446
test do
55-
schema = testpath/"meaningoflife.xsd"
56-
schema.write <<~EOS
47+
(testpath/"meaningoflife.xsd").write <<~XSD
5748
<?xml version="1.0" encoding="UTF-8"?>
5849
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
5950
targetNamespace="https://brew.sh/XSDTest" xmlns="https://brew.sh/XSDTest">
60-
<xs:element name="MeaningOfLife" type="xs:positiveInteger"/>
51+
<xs:element name="MeaningOfLife" type="xs:positiveInteger"/>
6152
</xs:schema>
62-
EOS
63-
instance = testpath/"meaningoflife.xml"
64-
instance.write <<~EOS
53+
XSD
54+
55+
(testpath/"meaningoflife.xml").write <<~XML
6556
<?xml version="1.0" encoding="UTF-8"?>
6657
<MeaningOfLife xmlns="https://brew.sh/XSDTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
67-
xsi:schemaLocation="https://brew.sh/XSDTest meaningoflife.xsd">
68-
42
58+
xsi:schemaLocation="https://brew.sh/XSDTest meaningoflife.xsd">
59+
42
6960
</MeaningOfLife>
70-
EOS
71-
xsdtest = testpath/"xsdtest.cxx"
72-
xsdtest.write <<~EOS
61+
XML
62+
63+
(testpath/"xsdtest.cxx").write <<~EOS
7364
#include <cassert>
7465
#include "meaningoflife.hxx"
7566
int main (int argc, char *argv[]) {
76-
assert(2==argc);
77-
std::auto_ptr< ::xml_schema::positive_integer> x = XSDTest::MeaningOfLife(argv[1]);
78-
assert(42==*x);
79-
return 0;
67+
assert(2==argc);
68+
std::unique_ptr<::xml_schema::positive_integer> x = XSDTest::MeaningOfLife(argv[1]);
69+
assert(42==*x);
70+
return 0;
8071
}
8172
EOS
82-
system bin/"xsd", "cxx-tree", schema
83-
assert_predicate testpath/"meaningoflife.hxx", :exist?
84-
assert_predicate testpath/"meaningoflife.cxx", :exist?
85-
system ENV.cxx, "-o", "xsdtest", "xsdtest.cxx", "meaningoflife.cxx", "-std=c++11",
86-
"-L#{Formula["xerces-c"].opt_lib}", "-lxerces-c"
87-
assert_predicate testpath/"xsdtest", :exist?
88-
system testpath/"xsdtest", instance
73+
74+
system bin/"xsd", "cxx-tree", "meaningoflife.xsd"
75+
assert_path_exists testpath/"meaningoflife.hxx"
76+
assert_path_exists testpath/"meaningoflife.cxx"
77+
78+
system ENV.cxx, "-std=c++11", "xsdtest.cxx", "meaningoflife.cxx", "-o", "xsdtest",
79+
"-L#{Formula["xerces-c"].opt_lib}", "-lxerces-c"
80+
system "./xsdtest", "meaningoflife.xml"
8981
end
9082
end

0 commit comments

Comments
 (0)