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

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

gtk2: Add dependency on librsvg, which is required for SVG icons in gtk software to render correctly

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.4 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 89141 2012-01-19 22:05:30Z 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                    port:librsvg
49
50depends_run         port:shared-mime-info \
51                    port:hicolor-icon-theme
52
53configure.args      --enable-static \
54                    --disable-glibtest \
55                    --disable-introspection \
56                    gio_can_sniff=yes
57
58configure.ccache    no
59configure.cppflags-append   -DX_LOCALE
60configure.cflags-append     -fstrict-aliasing
61
62post-extract {
63    # gtk2's Makefiles don't have proper dependencies,
64    # so we must delete these to get them remade
65    file delete ${worksrcpath}/gdk/gdkalias.h
66    file delete ${worksrcpath}/gdk/gdkaliasdef.c
67    file delete ${worksrcpath}/gtk/gtkalias.h
68    file delete ${worksrcpath}/gtk/gtkaliasdef.c
69}
70
71pre-configure {
72    if {![variant_isset quartz] && ![variant_isset x11]} {
73        error "Either +x11 or +quartz is required"
74    }
75
76    if {[variant_isset quartz]} {
77        if {![file exists ${prefix}/include/cairo/cairo-quartz.h]} {
78            error "cairo must be built with the +quartz variant enabled."
79        }
80    } elseif {![file exists ${prefix}/include/cairo/cairo-xlib.h]} {
81        error "cairo must be built without the +no_x11 variant."
82    }
83}
84
85use_parallel_build  yes
86
87test.run            yes
88test.target         check
89
90post-destroot {
91    set docdir ${prefix}/share/doc/${name}
92    xinstall -d ${destroot}${docdir}
93    xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING HACKING NEWS README \
94        ${destroot}${docdir}
95
96    ui_debug "Creating gtk.immodules..."
97    system "DYLD_LIBRARY_PATH=${destroot}${prefix}/lib \
98        ${destroot}${prefix}/bin/gtk-query-immodules-2.0 \
99        ${destroot}${prefix}/lib/gtk-2.0/2.10.0/immodules/*.so \
100        >${destroot}${prefix}/etc/gtk-2.0/gtk.immodules"
101    reinplace "s|${destroot}||" ${destroot}${prefix}/etc/gtk-2.0/gtk.immodules
102}
103
104post-activate {
105    ui_debug "Updating gdk-pixbuf.loaders..."
106    system "${prefix}/bin/gdk-pixbuf-query-loaders \
107        >${prefix}/etc/gtk-2.0/gdk-pixbuf.loaders"
108}
109
110platform darwin 8 {
111    if {[variant_isset quartz] || [variant_isset no_x11]} {
112        configure.ldflags-append  -framework Cocoa -framework Carbon
113    }
114}
115
116if {[variant_isset no_x11]} {
117    default_variants +quartz
118} elseif {![variant_isset quartz]} {
119    default_variants +x11
120}
121
122if {[variant_isset universal]} {
123    set cups /usr/bin/cups-config
124    if {[info exists universal_sysroot]} {
125        set cups ${universal_sysroot}${cups}
126    }
127    configure.env-append CUPS_CONFIG=${cups}
128
129    # cups is not 32/64-bit universal on Tiger.
130    if {${os.major} == "8"} {
131        set merger_configure_args(ppc64)   --disable-cups
132        set merger_configure_args(x86_64)  --disable-cups
133    }
134
135    # Find architectures which will not run on build platform.
136    set cpu64bit_capable [sysctl hw.cpu64bit_capable]
137    if {${os.arch} eq "i386"} {
138        set cross_archs ppc64
139        if {${os.major} >= 10} {
140            lappend cross_archs ppc
141        }
142        set host_archs "ppc ppc64"
143        set run_archs i386
144        if {${cpu64bit_capable}} {
145            set run_archs "x86_64 ${run_archs}"
146        }
147    } else {
148        set cross_archs "i386 x86_64"
149        set host_archs "i386 x86_64"
150        set run_archs ppc
151        if {${cpu64bit_capable}} {
152            set run_archs "ppc64 ${run_archs}"
153        }
154    }
155
156    pre-configure {
157        set run_arch ""
158        foreach arch ${run_archs} {
159            if {[lsearch ${universal_archs_to_use} ${arch}] != -1} {
160                set run_arch ${arch}
161                break
162            }
163        }
164
165        if {${run_arch} eq ""} {
166            ui_error ""
167            ui_error "gtk2 requires at least one architecture runnable on this"
168            ui_error "machine to be able to build universally. Please add at least"
169            ui_error "one of the following architectures to `universal_archs` in"
170            ui_error "\"${prefix}/etc/macports/macports.conf\":"
171            ui_error ""
172            ui_error "\t${run_archs}"
173            ui_error ""
174        }
175
176        foreach arch ${host_archs} {
177            lappend merger_configure_env(${arch}) \
178                NM='/usr/bin/nm -p'
179        }
180
181        foreach arch ${cross_archs} {
182            lappend merger_configure_env(${arch}) \
183                GTK_UPDATE_ICON_CACHE=${worksrcpath}-${run_arch}/gtk/gtk-update-icon-cache \
184                GDK_PIXBUF_CSOURCE=${worksrcpath}-${run_arch}/gdk-pixbuf/gdk-pixbuf-csource
185            lappend merger_build_env(${arch}) \
186                GDK_PIXBUF_MODULE_FILE=${worksrcpath}-${run_arch}/gdk-pixbuf/gdk-pixbuf.loaders
187        }
188
189        # Let gtk_host in .pc files be the same on all architectures
190        set host powerpc
191        if {${os.arch} eq "i386"} {
192            set host i686
193        }
194        eval reinplace s/@host@/${host}-apple-darwin${os.version}/ \
195            [glob -directory ${worksrcpath} *.pc.in]
196    }
197}
198
199variant no_x11 description {Disable X11 support} {
200    pre-fetch {
201        if {[file exists ${prefix}/lib/libpangox-1.0.dylib]} {
202            ui_error "Please install pango without the x11 variant, by running 'port install pango -x11'."
203            error "pango must be installed with the x11 variant disabled"
204        }
205    }
206}
207
208variant quartz requires no_x11 conflicts x11 {
209    configure.args-append   --with-gdktarget=quartz
210}
211
212variant x11 conflicts quartz {
213    depends_lib-append \
214        port:xorg-libXi \
215        port:xorg-libXrandr \
216        port:xorg-libXcursor \
217        port:xorg-libXinerama \
218        port:xorg-libXdamage \
219        port:xorg-libXcomposite \
220        port:xorg-libXfixes
221
222    configure.args-append      --with-xinput --enable-xinerama \
223                               --x-include=${prefix}/include --x-lib=${prefix}/lib
224}
225
226livecheck.type  regex
227livecheck.url   ftp://ftp.gnome.org/pub/gnome/sources/gtk+/${branch}/
228livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}
Note: See TracBrowser for help on using the repository browser.