Ticket #19476: Portfile

File Portfile, 8.1 KB (added by rukqoa@…, 16 years ago)

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$
3
4PortSystem      1.0
5PortGroup       muniversal 1.0
6
7name            gtk2
8version         2.16.1
9revision        2
10set branch      [join [lrange [split ${version} .] 0 1] .]
11categories      x11
12maintainers     nox openmaintainer
13platforms       darwin
14description     Gimp ToolKit version 2
15
16long_description \
17    This is GTK+ version 2.x. GTK+, which stands for Gimp \
18    ToolKit, is a library for creating GUIs for the X Windows \
19    System.
20
21homepage        http://www.gtk.org/
22distname        gtk+-${version}
23use_bzip2       yes
24
25master_sites    gnome:sources/gtk+/${branch}/ \
26                ftp://ftp.gtk.org/pub/gtk/v${branch}/ \
27                http://ftp.gtk.org/pub/gtk/v${branch}/
28
29if {[variant_isset no_x11]} {
30    default_variants    +quartz
31}
32
33if {![variant_isset quartz]} {
34    default_variants    +x11
35}
36
37pre-fetch {
38    if {![variant_isset quartz] && ![variant_isset x11]} {
39        error "Either +x11 or +quartz is required"
40    }
41
42    if {[rpm-vercomp ${os.version} 8.0] >= 0 && [file exists ${prefix}/bin/cups-config]} {
43        ui_error "You are running Darwin 8.0, cups-headers should not be installed on your system. Please uninstall or deactivate it."
44        error "Please uninstall or deactivate cups-headers."
45    }
46
47    if {[rpm-vercomp ${os.version} 9.0] >= 0} {
48        set minimum_xcodeversion 3.1
49        set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
50        if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
51            ui_error "You have Xcode ${current_xcodeversion}. Please update to at least Xcode ${minimum_xcodeversion}."
52            error "Please update Xcode."
53        }
54    }
55
56    if {[variant_isset quartz]} {
57        if {![file exists ${prefix}/include/cairo/cairo-quartz.h]} {
58            error "cairo must be built with the +quartz variant enabled."
59        }
60    } elseif {![file exists ${prefix}/include/cairo/cairo-xlib.h]} {
61        error "cairo must be built without the +no_x11 variant."
62    }
63}
64
65checksums       md5     74e35ff3e6e02c960fe2117a4b6b102f \
66                sha1    01cba21f12e6fa3762fe47437eb4dc335a2fb841 \
67                rmd160  41bdf85d93a38236eea12f4882289efb671e16af
68
69patchfiles      patch-gtk-builder-convert.diff \
70                patch-modules-gail.diff \
71                patch-modules-printbackends.diff
72
73depends_build   port:pkgconfig
74
75depends_lib     path:lib/pkgconfig/cairo.pc:cairo \
76                port:fontconfig \
77                port:freetype \
78                path:lib/pkgconfig/glib-2.0.pc:glib2 \
79                port:jpeg \
80                port:tiff \
81                port:libiconv \
82                port:libpng \
83                port:jasper \
84                port:atk \
85                path:lib/pkgconfig/pango.pc:pango \
86                port:gettext \
87                port:zlib
88
89depends_run     port:shared-mime-info
90
91configure.args  --enable-static \
92                --disable-glibtest
93
94if { [variant_isset universal] } {
95    configure.env-append    CUPS_CONFIG="${configure.universal_sysroot}/usr/bin/cups-config"
96
97    # cups is not 32/64-bit universal on Tiger.
98    if { ${universal_sysroot}=="/Developer/SDKs/MacOSX10.4u.sdk" } {
99        set merger_configure_args(ppc64)   --disable-cups
100        set merger_configure_args(x86_64)  --disable-cups
101    }
102   
103    # Find architectures which will not run on build platform.
104    if { ${os.arch}=="i386" } {
105        if { ${os.major} >= 10 } {
106            set cross_archs "ppc ppc64"
107        } else {
108            set cross_archs "ppc64"
109        }
110        set host_archs "ppc ppc64"
111    } else {
112        set cross_archs "i386 x86_64"
113        set host_archs "i386 x86_64"
114    }
115   
116    set run_arch [lindex ${universal_archs} 0]
117    if { [lsearch ${cross_archs} ${run_arch}] >= 0 } {
118        ui_msg "When building a universal binary of ${name}, make sure none of {${cross_archs}} is first in universal_archs in ${prefix}/etc/macports/macports.conf"
119        error "incompatible universal_archs value"
120    }
121
122    foreach arch ${host_archs} {
123        lappend merger_configure_env(${arch}) \
124            NM='/usr/bin/nm -p'
125    }
126
127    foreach arch ${cross_archs} {
128        lappend merger_configure_env(${arch}) \
129            gio_can_sniff=yes \
130            GTK_UPDATE_ICON_CACHE=${worksrcpath}-${run_arch}/gtk/gtk-update-icon-cache \
131            GDK_PIXBUF_CSOURCE=${worksrcpath}-${run_arch}/gdk-pixbuf/gdk-pixbuf-csource
132    }
133
134    post-configure {
135        # Let gtk_host in .pc files be the same on all architectures
136        foreach arch ${host_archs} {
137            foreach pc [glob -directory ${worksrcpath}-${arch} *.pc.in] {
138                if { ${os.arch}=="i386" } {
139                    reinplace "s|gtk_host=@host@|gtk_host=i686-apple-darwin${os.version}|" ${pc}
140                } else {
141                    reinplace "s|gtk_host=@host@|gtk_host=powerpc-apple-darwin${os.version}|" ${pc}
142                }
143            }
144        }
145    }
146}
147   
148configure.ccache            no
149configure.cppflags-append   -DX_LOCALE
150configure.cflags-append     -fstrict-aliasing
151
152use_parallel_build  yes
153
154test.run        yes
155test.target     check
156
157post-destroot {
158    ui_debug "Creating gtk.immodules..."
159    system "DYLD_LIBRARY_PATH=${destroot}${prefix}/lib ${destroot}${prefix}/bin/gtk-query-immodules-2.0 \
160        ${destroot}${prefix}/lib/gtk-2.0/2.10.0/immodules/*.so >${destroot}${prefix}/etc/gtk-2.0/gtk.immodules"
161    reinplace "s|${destroot}||" ${destroot}${prefix}/etc/gtk-2.0/gtk.immodules
162}
163
164post-activate {
165    ui_debug "Updating gdk-pixbuf.loaders..."
166    system "${prefix}/bin/gdk-pixbuf-query-loaders >${prefix}/etc/gtk-2.0/gdk-pixbuf.loaders"
167}
168
169platform darwin 7 {
170    configure.args-append   --disable-cups
171}
172
173platform darwin 8 {
174    if {[variant_isset quartz] || [variant_isset no_x11]} {
175        configure.ldflags-append  -framework Cocoa -framework Carbon
176    }
177}
178
179variant with-doc description {Install with gtk-doc} {
180    depends_lib-append          port:gtk-doc
181        configure.args-append \
182                --with-doc \
183                --doc
184}
185
186variant no_x11 {
187    pre-fetch {
188        if {[file exists ${prefix}/lib/libpangox-1.0.dylib]} {
189            ui_error "Please uninstall or deactivate the pango port and reinstall it by running `port install pango +no_x11`."
190            error "pango must be installed with the no_x11 variant enabled."
191        }
192    }
193}
194
195variant quartz requires no_x11 conflicts x11 description {Enable Quartz rendering} {
196    patchfiles-append       patch-gnome-bug-531599.diff
197    configure.args-append   --with-gdktarget=quartz
198}
199
200variant x11 conflicts quartz description {Enable rendering in X11 (default)} {
201    depends_lib-append \
202        port:xorg-libXi \
203        port:xorg-libXrandr \
204        port:xorg-libXcursor \
205        port:xorg-libXinerama \
206        port:xorg-libXdamage \
207        port:xorg-libXcomposite \
208        port:xorg-libXfixes
209
210    configure.args-append      --with-xinput --enable-xinerama
211
212    # AC_X_PATH blindly asks xmkmf where X11 is, and it always uses /usr/X11R6.
213    # This block helps us link correctly and setup our pc files correctly when we   
214    # are +system_x11 and x11prefix is somewhere non-standard and should cause
215    # AC_X_PATH to let us setup our CPPFLAGS and LDFLAGS without interference
216    configure.args-append --x-include=${prefix}/include --x-lib=${prefix}/lib
217    if { ![file exists ${prefix}/lib/pkgconfig/x11.pc] } {
218        pre-configure {
219            configure.cppflags-append -I${x11prefix}/include
220            configure.ldflags-append  -L${x11prefix}/lib
221        }
222
223        # And this will similarly get ports that use pkgconfig to find our pkgconfig-less libX11
224        post-destroot {
225            if {![file exists ${x11prefix}/lib/pkgconfig/x11.pc]} {
226                foreach pc [glob ${destroot}${prefix}/lib/pkgconfig/*.pc] {
227                    reinplace "s:-lX11:-L${prefix}/lib -L${x11prefix}/lib -lX11:g" ${pc}
228                }
229            }
230        }
231    }
232}
233
234livecheck.check regex
235livecheck.url   ftp://ftp.gnome.org/pub/gnome/sources/gtk+/${branch}/
236livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}