homebrew-core/Formula/gerbv.rb

107 lines
3.3 KiB
Ruby

class Gerbv < Formula
desc "Gerber (RS-274X) viewer"
homepage "https://gerbv.github.io/"
url "https://github.com/gerbv/gerbv/archive/refs/tags/v2.8.2.tar.gz"
sha256 "588ec0bf86994ff5fff50716f9644562c5b74332e19ada5ec8af2256f040c0a0"
license "GPL-2.0-or-later"
bottle do
sha256 arm64_monterey: "f66e716949ccfc877189a277f4e478f4033b0468a4f913485dfc09e74a58883a"
sha256 arm64_big_sur: "111759f730af4169548f0916f07adbb1b3af0ae2eb9492db25ec3f7a998521e0"
sha256 monterey: "49a9b2b0cdbdffc46674672b2059ad8d60c876a5e2c3f9152c2b68ff0cfa25ac"
sha256 big_sur: "1176f012cc14ceccedfdc2efa037bb8ade39999c768cd1e498d83959e3e19845"
sha256 catalina: "40348ebda0206d74e078b53fa1c9216695bcf42d5f6d9a9b01a1af43e6684a92"
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "gettext" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "gtk+"
def install
ENV.append "CPPFLAGS", "-DQUARTZ" if OS.mac?
inreplace "autogen.sh", "libtool", "glibtool"
# Disable commit reference in include dir
inreplace "utils/git-version-gen.sh" do |s|
s.gsub! 'RELEASE_COMMIT=`"${GIT}" rev-parse HEAD`', "RELEASE_COMMIT=\"\""
s.gsub! "${PREFIX}~", "${PREFIX}"
end
system "./autogen.sh"
system "./configure", *std_configure_args,
"--disable-dependency-tracking",
"--disable-update-desktop-database",
"--disable-schemas-compile"
system "make"
system "make", "install"
end
test do
# executable (GUI) test
system "#{bin}/gerbv", "--version"
# API test
(testpath/"test.c").write <<~EOS
#include <gerbv.h>
int main(int argc, char *argv[]) {
double d = gerbv_get_tool_diameter(2);
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
gtkx = Formula["gtk+"]
harfbuzz = Formula["harfbuzz"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{gettext.opt_include}
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{gtkx.opt_include}/gtk-2.0
-I#{gtkx.opt_lib}/gtk-2.0/include
-I#{harfbuzz.opt_include}/harfbuzz
-I#{include}/gerbv-#{version}
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{gtkx.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lgdk-quartz-2.0
-lgdk_pixbuf-2.0
-lgerbv
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgtk-quartz-2.0
-lintl
-lpango-1.0
-lpangocairo-1.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end