homebrew-core/Formula/libxml++.rb
2019-06-18 08:24:29 +02:00

67 lines
2 KiB
Ruby

class Libxmlxx < Formula
desc "C++ wrapper for libxml"
homepage "https://libxmlplusplus.sourceforge.io/"
url "https://download.gnome.org/sources/libxml++/2.40/libxml++-2.40.1.tar.xz"
sha256 "4ad4abdd3258874f61c2e2a41d08e9930677976d303653cd1670d3e9f35463e9"
revision 1
bottle do
cellar :any
sha256 "850259ecdaae224f044e04df595298f85bcee11285039b0135220a9b6c041da4" => :mojave
sha256 "21a83a7e3d7a5f6760fdb0ed4d95ca173ee0141e33cd5c56d5650f63cb77e048" => :high_sierra
sha256 "8aebb501186cd48c0d75c4218d54c3f116e783444ccd58dbada5045c89459724" => :sierra
end
depends_on "pkg-config" => :build
depends_on "glibmm"
def install
ENV.cxx11
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <libxml++/libxml++.h>
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"]
libsigcxx = Formula["libsigc++"]
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++-2.6
-I#{libsigcxx.opt_include}/sigc++-2.0
-I#{libsigcxx.opt_lib}/sigc++-2.0/include
-I#{lib}/libxml++-2.6/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
-lintl
-lsigc-2.0
-lxml++-2.6
-lxml2
]
system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test", *flags
system "./test"
end
end