Ticket #36496: gdal_Portfile

File gdal_Portfile, 13.1 KB (added by venabled@…, 10 years ago)
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 110974 2013-09-12 07:01:08Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                gdal
7version             1.10.1
8revision            0
9categories          gis
10license             MIT BSD
11platforms           darwin
12
13maintainers         gmail.com:seanasy openmaintainer
14
15description         GDAL - Geospatial Data Abstraction Library
16
17long_description    GDAL is a translator library for raster geospatial \
18                    data formats that is released under an X/MIT style \
19                    Open Source license. As a library, it presents a \
20                    single abstract data model to the calling application \
21                    for all supported formats. The related OGR library \
22                    (which lives within the GDAL source tree) provides a \
23                    similar capability for simple features vector data.
24
25homepage            http://www.gdal.org/
26master_sites        http://www.gdal.org/dl/ \
27                    http://download.osgeo.org/gdal/ \
28                    http://download.osgeo.org/gdal/CURRENT/
29
30checksums           rmd160  b06cbd0f34a6dad99768d5f75a9856e4e027d3bc \
31                    sha256  9984f0314c0bd831eb59fb646c2bc5e13cf1378be4f51499045166cbe62be6ea
32
33depends_lib-append  port:zlib \
34                    port:libpng \
35                    port:tiff \
36                    port:libgeotiff \
37                    port:jpeg \
38                    path:include/gif_lib.h:giflib \
39                    port:proj
40
41set PYINST          ""
42set OPENCLBASE      "/System/Library/Frameworks/OpenCL.framework/"
43
44configure.args-append \
45                    --with-local=${prefix} \
46                    --with-libz=${prefix} \
47                    --without-liblzma \
48                    --with-png=${prefix} \
49                    --with-libtiff=${prefix} \
50                    --with-geotiff=${prefix} \
51                    --with-jpeg=${prefix}\
52                    --with-gif=${prefix} \
53                    --with-static-proj4=${prefix} \
54                    --without-pg \
55                    --without-grass \
56                    --without-libgrass \
57                    --without-cfitsio \
58                    --without-pcraster \
59                    --without-netcdf \
60                    --without-ogdi \
61                    --without-fme \
62                    --without-hdf4 \
63                    --without-hdf5 \
64                    --without-jasper \
65                    --without-openjpeg \
66                    --without-ecw \
67                    --without-kakadu \
68                    --without-mrsid \
69                    --without-jp2mrsid \
70                    --without-msg \
71                    --without-bsb \
72                    --without-oci \
73                    --without-grib \
74                    --without-mysql \
75                    --without-ingres \
76                    --without-xerces \
77                    --without-odbc \
78                    --without-curl \
79                    --without-sqlite3 \
80                    --without-spatialite \
81                    --without-dwgdirect \
82                    --without-idb \
83                    --without-sde \
84                    --without-geos \
85                    --without-opencl \
86                    --without-pam \
87                    --without-perl \
88                    --without-php \
89                    --without-ruby \
90                    --without-python \
91                    --without-xerces \
92                    --without-expat \
93                    --without-poppler \
94                    --mandir=${prefix}/share/man
95
96# Patch to ensure that the python installation respects DESTDIR
97patchfiles          patch-swig_python_GNUmakefile \
98                    patch-gdalwarpkernel_opencl_c.diff \
99                    patch-gdalwarpkernel_opencl_h.diff
100
101# Upstream fix for "Undefined symbols: _environ"
102patchfiles-append   patch-port-cpl_spawn.cpp.diff
103
104# Patches for universal build
105post-configure {
106    reinplace -E "s|(INST_PYMOD).*|\\1\t=\t${PYINST}|" \
107        ${worksrcpath}/GDALmake.opt
108    if {[variant_isset universal]} {
109        system "ed - ${worksrcpath}/port/cpl_config.h < ${filespath}/config.h.ed"
110    }
111}
112
113# Set target to none
114build.target
115
116variant lzma conflicts universal \
117    description {Enable LZMA (7Z) compression support} {
118    depends_lib-append      port:lzma
119    configure.args-delete   --without-liblzma
120    configure.args-append   --with-liblzma=yes
121}
122
123variant geos description {Enable GEOS geometry engine functionality} {
124    depends_lib-append      port:geos
125    configure.args-delete   --without-geos
126    configure.args-append   --with-geos=${prefix}/bin/geos-config
127}
128
129variant curl description {Enable curl support} {
130    depends_lib-append      port:curl
131    configure.args-delete   --without-curl
132    configure.args-append   --with-curl=${prefix}/bin/curl-config
133}
134
135variant mrsid description {Enable MrSID file format} {
136    depends_lib-append      port:geoexpress-sdk
137    configure.args-delete   --without-mrsid
138    configure.args-append   --with-mrsid=${prefix}/share/Geo_DSDK/Raster_DSDK
139}
140
141variant hdf4 description {Enable HDF4 file format} {
142    depends_lib-append      port:hdf4
143    configure.args-delete   --without-hdf4
144    configure.args-append   --with-hdf4=${prefix}
145}
146
147variant hdf5 description {Enable HDF5 file format} {
148    depends_lib-append      port:hdf5-18
149    configure.args-delete   --without-hdf5
150    configure.args-append   --with-hdf5=${prefix}
151}
152
153variant netcdf description {Enable NetCDF file format} {
154    depends_lib-append      port:netcdf
155    configure.args-delete   --without-netcdf
156    configure.args-append   --with-netcdf=${prefix}
157}
158
159#JPEG-2K
160variant jasper conflicts openjpeg \
161    description {Enable JasPer JPEG-2000 format support} {
162    depends_lib-append      port:jasper
163    configure.args-delete   --without-jasper
164    configure.args-append   --with-jasper=${prefix}
165}
166
167variant openjpeg conflicts jasper \
168    description {Enable OpenJPEG JPEG-2000 format support} {
169    depends_lib-append      port:openjpeg
170    configure.args-delete   --without-openjpeg
171    configure.args-append   --with-openjpeg=${prefix}
172}
173
174
175variant xerces description {Enable xerces XML support for GML file format} {
176    depends_lib-append      port:xercesc
177    configure.args-delete   --without-xerces
178    configure.args-append   --with-xerces=${prefix}
179}
180
181variant expat description {Enable expat XML support} {
182    depends_lib-append      port:expat
183    configure.args-delete   --without-expat
184    configure.args-append   --with-expat=${prefix}
185}
186
187# Python variants
188variant python24 conflicts python25 python26 python27 \
189    description {Enable Python 2.4 support} {
190    depends_lib-append      port:python24 \
191                            port:py-numpy
192    configure.args-delete   --without-python
193    configure.args-append   --with-python
194    set PYINST              ${frameworks_dir}/Python.framework/Versions/2.4
195    build.args-append       PYTHON=python2.4
196}
197
198variant python25 conflicts python24 python26 python27 \
199    description {Enable Python 2.5 support} {
200    depends_lib-append      port:python25 \
201                            port:py25-numpy
202    configure.args-delete   --without-python
203    configure.args-append   --with-python
204    set PYINST              ${frameworks_dir}/Python.framework/Versions/2.5
205    build.args-append       PYTHON=python2.5
206    use_parallel_build      no
207}
208
209variant python26 conflicts python24 python25 python27 \
210    description {Enable Python 2.6 support} {
211    depends_lib-append      port:python26 \
212                            port:py26-numpy
213    configure.args-delete   --without-python
214    configure.args-append   --with-python
215    set PYINST              ${frameworks_dir}/Python.framework/Versions/2.6
216    build.args-append       PYTHON=python2.6
217    use_parallel_build      no
218}
219
220variant python27 conflicts python24 python25 python26 \
221    description {Enable Python 2.7 support} {
222    depends_lib-append      port:python27 \
223                            port:py27-numpy
224    configure.args-delete   --without-python
225    configure.args-append   --with-python
226    build.args-append       PYTHON=python2.7
227    set PYINST               ${frameworks_dir}/Python.framework/Versions/2.7
228    use_parallel_build      no
229}
230
231# Database variants
232variant postgresql81 description {Enable PostgreSQL 8.1 support} {
233    depends_lib-append      port:postgresql81
234    configure.args-delete   --without-pg
235    configure.args-append   --with-pg=${prefix}/lib/postgresql81/bin/pg_config
236}
237
238variant postgresql82 description {Enable PostgreSQL 8.2 support} {
239    depends_lib-append      port:postgresql82
240    configure.args-delete   --without-pg
241    configure.args-append   --with-pg=${prefix}/lib/postgresql82/bin/pg_config
242}
243
244variant postgresql83 description {Enable PostgreSQL 8.3 support} {
245    depends_lib-append      port:postgresql83
246    configure.args-delete   --without-pg
247    configure.args-append   --with-pg=${prefix}/lib/postgresql83/bin/pg_config
248}
249
250variant postgresql84 description {Enable PostgreSQL 8.4 support} {
251    depends_lib-append      port:postgresql84
252    configure.args-delete   --without-pg
253    configure.args-append   --with-pg=${prefix}/lib/postgresql84/bin/pg_config
254}
255
256variant postgresql90 description {Enable PostgreSQL 9.0 support} {
257    depends_lib-append      port:postgresql90
258    configure.args-delete   --without-pg
259    configure.args-append   --with-pg=${prefix}/lib/postgresql90/bin/pg_config
260}
261
262variant postgresql91 description {Enable PostgreSQL 9.1 support} {
263    depends_lib-append      port:postgresql91
264    configure.args-delete   --without-pg
265    configure.args-append   --with-pg=${prefix}/lib/postgresql91/bin/pg_config
266}
267
268variant postgresql92 description {Enable PostgreSQL 9.2 support} {
269    depends_lib-append      port:postgresql92
270    configure.args-delete   --without-pg
271    configure.args-append   --with-pg=${prefix}/lib/postgresql92/bin/pg_config
272}
273
274variant mysql5 description {Enable MySQL 5 support} {
275    depends_lib-append      path:bin/mysql_config5:mysql5
276    configure.args-delete   --without-mysql
277    configure.args-append   --with-mysql=${prefix}/lib/mysql5/bin/mysql_config
278}
279
280variant sqlite3 description {Enable SQLite3 support} {
281    depends_lib-append      port:sqlite3
282    configure.args-delete   --without-sqlite3
283    configure.args-append   --with-sqlite3=${prefix}
284
285    post-configure {
286        reinplace -E "s|^LIBS(.*)\\\\$|LIBS\\1 -lsqlite3 \\\\|" ${worksrcpath}/GDALmake.opt
287    }
288}
289
290variant spatialite description {Enable SpartiaLite support} {
291    depends_lib-append      port:spatialite
292    configure.args-delete   --without-spatialite
293    configure.args-append   --with-spatialite=${prefix}
294}
295
296variant odbc description {Enable ODBC support} {
297    depends_lib-append      port:unixODBC
298    configure.args-delete   --without-odbc
299    configure.args-append   --with-odbc=${prefix}
300}
301
302variant poppler description {Enable poppler support} {
303    depends_lib-append      port:poppler
304    configure.args-delete   --without-popper
305    configure.args-append   --with-poppler=${prefix}
306}
307
308# OpenCL
309variant opencl description {Use OpenCL for parallel computations} {
310    configure.args-delete   --without-opencl
311    configure.args-append   --with-opencl
312    configure.args-append   --with-opencl-include=${OPENCLBASE}/Headers
313    configure.args-append   --with-opencl-lib='-framework OpenCL'
314}
315
316# OS X Framework
317variant framework description {Build as a Mac OS X framework} {
318    configure.args-append   --with-macosx-framework
319}
320
321# Perf variant to optimize code
322variant perf description {Optimize for speed} {
323    configure.compiler      macports-clang-3.3
324    configure.cflags        -O3 -pipe -march=native
325    configure.cxxflags      -O3 -pipe -march=native
326}
327
328default_variants    +expat
329
330# Postconfigure hack to avoid read ${include} .h files before
331# GDAL own include directories
332post-configure {
333    set FRMT_PATH ${worksrcpath}/ogr/ogrsf_frmts
334    foreach makefile [glob -dir $FRMT_PATH */GNUmakefile] {
335        reinplace "s|\$\(EXPAT_INCLUDE\)||" $makefile
336    }
337}
338
339post-destroot {
340    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
341    xinstall -m 644 -W ${worksrcpath} HOWTO-RELEASE NEWS VERSION \
342        ${destroot}${prefix}/share/doc/${name}
343
344    if {[variant_isset mrsid]} {
345         foreach f [list \
346            bin/gdal_contour \
347            bin/gdal_grid \
348            bin/gdal_rasterize \
349            bin/gdal_translate \
350            bin/gdaladdo \
351            bin/gdalbuildvrt \
352            bin/gdaldem \
353            bin/gdalenhance \
354            bin/gdalinfo \
355            bin/gdallocationinfo \
356            bin/gdalmanage \
357            bin/gdalserver \
358            bin/gdalsrsinfo \
359            bin/gdaltindex \
360            bin/gdaltransform \
361            bin/gdalwarp \
362            bin/nearblack \
363            bin/ogr2ogr \
364            bin/ogrinfo \
365            bin/ogrtindex \
366            bin/testepsg \
367            lib/libgdal.1.dylib] \
368            {
369                exec install_name_tool -change libltidsdk.8.dylib ${prefix}/share/Geo_DSDK/Raster_DSDK/lib/libltidsdk.8.dylib ${destroot}${prefix}/${f}
370            }
371    }
372}
373
374livecheck.type  regex
375livecheck.url   http://download.osgeo.org/gdal/CURRENT
376livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)\\.tar