-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Portfile
287 lines (241 loc) · 10.1 KB
/
Portfile
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup active_variants 1.1
PortGroup muniversal 1.0
PortGroup xcodeversion 1.0
PortGroup debug 1.0
name gtk2
conflicts gtk2-devel
set my_name gtk2
version 2.24.33
revision 4
epoch 0
categories gnome x11
license LGPL-2+
maintainers {mascguy @mascguy} openmaintainer
description GTK+ widget toolkit
long_description GTK+ is a highly usable, feature rich toolkit for creating graphical \
user interfaces which boasts cross platform compatibility and an easy \
to use API. GTK+ it is written in C, but has bindings to many other \
popular programming languages such as C++, Python and C# among others.
homepage https://www.gtk.org/
set proj_name gtk+
set branch [join [lrange [split ${version} .] 0 1] .]
distname ${proj_name}-${version}
dist_subdir ${my_name}
use_xz yes
master_sites gnome:sources/${proj_name}/${branch}/
minimum_xcodeversions {9 3.1}
checksums rmd160 85333860bdeda25f28c45177fe08d5f0914d4e52 \
sha256 ac2ac757f5942d318a311a54b0c80b5ef295f299c2a73c632f6bfb1ff49cc6da \
size 12661828
set port_ver_major [lindex [split ${version} .] 0]
depends_build-append \
port:gtk-doc \
port:pkgconfig \
port:perl5
depends_lib-append \
port:atk \
path:lib/pkgconfig/pango.pc:pango \
path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection
# gtk2 applications would need librsvg to display SVG icons, however librsvg
# indirectly depends on gtk2, so we can not list it as a dependency here.
# path:lib/pkgconfig/librsvg-2.0.pc:librsvg
depends_run-append \
port:hicolor-icon-theme \
port:shared-mime-info
patchfiles-append patch-aliases.diff
patchfiles-append patch-gtk-builder-convert.diff
# Minor source fixes, only applicable to gtk2; fixed/removed for gtk3 and later.
# See: https://trac.macports.org/ticket/69471
patchfiles-append patch-gtkscale-bad-cast.diff
patchfiles-append patch-tests-menubars.diff
# autoreconf to deal with stupid issues during install (install: .libs/libferret.lai: No such file or directory)
use_autoreconf yes
autoreconf.args -fvi
configure.args-append \
--disable-glibtest \
--disable-silent-rules \
--enable-introspection \
--enable-static \
gio_can_sniff=yes
configure.ccache no
configure.cppflags-append \
-DX_LOCALE \
-D_IPP_PRIVATE_STRUCTURES=1
configure.cflags-append \
-fstrict-aliasing
if {[string match *clang* ${configure.compiler}]} {
configure.cflags-append \
-Wno-deprecated-declarations \
-Wno-enum-conversion \
-Wno-unknown-warning-option \
-Wno-error=unknown-warning-option
}
# gobject-introspection uses g-ir-scanner, which uses $CC from env
if {${universal_possible} && [variant_isset universal]} {
foreach arch ${configure.universal_archs} {
lappend merger_build_args(${arch}) CC='${configure.cc} -arch ${arch}'
lappend merger_destroot_args(${arch}) CC='${configure.cc} -arch ${arch}'
}
} else {
build.args-append CC="${configure.cc} ${configure.cc_archflags}"
destroot.args-append CC="${configure.cc} ${configure.cc_archflags}"
}
post-extract {
# gtk2's Makefiles don't have proper dependencies,
# so we must delete these to get them remade
file delete ${worksrcpath}/gdk/gdkalias.h
file delete ${worksrcpath}/gdk/gdkaliasdef.c
file delete ${worksrcpath}/gtk/gtkalias.h
file delete ${worksrcpath}/gtk/gtkaliasdef.c
}
pre-configure {
if {![variant_isset quartz] && ![variant_isset x11]} {
error "Either +x11 or +quartz is required"
}
}
test.run yes
test.target check
post-destroot {
set docdir ${prefix}/share/doc/${name}
xinstall -d ${destroot}${docdir}
xinstall -m 644 -W ${worksrcpath} \
AUTHORS COPYING HACKING NEWS README \
${destroot}${docdir}
ui_debug "Creating gtk.immodules..."
system "DYLD_LIBRARY_PATH=${destroot}${prefix}/lib \
${destroot}${prefix}/bin/gtk-query-immodules-2.0 \
${destroot}${prefix}/lib/gtk-2.0/2.10.0/immodules/*.so \
>${destroot}${prefix}/etc/gtk-2.0/gtk.immodules"
reinplace "s|${destroot}||" \
${destroot}${prefix}/etc/gtk-2.0/gtk.immodules
}
post-activate {
ui_debug "Updating gdk-pixbuf.loaders..."
system "${prefix}/bin/gdk-pixbuf-query-loaders \
>${prefix}/etc/gtk-2.0/gdk-pixbuf.loaders"
ui_debug "Updating immodules.cache..."
system "${prefix}/bin/gtk-query-immodules-2.0 --update-cache"
}
platform darwin 8 {
if {[variant_isset quartz] || ![variant_isset x11]} {
configure.ldflags-append -framework Cocoa -framework Carbon
}
# latest versions are incompatible with the CUPS in Tiger (#33262)
configure.args-append --disable-cups
# https://trac.macports.org/ticket/63149
configure.args-append --disable-dependency-tracking
# The rules enabled by gobject-introspection require GNU make 3.81+ (#38927)
depends_build-append port:gmake
build.cmd ${prefix}/bin/gmake
}
if {![variant_isset quartz] && ![variant_isset bundle]} {
default_variants +x11
}
if {${universal_possible} && [variant_isset universal]} {
set cups /usr/bin/cups-config
if {[info exists universal_sysroot]} {
set cups ${universal_sysroot}${cups}
}
configure.env-append CUPS_CONFIG=${cups}
# Find architectures which will not run on build platform.
if {${os.major} >= 9} {
set cpu64bit_capable [sysctl hw.cpu64bit_capable]
} elseif {(![catch {sysctl hw.optional.x86_64} is_x86_64] && $is_x86_64)
|| (![catch {sysctl hw.optional.64bitops} is_ppc64] && $is_ppc64)} {
set cpu64bit_capable 1
} else {
set cpu64bit_capable 0
}
if {${os.arch} eq "i386"} {
set cross_archs ppc64
if {${os.major} >= 10} {
lappend cross_archs ppc
}
set host_archs "ppc ppc64"
set run_archs i386
if {${cpu64bit_capable}} {
set run_archs "x86_64 ${run_archs}"
}
} else {
set cross_archs "i386 x86_64"
set host_archs "i386 x86_64"
set run_archs ppc
if {${cpu64bit_capable}} {
set run_archs "ppc64 ${run_archs}"
}
}
pre-configure {
set run_arch ""
foreach arch ${run_archs} {
if {[lsearch ${universal_archs_to_use} ${arch}] != -1} {
set run_arch ${arch}
break
}
}
if {${run_arch} eq ""} {
ui_error ""
ui_error "gtk2 requires at least one architecture runnable on this"
ui_error "machine to be able to build universally. Please add at least"
ui_error "one of the following architectures to `universal_archs` in"
ui_error "\"${prefix}/etc/macports/macports.conf\":"
ui_error ""
ui_error "\t${run_archs}"
ui_error ""
}
foreach arch ${host_archs} {
lappend merger_configure_env(${arch}) \
NM='/usr/bin/nm -p'
}
foreach arch ${cross_archs} {
lappend merger_configure_env(${arch}) \
GTK_UPDATE_ICON_CACHE=${worksrcpath}-${run_arch}/gtk/gtk-update-icon-cache \
GDK_PIXBUF_CSOURCE=${worksrcpath}-${run_arch}/gdk-pixbuf/gdk-pixbuf-csource
lappend merger_build_env(${arch}) \
GDK_PIXBUF_MODULE_FILE=${worksrcpath}-${run_arch}/gdk-pixbuf/gdk-pixbuf.loaders
}
# Let gtk_host in .pc files be the same on all architectures
set host powerpc
if {${os.arch} eq "i386"} {
set host i686
}
reinplace s/@host@/${host}-apple-darwin${os.version}/ \
{*}[glob -directory ${worksrcpath} *.pc.in]
}
}
variant quartz conflicts x11 {
require_active_variants path:lib/pkgconfig/cairo.pc:cairo quartz
require_active_variants path:lib/pkgconfig/pango.pc:pango quartz
configure.args-append --with-gdktarget=quartz
# This upstream patch is necessary for all versions
patchfiles-append patch-gdkquartz-osx-versions.diff
# These upstream patches require macOS 10.12 and later.
if {${os.major} >= 16} {
# https://gitlab.gnome.org/GNOME/gimp/-/issues/5989 and https://trac.macports.org/ticket/59481
patchfiles-append patch-gimp-issue-5989-bigsur-perf-gtk-p1.diff \
patch-gimp-issue-5989-bigsur-perf-gtk-p2.diff
}
}
variant x11 conflicts quartz {
require_active_variants path:lib/pkgconfig/cairo.pc:cairo x11
require_active_variants path:lib/pkgconfig/pango.pc:pango x11
depends_lib-append \
port:xorg-libXi \
port:xorg-libXrandr \
port:xorg-libXcursor \
port:xorg-libXinerama \
port:xorg-libXdamage \
port:xorg-libXcomposite \
port:xorg-libXfixes
configure.args-append --with-xinput --enable-xinerama \
--x-include=${prefix}/include --x-lib=${prefix}/lib
}
variant bundle requires quartz description {Support including into a bundle} {
configure.args-append --enable-quartz-relocation
notes "You have enabled 'bundle' variant which breaks GTK2 when used outside of application bundle!"
}
livecheck.type regex
livecheck.url https://download.gnome.org/sources/${proj_name}/${branch}/
livecheck.regex "LATEST-IS-(${port_ver_major}\\.\\d*\[02468\](?:\\.\\d+)*)"