Ticket #33972: Portfile-3.4.1_0

File Portfile-3.4.1_0, 8.6 KB (added by su-v, 12 years ago)

gtk3-test/Portfile

Line 
1# -*- 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
2# $Id: Portfile 90940 2012-03-19 01:00:08Z singingwolfboy@macports.org $
3
4PortSystem          1.0
5PortGroup           archcheck 1.0
6PortGroup           muniversal 1.0
7PortGroup           xcodeversion 1.0
8
9name                gtk3-test
10set my_name         gtk3
11set real_name       gtk+
12version             3.4.1
13set branch          [join [lrange [split ${version} .] 0 1] .]
14categories          gnome x11
15license             LGPL-2.1+
16maintainers         nomaintainer
17platforms           darwin
18description         GTK+ widget toolkit
19
20long_description    \
21    GTK+ is a highly usable, feature rich toolkit for creating graphical \
22    user interfaces which boasts cross platform compatibility and an easy \
23    to use API. GTK+ it is written in C, but has bindings to many other \
24    popular programming languages such as C++, Python and C# among others.
25
26homepage            http://www.gtk.org/
27distname            ${real_name}-${version}
28use_xz              yes
29
30master_sites        gnome:sources/gtk+/${branch}/ \
31                    ftp://ftp.gtk.org/pub/gtk/${branch}/ \
32                    http://ftp.gtk.org/pub/gtk/${branch}/
33
34minimum_xcodeversions {9 3.1}
35checksums           sha1    91b68f0dd5f6558eae98811f4031f32ff46ad172 \
36                    rmd160  e8c0c8c71167e037eb88689713b8ae05aed29b03 \
37                    sha256  0716b533de0ff2ffdec1076bb85c7a95e2b7b6ac9ece71e84625043ae3eb25f7
38
39depends_build       port:pkgconfig
40
41depends_lib         port:atk \
42                    path:lib/pkgconfig/pango.pc:pango \
43                    port:gdk-pixbuf2 \
44                    path:lib/pkgconfig/glib-2.0.pc:glib2
45
46depends_run         port:shared-mime-info
47
48archcheck.files \
49    lib/libatk-1.0.dylib \
50    lib/libintl.dylib \
51    lib/libjasper.dylib \
52    lib/libpango-1.0.dylib \
53    lib/libtiff.dylib
54
55configure.args      --enable-static \
56                    --disable-glibtest \
57                    --disable-schemas-compile \
58                    --disable-introspection \
59                    --enable-colord=no \
60                    gio_can_sniff=yes
61
62configure.ccache    no
63configure.cppflags-append   -DX_LOCALE
64configure.cflags-append     -fstrict-aliasing
65
66pre-configure {
67    if {![variant_isset quartz] && ![variant_isset x11]} {
68        error "Either +x11 or +quartz is required"
69    }
70
71    if {[variant_isset quartz]} {
72        if {![file exists ${prefix}/include/cairo/cairo-quartz.h]} {
73            error "cairo must be built with the +quartz variant enabled."
74        }
75    } elseif {![file exists ${prefix}/include/cairo/cairo-xlib.h]} {
76        error "cairo must be built without the +no_x11 variant."
77    }
78}
79
80use_parallel_build  yes
81
82test.run            yes
83test.target         check
84
85post-destroot {
86    set docdir ${prefix}/share/doc/${my_name}
87    xinstall -d ${destroot}${docdir}
88    xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING HACKING NEWS README \
89        ${destroot}${docdir}
90
91    # avoid conflict with the gtk-update-icon-cache installed by gtk2
92    move ${destroot}${prefix}/bin/gtk-update-icon-cache \
93         ${destroot}${prefix}/bin/gtk-update-icon-cache-3.0
94   
95    ui_debug "Creating gtk.immodules..."
96    system "DYLD_LIBRARY_PATH=${destroot}${prefix}/lib \
97        ${destroot}${prefix}/bin/gtk-query-immodules-3.0 \
98        ${destroot}${prefix}/lib/gtk-3.0/3.0.0/immodules/*.so \
99        >${destroot}${prefix}/etc/gtk-3.0/gtk.immodules"
100    reinplace "s|${destroot}||" ${destroot}${prefix}/etc/gtk-3.0/gtk.immodules
101}
102
103
104post-activate {
105    ui_debug "Updating gdk-pixbuf.loaders..."
106    system "${prefix}/bin/gdk-pixbuf-query-loaders \
107        >${prefix}/etc/gtk-3.0/gdk-pixbuf.loaders"
108
109    # GConf (needs investigation)
110    #  -- copied from gedit 2.30.4 / gtk2
111    #system "export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` && \
112    #     gconftool-2 --makefile-install-rule ${prefix}/etc/gconf/schemas/*.schemas"
113
114    # GSettings
115    #  -- from <https://wiki.archlinux.org/index.php/Gnome_Package_Guidelines#GSettings_schemas>
116    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
117}
118
119platform darwin 8 {
120    if {[variant_isset quartz] || [variant_isset no_x11]} {
121        configure.ldflags-append  -framework Cocoa -framework Carbon
122    }
123}
124
125if {[variant_isset no_x11]} {
126    default_variants +quartz
127} elseif {![variant_isset quartz]} {
128    default_variants +x11
129}
130
131if {[variant_isset universal]} {
132    set cups /usr/bin/cups-config
133    if {[info exists universal_sysroot]} {
134        set cups ${universal_sysroot}${cups}
135    }
136    configure.env-append CUPS_CONFIG=${cups}
137
138    # cups is not 32/64-bit universal on Tiger.
139    if {${os.major} == "8"} {
140        set merger_configure_args(ppc64)   --disable-cups
141        set merger_configure_args(x86_64)  --disable-cups
142    }
143
144    # Find architectures which will not run on build platform.
145    set cpu64bit_capable [sysctl hw.cpu64bit_capable]
146    if {${os.arch} eq "i386"} {
147        set cross_archs ppc64
148        if {${os.major} >= 10} {
149            lappend cross_archs ppc
150        }
151        set host_archs "ppc ppc64"
152        set run_archs i386
153        if {${cpu64bit_capable}} {
154            set run_archs "x86_64 ${run_archs}"
155        }
156    } else {
157        set cross_archs "i386 x86_64"
158        set host_archs "i386 x86_64"
159        set run_archs ppc
160        if {${cpu64bit_capable}} {
161            set run_archs "ppc64 ${run_archs}"
162        }
163    }
164
165    pre-configure {
166        set run_arch ""
167        foreach arch ${run_archs} {
168            if {[lsearch ${universal_archs_to_use} ${arch}] != -1} {
169                set run_arch ${arch}
170                break
171            }
172        }
173
174        if {${run_arch} eq ""} {
175            ui_error ""
176            ui_error "${my_name} requires at least one architecture runnable on this"
177            ui_error "machine to be able to build universally. Please add at least"
178            ui_error "one of the following architectures to `universal_archs` in"
179            ui_error "\"${prefix}/etc/macports/macports.conf\":"
180            ui_error ""
181            ui_error "\t${run_archs}"
182            ui_error ""
183        }
184
185        foreach arch ${host_archs} {
186            lappend merger_configure_env(${arch}) \
187                NM='/usr/bin/nm -p'
188        }
189
190        foreach arch ${cross_archs} {
191            lappend merger_configure_env(${arch}) \
192                GTK_UPDATE_ICON_CACHE=${worksrcpath}-${run_arch}/gtk/gtk-update-icon-cache \
193                GDK_PIXBUF_CSOURCE=${worksrcpath}-${run_arch}/gdk-pixbuf/gdk-pixbuf-csource
194            lappend merger_build_env(${arch}) \
195                GDK_PIXBUF_MODULE_FILE=${worksrcpath}-${run_arch}/gdk-pixbuf/gdk-pixbuf.loaders
196        }
197
198        # Let gtk_host in .pc files be the same on all architectures
199        set host powerpc
200        if {${os.arch} eq "i386"} {
201            set host i686
202        }
203        eval reinplace s/@host@/${host}-apple-darwin${os.version}/ \
204            [glob -directory ${worksrcpath} *.pc.in]
205    }
206}
207
208variant no_x11 {
209    pre-fetch {
210        if {[file exists ${prefix}/lib/libpangox-1.0.dylib]} {
211            ui_error "Please uninstall or deactivate the pango port and reinstall it by running `port install pango +no_x11`."
212            error "pango must be installed with the no_x11 variant enabled."
213        }
214    }
215}
216
217variant quartz requires no_x11 conflicts x11 {
218    configure.args-append   --enable-quartz-backend
219}
220
221variant x11 conflicts quartz description {Enable rendering in X11} {
222    depends_lib-append \
223        port:xorg-libXi \
224        port:xorg-libXrandr \
225        port:xorg-libXcursor \
226        port:xorg-libXinerama \
227        port:xorg-libXdamage \
228        port:xorg-libXcomposite \
229        port:xorg-libXfixes
230
231    configure.args-append       --enable-x11-backend \
232                                --enable-xinerama \
233                                --enable-xinput \
234                                --enable-xrandr \
235                                --enable-xfixes \
236                                --enable-xcomposite \
237                                --enable-xdamage \
238                                --with-x \
239                                --x-includes=${prefix}/include \
240                                --x-libraries=${prefix}/lib
241}
242
243variant introspection description {Enable introspection} {
244    depends_lib-append          port:gobject-introspection
245    configure.args-delete       --disable-introspection
246    configure.args-append       --enable-introspection
247}
248
249variant debug description {turn on debugging} {
250    configure.args-append       --enable-debug=yes
251}
252
253livecheck.type  regex
254livecheck.url   ftp://ftp.gnome.org/pub/gnome/sources/${real_name}/${branch}/
255livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}