/
gwyddion.rb
144 lines (135 loc) 路 4.34 KB
/
gwyddion.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
class Gwyddion < Formula
desc "Scanning Probe Microscopy visualization and analysis tool"
homepage "http://gwyddion.net/"
url "https://downloads.sourceforge.net/project/gwyddion/gwyddion/2.65/gwyddion-2.65.tar.xz"
sha256 "9115fb0a83c963c62460da1d7b9834382c9698bfb9b0cf29b829a4f591369ea3"
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_sonoma: "415de8cc0638ac524a67c820512baeaa37be228fee42b689b856d62a4c840a6b"
sha256 arm64_ventura: "eb77a0ce62aa227b97d13b453979d18cf37600a8461af34b71677cec56248aea"
sha256 arm64_monterey: "58349bf9758230a623befcddce8a6c6369583bace8dd1b4819d05152c84d5455"
sha256 sonoma: "3eb3f1fce0948b230af262f01ee85847a1949035dba8070c95fe88b1c62975de"
sha256 ventura: "1532eab9d49f9ec9c73702455135b4a64790b020bb4bb678d28aa1d61aaa4772"
sha256 monterey: "92a3eaa7de69614f24384cdcdd909be6ed16639813fea48606f97650b403dbfb"
sha256 x86_64_linux: "c0526141ff847dfcd38c8b7cf0805c68a75bc970092ba6e60c27e34f6584511b"
end
depends_on "pkg-config" => :build
depends_on "fftw"
depends_on "gtk+"
depends_on "gtkglext"
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
# TODO: depends_on "gtk-mac-integration"
end
def install
system "autoreconf", "--force", "--install", "--verbose" if OS.mac?
system "./configure", *std_configure_args,
"--disable-silent-rules",
"--disable-desktop-file-update",
"--with-html-dir=#{doc}",
"--without-gtksourceview",
"--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