Files
Misty De Meo 89852c9206 add G3 bottles for several packages
These bottles were built by Sevan; I've just handled the uploads.
2025-12-22 00:24:22 +00:00

71 lines
1.9 KiB
Ruby

class Libxml2 < Formula
desc "GNOME XML library"
homepage "http://xmlsoft.org"
url "https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.9.tar.xz"
sha256 "780157a1efdb57188ec474dca87acaee67a3a839c2525b2214d318228451809f"
head do
url "https://git.gnome.org/browse/libxml2", :using => :git
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
bottle do
sha256 "64bfb02565b476c808c95145a9ae52525425bb7cc824c3bed5ec6fed256fdb68" => :tiger_g3
end
depends_on "python" => :optional
depends_on "xz"
depends_on "zlib"
keg_only :provided_by_osx
option :universal
def install
ENV.universal_binary if build.universal?
if build.head?
inreplace "autogen.sh", "libtoolize", "glibtoolize"
system "./autogen.sh"
end
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--without-python",
"--with-lzma=#{Formula["xz"].opt_prefix}",
"--with-zlib=#{Formula["zlib"].opt_prefix}"
system "make"
ENV.deparallelize
system "make", "install"
if build.with? "python"
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
end
test do
(testpath/"test.c").write <<-EOS.undent
#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 = `#{bin}/xml2-config --cflags --libs`.split
args += %w[test.c -o test]
system ENV.cc, *args
system "./test"
end
end