Ticket #17742: Portfile

File Portfile, 5.6 KB (added by skl@…, 16 years ago)
Line 
1# $Id: Portfile 42478 2008-11-22 00:38:56Z mcalhoun@macports.org $
2
3PortSystem              1.0
4
5name                    cairo
6set my_name             cairo
7version                 1.8.4
8categories              graphics
9maintainers             ryandesign
10homepage                http://cairographics.org/
11master_sites            ${homepage}releases/
12platforms               darwin macosx
13use_parallel_build      yes
14dist_subdir             ${my_name}
15distname                ${my_name}-${version}
16
17description \
18    Cairo is a vector graphics library with cross-device output support.
19
20long_description \
21    Cairo is designed to produce identical output on all output media \
22    while taking advantage of display hardware acceleration when available \
23    (eg. through the X Render Extension).
24
25checksums \
26    md5     a5067e355e78294db2485aa97afd1115 \
27    sha1    57fd2c7e0af16bee7cd53436d7c9dc526784f1da \
28    rmd160  16e0c6a0342c98219212dac1ff956c2cb839b4e5
29
30depends_build \
31    port:pkgconfig
32
33depends_lib \
34    path:lib/pkgconfig/pixman-1.pc:libpixman \
35    port:xrender \
36    port:fontconfig \
37    port:freetype \
38    port:libpng \
39    port:zlib \
40    port:expat
41
42pre-configure {
43    set pixman_minimum_version 0.12.0
44    set pixman_installed_version [exec pkg-config pixman-1 --modversion]
45    if {[rpm-vercomp ${pixman_installed_version} ${pixman_minimum_version}] < 0} {
46        return -code error "cairo ${version} requires pixman ${pixman_minimum_version} or later but you have pixman ${pixman_installed_version}."
47    }
48}
49
50# The +universal variant is written in such a way that the port's global
51# configure.args must not be empty!
52configure.args \
53    --x-includes=${x11prefix}/include \
54    --x-libraries=${x11prefix}/lib \
55    --disable-glitz \
56    --disable-quartz \
57    --disable-quartz-font \
58    --disable-quartz-image \
59    --disable-xcb \
60    --enable-freetype \
61    --enable-pdf \
62    --enable-png \
63    --enable-ps \
64    --enable-svg \
65    --enable-xlib \
66    --enable-xlib-xrender \
67    --with-x
68
69variant glitz conflicts no_x11 description {Add glitz graphics interface} {
70    depends_lib-append \
71        port:glitz
72    configure.args-delete \
73        --disable-glitz
74    configure.args-append \
75        --enable-glitz
76}
77
78variant no_x11 conflicts glitz description {Omit X11 support} {
79    depends_lib-delete \
80        port:xrender
81    configure.args-delete \
82        --x-includes=${x11prefix}/include \
83        --x-libraries=${x11prefix}/lib \
84        --enable-xlib \
85        --enable-xlib-xrender \
86        --with-x
87    configure.args-append \
88        --disable-xlib \
89        --disable-xlib-xrender \
90        --without-x
91}
92
93platform macosx {
94    pre-fetch {
95        if {${os.major} == 8} {
96            set minimum_xcodeversion 2.4.1
97            set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
98            if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
99                return -code error "You have Xcode ${current_xcodeversion}. Please update to at least Xcode ${minimum_xcodeversion}."
100            }
101        }
102    }
103#    if {${os.major} > 7} {
104#        configure.args-delete \
105#            --disable-quartz \
106#            --disable-quartz-font \
107#            --disable-quartz-image \
108#       
109#        configure.args-append \
110#            --enable-quartz \
111#            --enable-quartz-font \
112#            --enable-quartz-image \
113#       
114#        post-destroot {
115#            xinstall -m 0644 -W [lindex ${my_worksrcpaths} 0] \
116#                src/cairo-quartz-font.pc \
117#                ${destroot}${prefix}/lib/pkgconfig
118#        }
119#    }
120}
121
122if {![info exists universal_archs]} {
123    set universal_archs {i386 ppc}
124}
125set first_arch [lindex ${universal_archs} 0]
126
127set my_worksrcpaths ${worksrcpath}
128
129variant universal {
130    set my_worksrcpaths {}
131    foreach arch ${universal_archs} {
132        lappend my_worksrcpaths ${workpath}/${arch}
133    }
134
135    post-patch {
136        foreach arch ${universal_archs} {
137            if {[string equal ${arch} ${first_arch}]} {
138                move ${worksrcpath} ${workpath}/${first_arch}
139            } else {
140                copy ${workpath}/${first_arch} ${workpath}/${arch}
141            }
142        }
143    }
144   
145    configure {
146        foreach arch ${universal_archs} {
147            set my_arch_flag "-arch ${arch}"
148            set my_cflags "${configure.cflags} -isysroot ${sysroot} ${my_arch_flag}"
149            set my_ldflags "${configure.ldflags} ${my_arch_flag}"
150            system "cd ${workpath}/${arch} && CFLAGS=\"${my_cflags}\" CXXFLAGS=\"${my_cflags}\" LDFLAGS=\"${my_ldflags}\" ${configure.cmd} ${configure.pre_args} ${configure.args}"
151        }
152    }
153   
154    build {
155        foreach arch ${universal_archs} {
156            system "cd ${workpath}/${arch} && ${build.cmd} ${build.pre_args}"
157        }
158    }
159   
160    destroot {
161        system "cd ${workpath}/${first_arch} && ${destroot.cmd} ${destroot.pre_args} ${destroot.post_args}"
162        foreach lib [list [file readlink ${workpath}/${first_arch}/src/.libs/libcairo.dylib] libcairo.a] {
163            set output_lib ${destroot}${prefix}/lib/${lib}
164            set lipo_args {}
165            foreach arch ${universal_archs} {
166                lappend lipo_args -arch ${arch} ${workpath}/${arch}/src/.libs/${lib}
167            }
168            lappend lipo_args -create -output ${output_lib}
169            delete ${output_lib}
170            system "lipo ${lipo_args}"
171        }
172    }
173}
174
175test.run                yes
176test.target             check
177
178livecheck.check         regex
179livecheck.url           ${homepage}news/
180livecheck.regex         ${my_name}-(\[0-9\]+\\.\[0-9\]*\[02468\]\\.\[0-9\]+)