homebrew-core/Formula/gxml.rb
2018-09-17 21:49:18 +10:00

82 lines
2.6 KiB
Ruby

class Gxml < Formula
desc "GObject-based XML DOM API"
homepage "https://wiki.gnome.org/GXml"
url "https://download.gnome.org/sources/gxml/0.16/gxml-0.16.3.tar.xz"
sha256 "520d4d779b1d31591762b2a98f84072531b9e17ac401df9668493e189eafc6ba"
revision 1
bottle do
sha256 "3275cd7058112128a3fbc61c02aecedc830e67749ec003e4f1f09f01dcb2fd9c" => :mojave
sha256 "0908c2bd5015de8acbab29ea0c42d9d274705b830424fb7c31f4c1a6088b5c1e" => :high_sierra
sha256 "d85960c0109b86ac07a51aea852b5d19bafb75bc55dd360b140ac27aa4de4721" => :sierra
sha256 "078acc418ec19bdfb68c826279ac31dd143a4992d580dcacd9d6c5a33c9e0bd1" => :el_capitan
end
depends_on "gobject-introspection" => :build
depends_on "gtk-doc" => :build
depends_on "intltool" => :build
depends_on "pkg-config" => :build
depends_on "vala" => :build
depends_on "glib"
depends_on "libgee"
depends_on "libxml2"
def install
# ensures that the gobject-introspection files remain within the keg
inreplace "gxml/Makefile.in" do |s|
s.gsub! "@HAVE_INTROSPECTION_TRUE@girdir = $(INTROSPECTION_GIRDIR)",
"@HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0"
s.gsub! "@HAVE_INTROSPECTION_TRUE@typelibdir = $(INTROSPECTION_TYPELIBDIR)",
"@HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0"
end
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--disable-schemas-compile"
system "make", "install"
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
end
test do
(testpath/"test.c").write <<~EOS
#include <gxml/gxml.h>
int main(int argc, char *argv[]) {
GType type = gxml_document_get_type();
return 0;
}
EOS
libxml2 = Formula["libxml2"]
gettext = Formula["gettext"]
glib = Formula["glib"]
libgee = Formula["libgee"]
flags = %W[
-I#{gettext.opt_include}
-I#{libxml2.opt_include}/libxml2
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}/gxml-0.16
-I#{libgee.opt_include}/gee-0.8
-D_REENTRANT
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{libgee.opt_lib}
-L#{libxml2.opt_lib}
-L#{lib}
-lgee-0.8
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgxml-0.16
-lintl
-lxml2
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end