Ticket #22451: Portfile

File Portfile, 7.2 KB (added by mark.pearson0@…, 15 years ago)

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