homebrew-core/Formula/gwyddion.rb

146 lines
4.4 KiB
Ruby

class Gwyddion < Formula
desc "Scanning Probe Microscopy visualization and analysis tool"
homepage "http://gwyddion.net/"
url "http://gwyddion.net/download/2.62/gwyddion-2.62.tar.gz"
sha256 "6c71fda9f783be5beabd21bfd749a91b2404b24cd74b7115adec31d235d40688"
license "GPL-2.0-or-later"
livecheck do
url "http://gwyddion.net/download.php"
regex(/stable version Gwyddion v?(\d+(?:\.\d+)+):/i)
end
bottle do
sha256 arm64_ventura: "7f1e88f594b85b1ff14136954abd497c76c6f714a424c4c5f60eebf5090eff71"
sha256 arm64_monterey: "6d89eceaff946e5fa27619df49db3489cfa9faf0b84134d0973f7ff13345c939"
sha256 arm64_big_sur: "4edda3a2def3d79679378aef727ca9a5f2c64d2f4aea813ff80fc384e1f5dd20"
sha256 ventura: "d165e2b0d7c9b8022ed75a2b31b4ecd05131bfd1e69708b8d1f7d06fe45edefc"
sha256 monterey: "accc13498182cc7f5dd0216afcee03825a6ed823a5eae8a58bdbe97c155cf1c1"
sha256 big_sur: "2a91c616047f1a3b9cb339490a2e4491bea9b78b4d954fc3bf4ee31d90f1c5ef"
sha256 catalina: "bfb19b06d490f42a69db28807db6eedd064d00b5a63d5ec37562fd78951b4cab"
sha256 x86_64_linux: "ac5ab5522b9803996f26a5107e35bcff7ba90bc89577d442eb50bf64e674350c"
end
depends_on "pkg-config" => :build
depends_on "fftw"
depends_on "gtk+"
depends_on "gtkglext"
depends_on "gtksourceview"
depends_on "libxml2"
depends_on "minizip"
on_macos do
# Regenerate autoconf files to avoid flat namespace in library
# (autoreconf runs gtkdocize, provided by gtk-doc)
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "gtk-doc" => :build
depends_on "libtool" => :build
depends_on "gtk-mac-integration"
end
def install
system "autoreconf", "--force", "--install", "--verbose" if OS.mac?
system "./configure", "--disable-dependency-tracking",
"--disable-desktop-file-update",
"--prefix=#{prefix}",
"--with-html-dir=#{doc}",
"--disable-pygwy"
system "make", "install"
end
test do
system "#{bin}/gwyddion", "--version"
(testpath/"test.c").write <<~EOS
#include <libgwyddion/gwyddion.h>
int main(int argc, char *argv[]) {
const gchar *string = gwy_version_string();
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fftw = Formula["fftw"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
gtkx = Formula["gtk+"]
gtkglext = Formula["gtkglext"]
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#{fftw.opt_include}
-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#{gtkglext.opt_include}/gtkglext-1.0
-I#{gtkglext.opt_lib}/gtkglext-1.0/include
-I#{gtkx.opt_include}/gtk-2.0
-I#{gtkx.opt_lib}/gtk-2.0/include
-I#{harfbuzz.opt_include}/harfbuzz
-I#{include}/gwyddion
-I#{libpng.opt_include}/libpng16
-I#{lib}/gwyddion/include
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{fftw.opt_lib}
-L#{fontconfig.opt_lib}
-L#{freetype.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{gtkglext.opt_lib}
-L#{gtkx.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lfftw3
-lfontconfig
-lfreetype
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgmodule-2.0
-lgobject-2.0
-lgwyapp2
-lgwyddion2
-lgwydgets2
-lgwydraw2
-lgwymodule2
-lgwyprocess2
-lpango-1.0
-lpangocairo-1.0
-lpangoft2-1.0
]
if OS.mac?
flags += %w[
-lintl
-lgdk-quartz-2.0
-lgdkglext-quartz-1.0
-lgtk-quartz-2.0
-lgtkglext-quartz-1.0
-framework AppKit
-framework OpenGL
]
end
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end