source: trunk/dports/gis/mapnik/Portfile @ 106720

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

mapnik: allow cairo-devel as dependency

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.3 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 106720 2013-06-06 11:30:05Z stromnov@macports.org $
3
4PortSystem          1.0
5
6name                mapnik
7version             2.2.0
8revision            0
9categories          gis devel
10license             LGPL-2.1
11platforms           darwin
12supported_archs     i386 x86_64
13
14maintainers         panulla.com:macports stromnov openmaintainer
15
16description         Open Source C++/Python mapping toolkit.
17
18long_description    Mapnik is a Free Toolkit for developing mapping \
19                    applications. It is written in modern C++ and has Python \
20                    bindings that support fast-paced agile development. It \
21                    can comfortably be used for both desktop map design and \
22                    web development. \
23                    \
24                    Mapnik is about making beautiful maps. It uses the AGG \
25                    graphics library, which offers world-class anti-aliasing \
26                    rendering with subpixel accuracy for geographic data.
27
28homepage            http://mapnik.org
29master_sites        http://mapnik.s3.amazonaws.com/dist/v${version}
30
31conflicts           py26-mapnik
32
33distname            mapnik-v${version}
34
35use_bzip2           yes
36
37checksums           rmd160  f0cfcb13117149a41a45d1f3dbfe87762448b8eb \
38                    sha256  9b30de4e58adc6d5aa8478779d0a47fdabe6bf8b166b67a383b35f5aa5d6c1b0
39
40depends_lib-append  port:boost \
41                    port:icu \
42                    port:libpng \
43                    port:jpeg \
44                    port:tiff \
45                    port:zlib \
46                    port:freetype \
47                    port:libxml2 \
48                    port:proj
49
50set python_suffixes {26 27}
51set python_ports {}
52foreach s ${python_suffixes} {
53    lappend python_ports python${s}
54}
55foreach s ${python_suffixes} {
56    set p python${s}
57    set v [string index ${s} 0].[string index ${s} 1]
58    set i [lsearch -exact ${python_ports} ${p}]
59    set c [lreplace ${python_ports} ${i} ${i}]
60    eval [subst {
61        variant ${p} conflicts ${c} description {Build Python bindings} {
62            depends_lib-append      port:${p}
63            configure.args-delete   BINDINGS=none
64            configure.args-append   BINDINGS=python
65            configure.args-append   PYTHON=${prefix}/bin/python${v}
66        }
67    }]
68}
69
70proc python_branch {} {
71    global python_suffixes
72    foreach s ${python_suffixes} {
73        if {[variant_isset python${s}]} { return ${s} }
74    }
75    error "Python support not enabled."
76}
77
78set input_plugins {shape geojson raster csv}
79
80variant cairo description {Enable Cairo support for PDF, PostScript, and SVG} {
81    configure.args-delete   CAIRO=False
82    configure.args-append   CAIRO=True
83    depends_build-append    port:pkgconfig
84    depends_lib-append      path:lib/pkgconfig/cairo.pc:cairo
85    if {![catch {set s [python_branch]}]} {
86        set pf Python.framework/Versions/[string index ${s} 0].[string index ${s} 1]
87        depends_lib-append  port:py${s}-cairo
88        configure.args-append PKG_CONFIG_PATH=${frameworks_dir}/${pf}/lib/pkgconfig
89        lappend input_plugins python
90    }
91}
92
93variant gdal description {Build GDAL/OGR plugin} {
94    depends_lib-append      port:gdal
95    configure.args-append   GDAL_CONFIG=${prefix}/bin/gdal-config
96    lappend input_plugins gdal ogr
97}
98
99variant osm description {Build OpenStreetMap plugin} {
100    depends_lib-append      port:curl
101    lappend input_plugins osm
102}
103
104variant postgis description {Build PostGIS plugin} {
105    depends_lib-append      path:lib/libpq.dylib:postgresql92
106    if {![file exists ${prefix}/lib/libpq.dylib]} {
107        configure.args-append   PG_CONFIG=${prefix}/lib/postgresql92/bin/pg_config
108    }
109    lappend input_plugins postgis
110}
111
112variant sqlite description {Build SQLite plugin} {
113    depends_lib-append      port:sqlite3
114    lappend input_plugins sqlite
115}
116
117default_variants    +python27
118universal_variant   no
119
120configure.pkg_config ${prefix}/bin/pkg-config
121
122if {[variant_isset python26]} {
123    configure.python    ${prefix}/bin/python2.6
124} elseif {[variant_isset python27]} {
125    configure.python    ${prefix}/bin/python2.7
126} else {
127    configure.python    /usr/bin/python
128}
129
130build.cmd           ${configure.python} scons/scons.py
131build.pre_args
132use_parallel_build  yes
133
134configure.cmd       ${build.cmd}
135configure.pre_args  configure
136configure.args      CXX=${configure.cxx} \
137                    CC=${configure.cc} \
138                    CUSTOM_CXXFLAGS=${configure.cxxflags} \
139                    CUSTOM_CFLAGS=${configure.cflags} \
140                    CUSTOM_LDFLAGS=${configure.ldflags} \
141                    PREFIX=${prefix} \
142                    DESTDIR=${destroot} \
143                    CAIRO=False \
144                    FRAMEWORK_PYTHON=False \
145                    BINDINGS=none \
146                    JOBS=${build.jobs} \
147                    FREETYPE_CONFIG=${prefix}/bin/freetype-config \
148                    XML2_CONFIG=${prefix}/bin/xml2-config
149foreach lib {BOOST ICU PNG JPEG TIFF PROJ CAIRO SQLITE} {
150    configure.args-append   ${lib}_INCLUDES=${prefix}/include
151    configure.args-append   ${lib}_LIBS=${prefix}/lib
152}
153
154destroot.destdir
155
156pre-configure {
157    # Hack to check for correct boost variant
158    if {![catch {set pys [python_branch]}]} {
159        set boost_py ${prefix}/lib/libboost_python-mt.dylib
160        if {![file exists ${boost_py}]} {
161            ui_error "
162****
163**** Your current boost does not have Python support. Please reinstall
164**** boost before trying ${name} +python${pys} again:
165****
166****     sudo port install boost +python${pys}
167****
168"
169            return -code error "Boost.Python missing"
170        }
171        regexp {Python\.framework/Versions/([[:digit:]]\.[[:digit:]])} \
172          [exec /usr/bin/otool -L ${boost_py}] foo bpv
173        if {[set bps [string replace ${bpv} 1 1]] != ${pys}} {
174            if {${bps} ni ${python_suffixes}} {
175                ui_error "
176****
177**** Your current boost is incompatible with ${name} +python${pys}.
178**** Please install the boost variant that matches ${name}:
179****
180****     sudo port install boost +python${pys}
181****
182"
183                return -code error "Incompatible Boost.Python"
184            }
185            ui_error "
186****
187**** ${name} +python${pys} is incompatible with your current boost.
188**** Please install the ${name} variant that matches boost +python${bps}:
189****
190****     sudo port install ${name} +python${bps}
191****
192**** or install the boost variant that matches ${name} +python${pys}:
193****
194****     sudo port install boost +python${pys}
195****
196"
197            return -code error "Incompatible Boost.Python"
198        }
199    }
200
201    # Must be evaluated after the variants
202    configure.args-append   INPUT_PLUGINS=[join ${input_plugins} ","]
203
204    if {[variant_isset postgis] && [variant_isset sqlite]} {
205        configure.args-append   PGSQL2SQLITE=True
206    }
207}
208
209post-destroot {
210    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
211    eval xinstall -m 640 [glob ${worksrcpath}/docs/*] \
212        ${destroot}${prefix}/share/doc/${name}
213    xinstall -m 644 -W ${worksrcpath} AUTHORS.md CHANGELOG.md COPYING README.md \
214        ${destroot}${prefix}/share/doc/${name}
215    xinstall -d -m 755 ${destroot}${prefix}/share/${name}
216    copy ${worksrcpath}/demo ${destroot}${prefix}/share/${name}
217}
218
219livecheck.type      regex
220livecheck.url       ${master_sites}
221livecheck.regex     "mapnik-v?(\\d+(?:\\.\\d+)*)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.