69 lines
2.1 KiB
Ruby
69 lines
2.1 KiB
Ruby
class Libxml2 < Formula
|
|
desc "GNOME XML library"
|
|
homepage "http://xmlsoft.org/"
|
|
url "http://xmlsoft.org/sources/libxml2-2.9.8.tar.gz"
|
|
mirror "https://ftp.osuosl.org/pub/blfs/conglomeration/libxml2/libxml2-2.9.8.tar.gz"
|
|
sha256 "0b74e51595654f958148759cfef0993114ddccccbb6f31aee018f3558e8e2732"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "95f2c24465082719001e68aceb17fea3be376d9e636a578b59f6c47db01370ea" => :mojave
|
|
sha256 "0ac1537873a1ffc9aea9c01b05bafa8ad94df7abd275b8ceed719ce11b08615d" => :high_sierra
|
|
sha256 "649c48cc1142a0c1febb96fa710327d1a5544b7edd9b7da20bb9597b5d3f2140" => :sierra
|
|
end
|
|
|
|
head do
|
|
url "https://gitlab.gnome.org/GNOME/libxml2.git"
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "pkg-config" => :build
|
|
end
|
|
|
|
keg_only :provided_by_macos
|
|
|
|
depends_on "python@2"
|
|
|
|
def install
|
|
system "autoreconf", "-fiv" if build.head?
|
|
|
|
# Fix build on OS X 10.5 and 10.6 with Xcode 3.2.6
|
|
inreplace "configure", "-Wno-array-bounds", "" if ENV.compiler == :gcc_4_2
|
|
|
|
system "./configure", "--disable-dependency-tracking",
|
|
"--prefix=#{prefix}",
|
|
"--without-python",
|
|
"--without-lzma"
|
|
system "make", "install"
|
|
|
|
cd "python" do
|
|
# We need to insert our include dir first
|
|
inreplace "setup.py", "includes_dir = [", "includes_dir = ['#{include}', '#{MacOS.sdk_path}/usr/include',"
|
|
system "python", "setup.py", "install", "--prefix=#{prefix}"
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <libxml/tree.h>
|
|
|
|
int main()
|
|
{
|
|
xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
|
|
xmlNodePtr root_node = xmlNewNode(NULL, BAD_CAST "root");
|
|
xmlDocSetRootElement(doc, root_node);
|
|
xmlFreeDoc(doc);
|
|
return 0;
|
|
}
|
|
EOS
|
|
args = shell_output("#{bin}/xml2-config --cflags --libs").split
|
|
args += %w[test.c -o test]
|
|
system ENV.cc, *args
|
|
system "./test"
|
|
|
|
ENV.prepend_path "PYTHONPATH", lib/"python2.7/site-packages"
|
|
system "python2.7", "-c", "import libxml2"
|
|
end
|
|
end
|