source: trunk/dports/gnome/gtk2/Portfile @ 89154

Last change on this file since 89154 was 89154, checked in by cal@…, 9 years ago

gtk2: remove dependency for librsvg to avoid circular dependency

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.5 KB
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 89154 2012-01-19 23:27:47Z cal@macports.org $
3
4PortSystem          1.0
5PortGroup           muniversal 1.0
6PortGroup           xcodeversion 1.0
7
8name                gtk2
9version             2.24.8
10revision            2
11set branch          [join [lrange [split ${version} .] 0 1] .]
12categories          gnome x11
13license             LGPL-2+
14maintainers         nomaintainer
15platforms           darwin
16description         GTK+ widget toolkit
17
18long_description \
19    GTK+ is a highly usable, feature rich toolkit for creating graphical \
20    user interfaces which boasts cross platform compatibility and an easy \
21    to use API. GTK+ it is written in C, but has bindings to many other \
22    popular programming languages such as C++, Python and C# among others.
23
24homepage            http://www.gtk.org/
25distname            gtk+-${version}
26use_bzip2           yes
27
28master_sites        gnome:sources/gtk+/${branch}/ \
29                    ftp://ftp.gtk.org/pub/gtk/${branch}/ \
30                    http://ftp.gtk.org/pub/gtk/${branch}/
31
32minimum_xcodeversions {9 3.1}
33
34checksums           rmd160  efd9e1a8e5050e9763a8f81d0625a9e0f002cfe9 \
35                    sha256  ac2325a65312922a6722a7c02a389f3f4072d79e13131485cc7b7226e2537043
36
37patchfiles          patch-gtk-builder-convert.diff patch-aliases.diff \
38                    patch-tests_Makefile.in.diff \
39                    658722.diff \
40                    664238.diff
41
42depends_build       port:pkgconfig \
43                    port:perl5
44
45depends_lib         port:atk \
46                    path:lib/pkgconfig/pango.pc:pango \
47                    port:gdk-pixbuf2
48# gtk2 applications would need librsvg to display SVG icons, however librsvg
49# depends on gtk2, so we can not list it as a dependency here.
50#                   port:librsvg
51
52
53depends_run         port:shared-mime-info \
54                    port:hicolor-icon-theme
55
56configure.args      --enable-static \
57                    --disable-glibtest \
58                    --disable-introspection \
59                    gio_can_sniff=yes
60
61configure.ccache    no
62configure.cppflags-append   -DX_LOCALE
63configure.cflags-append     -fstrict-aliasing
64
65post-extract {
66    # gtk2's Makefiles don't have proper dependencies,
67    # so we must delete these to get them remade
68    file delete ${worksrcpath}/gdk/gdkalias.h
69    file delete ${worksrcpath}/gdk/gdkaliasdef.c
70    file delete ${worksrcpath}/gtk/gtkalias.h
71    file delete ${worksrcpath}/gtk/gtkaliasdef.c
72}
73
74pre-configure {
75    if {![variant_isset quartz] && ![variant_isset x11]} {
76        error "Either +x11 or +quartz is required"
77    }
78
79    if {[variant_isset quartz]} {
80        if {![file exists ${prefix}/include/cairo/cairo-quartz.h]} {
81            error "cairo must be built with the +quartz variant enabled."
82        }
83    } elseif {![file exists ${prefix}/include/cairo/cairo-xlib.h]} {
84        error "cairo must be built without the +no_x11 variant."
85    }
86}
87
88use_parallel_build  yes
89
90test.run            yes
91test.target         check
92
93post-destroot {
94    set docdir ${prefix}/share/doc/${name}
95    xinstall -d ${destroot}${docdir}
96    xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING HACKING NEWS README \
97        ${destroot}${docdir}
98
99    ui_debug "Creating gtk.immodules..."
100    system "DYLD_LIBRARY_PATH=${destroot}${prefix}/lib \
101        ${destroot}${prefix}/bin/gtk-query-immodules-2.0 \
102        ${destroot}${prefix}/lib/gtk-2.0/2.10.0/immodules/*.so \
103        >${destroot}${prefix}/etc/gtk-2.0/gtk.immodules"
104    reinplace "s|${destroot}||" ${destroot}${prefix}/etc/gtk-2.0/gtk.immodules
105}
106
107post-activate {
108    ui_debug "Updating gdk-pixbuf.loaders..."
109    system "${prefix}/bin/gdk-pixbuf-query-loaders \
110        >${prefix}/etc/gtk-2.0/gdk-pixbuf.loaders"
111}
112
113platform darwin 8 {
114    if {[variant_isset quartz] || [variant_isset no_x11]} {
115        configure.ldflags-append  -framework Cocoa -framework Carbon
116    }
117}
118
119if {[variant_isset no_x11]} {
120    default_variants +quartz
121} elseif {![variant_isset quartz]} {
122    default_variants +x11
123}
124
125if {[variant_isset universal]} {
126    set cups /usr/bin/cups-config
127    if {[info exists universal_sysroot]} {
128        set cups ${universal_sysroot}${cups}
129    }
130    configure.env-append CUPS_CONFIG=${cups}
131
132    # cups is not 32/64-bit universal on Tiger.
133    if {${os.major} == "8"} {
134        set merger_configure_args(ppc64)   --disable-cups
135        set merger_configure_args(x86_64)  --disable-cups
136    }
137
138    # Find architectures which will not run on build platform.
139    set cpu64bit_capable [sysctl hw.cpu64bit_capable]
140    if {${os.arch} eq "i386"} {
141        set cross_archs ppc64
142        if {${os.major} >= 10} {
143            lappend cross_archs ppc
144        }
145        set host_archs "ppc ppc64"
146        set run_archs i386
147        if {${cpu64bit_capable}} {
148            set run_archs "x86_64 ${run_archs}"
149        }
150    } else {
151        set cross_archs "i386 x86_64"
152        set host_archs "i386 x86_64"
153        set run_archs ppc
154        if {${cpu64bit_capable}} {
155            set run_archs "ppc64 ${run_archs}"
156        }
157    }
158
159    pre-configure {
160        set run_arch ""
161        foreach arch ${run_archs} {
162            if {[lsearch ${universal_archs_to_use} ${arch}] != -1} {
163                set run_arch ${arch}
164                break
165            }
166        }
167
168        if {${run_arch} eq ""} {
169            ui_error ""
170            ui_error "gtk2 requires at least one architecture runnable on this"
171            ui_error "machine to be able to build universally. Please add at least"
172            ui_error "one of the following architectures to `universal_archs` in"
173            ui_error "\"${prefix}/etc/macports/macports.conf\":"
174            ui_error ""
175            ui_error "\t${run_archs}"
176            ui_error ""
177        }
178
179        foreach arch ${host_archs} {
180            lappend merger_configure_env(${arch}) \
181                NM='/usr/bin/nm -p'
182        }
183
184        foreach arch ${cross_archs} {
185            lappend merger_configure_env(${arch}) \
186                GTK_UPDATE_ICON_CACHE=${worksrcpath}-${run_arch}/gtk/gtk-update-icon-cache \
187                GDK_PIXBUF_CSOURCE=${worksrcpath}-${run_arch}/gdk-pixbuf/gdk-pixbuf-csource
188            lappend merger_build_env(${arch}) \
189                GDK_PIXBUF_MODULE_FILE=${worksrcpath}-${run_arch}/gdk-pixbuf/gdk-pixbuf.loaders
190        }
191
192        # Let gtk_host in .pc files be the same on all architectures
193        set host powerpc
194        if {${os.arch} eq "i386"} {
195            set host i686
196        }
197        eval reinplace s/@host@/${host}-apple-darwin${os.version}/ \
198            [glob -directory ${worksrcpath} *.pc.in]
199    }
200}
201
202variant no_x11 description {Disable X11 support} {
203    pre-fetch {
204        if {[file exists ${prefix}/lib/libpangox-1.0.dylib]} {
205            ui_error "Please install pango without the x11 variant, by running 'port install pango -x11'."
206            error "pango must be installed with the x11 variant disabled"
207        }
208    }
209}
210
211variant quartz requires no_x11 conflicts x11 {
212    configure.args-append   --with-gdktarget=quartz
213}
214
215variant x11 conflicts quartz {
216    depends_lib-append \
217        port:xorg-libXi \
218        port:xorg-libXrandr \
219        port:xorg-libXcursor \
220        port:xorg-libXinerama \
221        port:xorg-libXdamage \
222        port:xorg-libXcomposite \
223        port:xorg-libXfixes
224
225    configure.args-append      --with-xinput --enable-xinerama \
226                               --x-include=${prefix}/include --x-lib=${prefix}/lib
227}
228
229livecheck.type  regex
230livecheck.url   ftp://ftp.gnome.org/pub/gnome/sources/gtk+/${branch}/
231livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}
Note: See TracBrowser for help on using the repository browser.