|
1 | 1 | class Xsd < Formula |
2 | 2 | desc "XML Data Binding for C++" |
3 | 3 | 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" |
7 | 6 | license "GPL-2.0-only" => { with: "Classpath-exception-2.0" } |
8 | | - revision 2 |
9 | 7 |
|
10 | 8 | livecheck do |
11 | 9 | url "https://www.codesynthesis.com/products/xsd/download.xhtml" |
12 | 10 | regex(/href=.*?xsd[._-]v?(\d+(?:\.\d+)+)\.t/i) |
13 | 11 | end |
14 | 12 |
|
15 | 13 | 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" |
22 | 20 | end |
23 | 21 |
|
24 | | - depends_on "pkg-config" => :build |
| 22 | + depends_on "build2" => :build |
| 23 | + depends_on "libcutl" |
| 24 | + depends_on "libxsd-frontend" |
25 | 25 | depends_on "xerces-c" |
26 | 26 |
|
27 | 27 | conflicts_with "mono", because: "both install `xsd` binaries" |
28 | 28 |
|
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" |
41 | 32 | end |
42 | 33 |
|
43 | 34 | 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 |
48 | 36 |
|
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 |
52 | 44 | end |
53 | 45 |
|
54 | 46 | test do |
55 | | - schema = testpath/"meaningoflife.xsd" |
56 | | - schema.write <<~EOS |
| 47 | + (testpath/"meaningoflife.xsd").write <<~XSD |
57 | 48 | <?xml version="1.0" encoding="UTF-8"?> |
58 | 49 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" |
59 | 50 | 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"/> |
61 | 52 | </xs:schema> |
62 | | - EOS |
63 | | - instance = testpath/"meaningoflife.xml" |
64 | | - instance.write <<~EOS |
| 53 | + XSD |
| 54 | + |
| 55 | + (testpath/"meaningoflife.xml").write <<~XML |
65 | 56 | <?xml version="1.0" encoding="UTF-8"?> |
66 | 57 | <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 |
69 | 60 | </MeaningOfLife> |
70 | | - EOS |
71 | | - xsdtest = testpath/"xsdtest.cxx" |
72 | | - xsdtest.write <<~EOS |
| 61 | + XML |
| 62 | + |
| 63 | + (testpath/"xsdtest.cxx").write <<~EOS |
73 | 64 | #include <cassert> |
74 | 65 | #include "meaningoflife.hxx" |
75 | 66 | 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; |
80 | 71 | } |
81 | 72 | 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" |
89 | 81 | end |
90 | 82 | end |
0 commit comments