homebrew-core/Formula/libspectre.rb

44 lines
1.4 KiB
Ruby

class Libspectre < Formula
desc "Small library for rendering Postscript documents"
homepage "https://wiki.freedesktop.org/www/Software/libspectre/"
url "https://libspectre.freedesktop.org/releases/libspectre-0.2.9.tar.gz"
sha256 "49ae9c52b5af81b405455c19fe24089d701761da2c45d22164a99576ceedfbed"
license "GPL-2.0"
bottle do
cellar :any
sha256 "a5ebee9481527fc2e9fb217ac3d017435c77c36beb0d82a1722df463df7bdaaf" => :catalina
sha256 "4d18ccc28ca26864e17d4b6d43828550ca821315d547e71358c043c0a8151705" => :mojave
sha256 "6d9dbf0542d1bd02f056bcad34ae176e3e991fb5cb1babd0854b402fc15779d2" => :high_sierra
end
depends_on "ghostscript"
def install
ENV.append "CFLAGS", "-I#{Formula["ghostscript"].opt_include}/ghostscript"
ENV.append "LIBS", "-L#{Formula["ghostscript"].opt_lib}"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <libspectre/spectre.h>
int main(int argc, char *argv[]) {
const char *text = spectre_status_to_string(SPECTRE_STATUS_SUCCESS);
return 0;
}
EOS
flags = %W[
-I#{include}
-L#{lib}
-lspectre
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end