Skip to content

Instantly share code, notes, and snippets.

@schwehr
Created June 17, 2013 04:52
Show Gist options
  • Save schwehr/5794715 to your computer and use it in GitHub Desktop.
Save schwehr/5794715 to your computer and use it in GitHub Desktop.
Does not yet build with libspatialite on mac osx 10.8
Info3: <<
# FIX: bring back mysql when packaged
# FIX: add libkml support... package libkml
# FIX: Can we add any of these? LIBLZMA, xerces-c, GEORASTER, EPSILON, PCRaster, NAS, DODS, DWG, Poppler, OpenCL
Package: gdal%type_pkg[pgsql]
#Package: gdal%type_pkg[pgsql]%type_pkg[mysql]
Type: pgsql (. -pgsql)
#Type: pgsql (. -pgsql), mysql (. -mysql)
Version: 1.10.0
Revision: 1
# Dependencies.
Depends: <<
%n-shlibs (= %v-%r)
<<
Suggests: gdal-py27
Conflicts: gdal, gdal-pgsql
Replaces: gdal, gdal-pgsql
#Conflicts: gdal, gdal-pgsql, gdal-mysql, gdal-pgsql-mysql
#Replaces: gdal, gdal-pgsql, gdal-mysql, gdal-pgsql-mysql
BuildDepends: <<
libjpeg9, libjasper.1, libpng16, libtiff5,
giflib,
szip, libiconv-dev, cfitsio,
netcdf-c7, netcdf-bin,
libdap11,
proj,
libogdi3,
hdf5.8,
libgeos3.3.6,
sqlite3-dev,
liblzma5,
unixodbc2 | unixodbc2-nox,
(%type_raw[pgsql] = -pgsql) postgresql91-dev (>= 1:0-0),
<<
# libspatialite5,
# libpcre1,
# FIX: add these back in when available
# (%type_raw[mysql] = -mysql) mysql-unified-dev,
Source: http://download.osgeo.org/%n/%v/%n-%v.tar.gz
# Source: http://download.osgeo.org/gdal/gdal-%v.tar.gz
Source-MD5: a2062d6ad09250e2ade40064bcd1a384
SetCPPFLAGS: -Os -I%p/include
#SetCPPFLAGS: -Os -I%b/port -I%b/gcore -I%b/alg -I%b/ogr -I%b/ogr/ogrsf_frmts -I%b/ogr/ogrsf_frmts/gtiff -I%p/include
SetLDFLAGS:
# WARNING: Watch out for the geos dependency!
ConfigureParams: --mandir=%p/share/man --with-local=%p --with-libz=%p --with-grass=no --with-cfitsio=%p --with-pcraster=no --with-netcdf=%p --with-png=%p --with-libtiff=%p --with-geotiff=internal --with-jpeg=%p --with-ogdi=%p --with-fme=no --with-jasper=yes --with-ecw=no --with-kakadu=no --with-mrsid=no --with-bsb --with-ogr --with-xerces=yes --with-xerces-inc=%p/include --with-xerces-lib='-L%p/lib -lxerces-c -lpthread' --with-hdf5=%p --with-hdf4=no --with-oci=no --with-dods-root=no --with-geos=%p/opt/libgeos3.3.6/bin/geos-config --with-static-proj4=%p (%type_raw[pgsql] = .) --without-pg (%type_raw[pgsql] = -pgsql) --with-pg=%p/bin/pg_config --with-perl --without-php --without-ruby --without-python --libdir=%p/lib --includedir=%p/include/gdal1 --without-perl --with-sqlite3=%p --with-gif=%p --with-odbc=%p --with-liblzma=%p
# --with-spatialite=%p
# --with-pcre=%p
# FIX: add these back when ready
# (%type_raw[mysql] = .) --with-mysql=no (%type_raw[mysql] = -mysql) --with-mysql=yes
# --with-dods=%p
# CompileScript: <<
# #!/bin/sh -xe
# ./configure %c
# # (cd apps && perl -pi -e 's|gdaldem|gdalflattenmask\$\(EXE\) gdaldem|' GNUmakefile)
# make -j 5
# <<
# Why was this in the make line above?
#PYTHON_INCLUDES=%p/include \
# PYTHON_LIBS='-L%p/lib/python2.6' \
# PYTHON=%p/bin/python2.6
# Install Phase.
InstallScript: <<
make install prefix=%i INST_LIB=%i/lib INST_INCLUDE=%i/include/gdal1
make install-man prefix=%i/share/man
install_name_tool -id "%p/lib/libgdal.1.dylib" %i/lib/libgdal.1.dylib
# The license file will be brought to %i/share/doc/%n by DocFiles
rm -f %i/share/gdal/LICENSE.TXT
<<
DocFiles: LICENSE.TXT
SplitOff: <<
Package: %N-shlibs
Description: GDAL/OGR shared libraries
Conflicts: gdal-shlibs, gdal-pgsql-shlibs, gdal-mysql-shlibs, gdal-pgsql-mysql-shlibs
Replaces: gdal-shlibs, gdal-pgsql-shlibs, gdal-mysql-shlibs, gdal-pgsql-mysql-shlibs
# TODO: libtiff5-shlibs
Depends: <<
libjpeg9-shlibs, libjasper.1-shlibs, libpng16-shlibs, libtiff5-shlibs,
giflib-shlibs,
szip-shlibs, libiconv,
netcdf-c7-shlibs,
hdf5.8-shlibs,
libdap11-shlibs,
proj-shlibs,
libogdi3-shlibs,
libgeos3.3.6-shlibs,
sqlite3-shlibs,
liblzma5-shlibs,
unixodbc2-shlibs | unixodbc2-nox-shlibs,
(%type_raw[pgsql] = -pgsql) postgis91,
(%type_raw[pgsql] = -pgsql) postgresql91-shlibs,
<<
# libspatialite4-shlibs,
# libpcre1-shlibs,
# FIX: add back when ready
# giflib,
# (%type_raw[mysql] = -mysql) mysql-unified,
# (%type_raw[mysql] = -mysql) mysql-unified-shlibs,
Files: lib/libgdal.*.dylib
Shlibs: %p/lib/libgdal.1.dylib 19.0.0 %n (>= 1.10.0-1)
DocFiles: LICENSE.TXT
<<
SplitOff2: <<
Package: %N-dev
Description: GDAL/OGR development headers
Conflicts: gdal-dev, gdal-pgsql-dev, gdal-mysql-dev, gdal-pgsql-mysql-dev
Replaces: gdal-dev, gdal-pgsql-dev, gdal-mysql-dev, gdal-pgsql-mysql-dev
Depends: %N-shlibs (= %v-%r)
BuildDependsOnly: true
Files: bin/gdal-config include/gdal1 lib/*.a lib/*.la lib/libgdal.dylib
DocFiles: LICENSE.TXT
<<
DescPackaging: <<
Previous versions of this package were maintained by Matt Stephenson
<[email protected]>, Blair Zajac <[email protected]>
and BABA Yoshihiko <[email protected]>.
See http://wiki.finkproject.org/index.php?title=Fink:Packaging:GIS
<<
DescPort: <<
<<
Description: Raster/Vector Geospatial Format Translator
License: BSD
Homepage: http://www.gdal.org
Maintainer: Kurt Schwehr <[email protected]>
DescDetail: <<
GDAL is a translator library for raster geospatial data formats. As a library,
it presents a single abstract data model to the calling application for all
supported formats.
Current translators include GeoTIFF (read/write), Erdas Imagine (read),
ESRI .BIL (read/write), .aux labelled raw (read/write), DTED (read),
SDTS DEM (read), CEOS (read), JPEG (read/write), PNG (read/write),
Geosoft GXF (read), Arc/Info Binary Grid (read), FITS (read/write),
netCDF (limited read/write), and GIF (read/write).
The current version of GDAL come with the related OGR library (which lives
within the GDAL source tree) provides a similar capability for simple features
vector data.
The OGR Simple Features Library is a C++ open source library (and commandline
tools) providing read (and sometimes write) access to a variety of vector file
formats including ESRI Shapefiles, S-57, SDTS, PostGIS, Oracle Spatial, and
Mapinfo mid/mif and TAB formats.
<<
DescUsage: <<
Packages that need GDAL/OGR libraries should builddepend on gdal-dev and
depend on gdal-shlibs. Make sure that configure finds the gdal-config
script in %p/bin, which tells that the headers are
in %p/include/gdal1/ and the libraries are in %p/lib/.
<<
# End of Info3
<<
@dmacks
Copy link

dmacks commented Jun 17, 2013

You're passing both --with-perl and --without-perl :)

You are working too hard to overcome makefile problems (maybe upstream has moved towards more standard settings?). For InstallScript, you can use DESTDIR to propagate the --prefix already set in CompileScript, for example:

make install DESTDIR=%d
make install-man DESTDIR=%d INST_MAN=%p/share/man

and the install_name_tool call is no longer needed

The existing InstallScript wasn't installing the manpages in the right place anyway...was using /sw/share/man/man/man1 (note second man/ atom)

I instrumented the build with various dependency-tracking tools, and found a few things (using OS X 10.8)..

It actually already does use pcre (doesn't need any flags, just BuildDepends:libpcre1 Depends:libpcre1-shlibs)

It also uses libcurl4{,-shlibs} and expat1{,-shlibs} and libxml2{,-shlibs}

There are some risky -I settings in the makefiles. 'fink-package-precedence' can help protect against their misbehavior and also (in general) help find some dependencies. Add SetCPPFLAGS:-MD (usually one can instead use ConfigureParams:--enable-dependency-tracking but gdal's configure script doesn't seem to follow that libtool standard?). Then put in CompileScript after the actual compiling (./configure and make, or whatever):

fink-package-precedence --depfile-ext='.d' --prohibit-bdep=gdal-dev,gdal-pgsql-dev,gdal-mysql-dev,gdal-pgsql-mysql-dev .

The --depfile-ext setting is not usually needed with --enable-dependenct-tracking, but is for -MD. The --prohibit-bdep list is all the BuildDependsOnly packages in the variant set.

And now, on to spatialite. When I tried --with-spatialite=%p, the build failed due to unresolved sqlite symbols. The configure.in template has the following note...

dnl Check for SQLite (only if SpatiaLite is not detected)

Looks like enabling spatialite doesn't disable sqlite codeblocks, so still need to detect/propagate sqlite flags. Easy enough to hack around that "only if...not" with the following patch:

diff -Nurd -x'*~' gdal-1.10.0.orig/configure gdal-1.10.0/configure
--- gdal-1.10.0.orig/configure  2013-04-24 14:55:27.000000000 -0400
+++ gdal-1.10.0/configure       2013-06-17 03:17:11.000000000 -0400
@@ -25055,3 +25055,3 @@
-if test "${HAVE_SPATIALITE}" = "no" ; then
+if true; then
     SQLITE3_REQ_VERSION="3.0.0"

With that, it compiles against spatialite5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment