homebrew-core/Formula/libxslt.rb

86 lines
3.0 KiB
Ruby

class Libxslt < Formula
desc "C XSLT library for GNOME"
homepage "http://xmlsoft.org/XSLT/"
license "X11"
revision 1
stable do
url "https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.35.tar.xz"
sha256 "8247f33e9a872c6ac859aa45018bc4c4d00b97e2feac9eebc10c93ce1f34dd79"
# Fix -flat_namespace being used on Big Sur and later.
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
end
end
# We use a common regex because libxslt doesn't use GNOME's "even-numbered
# minor is stable" version scheme.
livecheck do
url :stable
regex(/libxslt[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_monterey: "5c9f468e24ae918ae3e4966ff16cc22d5339072fc7e7508db2f36e769b563b8e"
sha256 cellar: :any, arm64_big_sur: "2d92c6564b307cac871c57826ccd1a3f317647bd30e4c1143560b6230deac6c3"
sha256 cellar: :any, monterey: "3282aa925b1956e8b4e5c8c58cee340551b596778822d765cacf99c20aa7c461"
sha256 cellar: :any, big_sur: "f322603343c92777e9953ce2238236803f06a2c1195bcb87a8ddd253fc14eed7"
sha256 cellar: :any, catalina: "f2e114e69b72994ca71c55802def701a7bf7803efeb85054e6839c5d800384b8"
sha256 cellar: :any_skip_relocation, x86_64_linux: "cd014efb1c1c44a80fee7ae5baf6b9563deeaf3d21b3f5af3d9119b1e8f4c22c"
end
head do
url "https://gitlab.gnome.org/GNOME/libxslt.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
keg_only :provided_by_macos
depends_on "libgcrypt"
depends_on "libxml2"
on_linux do
depends_on "pkg-config" => :build
end
def install
libxml2 = Formula["libxml2"]
system "autoreconf", "--force", "--install", "--verbose" if build.head?
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--without-python",
"--with-crypto",
"--with-libxml-prefix=#{libxml2.opt_prefix}"
system "make"
system "make", "install"
inreplace [bin/"xslt-config", lib/"xsltConf.sh"], libxml2.prefix.realpath, libxml2.opt_prefix
end
def caveats
<<~EOS
To allow the nokogiri gem to link against this libxslt run:
gem install nokogiri -- --with-xslt-dir=#{opt_prefix}
EOS
end
test do
assert_match version.to_s, shell_output("#{bin}/xslt-config --version")
(testpath/"test.c").write <<~EOS
#include <libexslt/exslt.h>
int main(int argc, char *argv[]) {
exsltCryptoRegister();
return 0;
}
EOS
flags = shell_output("#{bin}/xslt-config --cflags --libs").chomp.split
system ENV.cc, "test.c", "-o", "test", *flags, "-lexslt"
system "./test"
end
end