diff --git a/Formula/libxml++@4.rb b/Formula/libxml++@4.rb new file mode 100644 index 00000000000..f0e1f693020 --- /dev/null +++ b/Formula/libxml++@4.rb @@ -0,0 +1,45 @@ +class LibxmlxxAT4 < Formula + desc "C++ wrapper for libxml" + homepage "https://libxmlplusplus.sourceforge.io/" + url "https://download.gnome.org/sources/libxml++/4.0/libxml++-4.0.0.tar.xz" + sha256 "4f26b5fdb9ebd91e440d60343ac82400f88287facedc7e81b95f23d002f8049f" + license "LGPL-2.1-or-later" + + livecheck do + url :stable + end + + depends_on "meson" => :build + depends_on "ninja" => :build + depends_on "pkg-config" => [:build, :test] + depends_on "glibmm" + + uses_from_macos "libxml2" + + def install + ENV.cxx11 + mkdir "build" do + system "meson", *std_meson_args, ".." + system "ninja" + system "ninja", "install" + end + end + + test do + (testpath/"test.cpp").write <<~EOS + #include + + int main(int argc, char *argv[]) + { + xmlpp::Document document; + document.set_internal_subset("homebrew", "", "https://www.brew.sh/xml/test.dtd"); + xmlpp::Element *rootnode = document.create_root_node("homebrew"); + return 0; + } + EOS + command = "#{Formula["pkg-config"].opt_bin}/pkg-config --cflags --libs libxml++-4.0" + flags = shell_output(command).strip.split + system ENV.cxx, "-std=c++17", "test.cpp", "-o", "test", *flags + system "./test" + end +end