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

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

mapnik: update to version 3.0.0-rc2

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