homebrew-core/Formula/libxml++.rb
2015-06-09 09:20:58 +01:00

67 lines
2.1 KiB
Ruby

class Libxmlxx < Formula
desc "C++ wrapper for libxml"
homepage "http://libxmlplusplus.sourceforge.net"
url "https://download.gnome.org/sources/libxml++/2.38/libxml++-2.38.1.tar.xz"
sha256 "882529189b03db6c69925b3f579ab1941feb4f02b5fe2612504ee7e498a4a05f"
bottle do
sha256 "aee30c6a4f6c8a73b126a3ac3b86d2a0776aa3fb28cd4ca456239cba80c58615" => :yosemite
sha256 "c27d008e5c70b1ecb58236e7c1147b11de45fd8355a819edb756d9b2afd8cbf1" => :mavericks
sha256 "486754665b20b0bb79f95704842d153df4ad9765144bc32c1653be7a1ae40d83" => :mountain_lion
end
depends_on "pkg-config" => :build
depends_on "glibmm"
# LibXML++ can't compile agains the version of LibXML shipped with Leopard
depends_on "libxml2" if MacOS.version <= :leopard
def install
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <libxml++/libxml++.h>
int main(int argc, char *argv[])
{
xmlpp::Document document;
document.set_internal_subset("homebrew", "", "http://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 = (ENV.cflags || "").split + (ENV.cppflags || "").split + (ENV.ldflags || "").split
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, "test.cpp", "-o", "test", *flags
system "./test"
end
end