class Libxmlxx3 < Formula desc "C++ wrapper for libxml" homepage "https://libxmlplusplus.sourceforge.io/" url "https://download.gnome.org/sources/libxml++/3.2/libxml++-3.2.2.tar.xz" sha256 "a53d0af2c9bf566b4d5d57d1c6495b189555c54785941d7e3bef666728952f0b" license "LGPL-2.1-or-later" revision 2 livecheck do url :stable regex(/libxml\+\+[._-]v?(3\.([0-8]\d*?)?[02468](?:\.\d+)*?)\.t/i) end bottle do sha256 cellar: :any, arm64_big_sur: "031e2c0f7344a8dca24441939a6770c5f65d2f6aa6525b9fc033e71161ea07c8" sha256 cellar: :any, big_sur: "f0c270ebd865837c345f5299c221d6053dafcc836df83c6a4e07b3efab0b4847" sha256 cellar: :any, catalina: "b1d3151c29eccac4958990d44da7d2ecf1bc7d215035a09cba74804dbc7f4e8c" sha256 cellar: :any, mojave: "6badb352f2664e3e0994063b6aadc6f5f150706dd256095485db10155f939507" end depends_on "meson" => :build depends_on "ninja" => :build depends_on "pkg-config" => :build depends_on "glibmm@2.66" 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 ENV.libxml2 gettext = Formula["gettext"] glib = Formula["glib"] glibmm = Formula["glibmm@2.66"] libsigcxx = Formula["libsigc++@2"] flags = %W[ -I#{gettext.opt_include} -I#{glib.opt_include}/glib-2.0 -I#{glib.opt_lib}/glib-2.0/include -I#{glibmm.opt_include}/glibmm-2.4 -I#{glibmm.opt_lib}/glibmm-2.4/include -I#{include}/libxml++-3.0 -I#{libsigcxx.opt_include}/sigc++-2.0 -I#{libsigcxx.opt_lib}/sigc++-2.0/include -I#{lib}/libxml++-3.0/include -L#{gettext.opt_lib} -L#{glib.opt_lib} -L#{glibmm.opt_lib} -L#{libsigcxx.opt_lib} -L#{lib} -lglib-2.0 -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lxml++-3.0 -lxml2 ] on_macos do flags << "-lintl" end system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test", *flags system "./test" end end