in progress
version: 1.6.2
source: http://www.gdal.org/
The GDAL build is mostly straightforward. GRASS support is a tricky bit, but easily solved - use a separate plugin.
First up, a patch.
To use the system iODBC instead needing to build a separate UnixODBC.
Edit configure.
Change all occurrences of "-lodbc" with "-liodbc" (case sensitive, not whole words).
Edit port/cpl_odbc.h. Change the odbcinst include to:
#include <iodbcinst.h>
64bit note: the ARCHFLAGS option below will build the Python modules 64bit. The Python libraries needed are 64bit on Leopard, but the executable is not. It's here mainly for completeness and ready for the day when Python is fully 64bit on OSX.
In the GDAL source:
export MACOSX_DEPLOYMENT_TARGET=10.5 export ARCHFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64" ./configure --with-threads --disable-static --without-grass --with-jasper=/usr/local \ --with-libtiff=/usr/local --with-jpeg=/usr/local --with-gif=/usr/local --with-png=/usr/local \ --with-geotiff=internal --with-sqlite3=/usr --with-odbc --with-pcraster=internal \ --with-geos=/usr/local/bin/geos-config --with-static-proj4=/usr/local --with-expat=/usr/local \ --with-xerces --with-xerces-inc=/usr/local/include \ --with-xerces-lib="-L/usr/local/lib -lxerces-c -framework CoreServices" --with-curl --with-python \ --with-macosx-framework CFLAGS="-Os -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXXFLAGS="-Os -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ LDFLAGS="-arch i386 -arch x86_64 -arch ppc -arch ppc64"
If you installed any of these optional packages, add to the configure line:
| PostgreSQL |
–with-pg=/usr/local/pgsql/bin/pg_config
|
| MrSID Geo DSDK |
–with-mrsid=and drag the MrSID Geo DSDK folder from the Finder to the Terminal window. |
| MySQL |
–with-mysql=/usr/local/mysql/bin/mysql_config
|
| NetCDF |
–with-netcdf=/usr/local
|
| HDF 4 & 5 |
–with-hdf4=/usr/local –with-hdf5=/usr/local
|
| OGDI |
–with-ogdi=/usr/local
|
| CFITSIO |
–with-cfitsio=/usr/local
|
| DAP |
–with-dods-root=/usr/local
|
| ECW |
–with-ecw=/usr/local
|
Replace lines:
– HOST_FILLORDER line with:
#ifdef __BIG_ENDIAN__ #define HOST_FILLORDER FILLORDER_MSB2LSB #else #define HOST_FILLORDER FILLORDER_LSB2MSB #endif
– SIZEOF_LONG line with:
#ifdef __LP64__ #define SIZEOF_LONG 8 #else #define SIZEOF_LONG 4 #endif
– SIZEOF_UNSIGNED_LONG line with:
#ifdef __LP64__ #define SIZEOF_UNSIGNED_LONG 8 #else #define SIZEOF_UNSIGNED_LONG 4 #endif
– SIZEOF_VOIDP line with:
#ifdef __LP64__ #define SIZEOF_VOIDP 8 #else #define SIZEOF_VOIDP 4 #endif
– WORDS_BIGENDIAN line with:
#ifdef __BIG_ENDIAN__ #define WORDS_BIGENDIAN 1 #else #undef WORDS_BIGENDIAN #endif
– VSI_STAT64 and VSI_STAT64_T lines with:
#define VSI_STAT64 stat #define VSI_STAT64_T stat
Then finish:
make sudo make install
In the GDAL source:
export MACOSX_DEPLOYMENT_TARGET=10.4 export ARCHFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64" ./configure --with-threads --disable-static --without-grass --with-jasper=/usr/local \ --with-libtiff=/usr/local --with-jpeg=/usr/local --with-gif=/usr/local --with-png=/usr/local \ --with-geotiff=internal --with-sqlite3=/usr --with-odbc --with-pcraster=internal \ --with-geos=/usr/local/bin/geos-config --with-static-proj4=/usr/local --with-expat=/usr/local \ --with-xerces --with-xerces-inc=/usr/local/include \ --with-xerces-lib="-L/usr/local/lib -lxerces-c -framework CoreServices" --with-curl --with-python \ --with-macosx-framework CFLAGS="-Os -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \ CXXFLAGS="-Os -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \ LDFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
If you installed any of these optional packages, add to the configure line:
| PostgreSQL |
–with-pg=/usr/local/pgsql/bin/pg_config
|
| MrSID Geo DSDK |
–with-mrsid=and drag the MrSID Geo DSDK folder from the Finder to the Terminal window. |
| MySQL |
–with-mysql=/usr/local/mysql/bin/mysql_config
|
| NetCDF |
–with-netcdf=/usr/local
|
| HDF 4 & 5 |
–with-hdf4=/usr/local –with-hdf5=/usr/local
|
| OGDI |
–with-ogdi=/usr/local
|
| CFITSIO |
–with-cfitsio=/usr/local
|
| DAP |
–with-dods-root=/usr/local
|
| ECW |
–with-ecw=/usr/local
|
Replace lines:
– HOST_FILLORDER line with:
#ifdef __BIG_ENDIAN__ #define HOST_FILLORDER FILLORDER_MSB2LSB #else #define HOST_FILLORDER FILLORDER_LSB2MSB #endif
– WORDS_BIGENDIAN line with:
#ifdef __BIG_ENDIAN__ #define WORDS_BIGENDIAN 1 #else #undef WORDS_BIGENDIAN #endif
Then finish:
make sudo make install
To build using the frameworks, change the following options as given:
--with-jasper=/Library/Frameworks/UnixImageIO.framework/unix \ --with-libtiff=/Library/Frameworks/UnixImageIO.framework/unix \ --with-jpeg=/Library/Frameworks/UnixImageIO.framework/unix \ --with-gif=/Library/Frameworks/UnixImageIO.framework/unix \ --with-png=/Library/Frameworks/UnixImageIO.framework/unix \ --with-sqlite3=/Library/Frameworks/SQLite3.framework/unix \ --with-geos=/Library/Frameworks/GEOS.framework/Programs/geos-config \ --with-static-proj4=/Library/Frameworks/PROJ.framework/unix \
GRASS support must be done as a plugin. This is so that GRASS itself (needed by the plugin) can be compiled after GDAL (needed by GRASS).
Note: starting with v6.4, GRASS is particular about its library versions. If you build the GDAL-GRASS plugin for GRASS 6.4, then install and run GRASS 6.5, GRASS will complain because GDAL is still using the GRASS 6.4 libraries.
So, first, install GRASS. The following instructions assume that GRASS is built as an application, with version x.y (ie 6.4).
Combine the files from the GDAL source dirs: frmts/grass and ogr/ogrsf_frmts/grass. It's OK to overwrite the GNUMakefile of one with the other, because you then download this custom GNUMakefile and unzip it and overwrite whichever GNUMakefile is left.
Now, in this merged grass folder:
export MACOSX_DEPLOYMENT_TARGET=10.5 make GRASSPREFIX=/Applications/GRASS-x.y.app/Contents/MacOS \ GDALPREFIX=/usr/local PROJPREFIX=/usr/local \ ARCHFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64"
export MACOSX_DEPLOYMENT_TARGET=10.5 make GRASSPREFIX=/Applications/GRASS-x.y.app/Contents/MacOS \ GDALPREFIX=/usr/local PROJPREFIX=/usr/local \ ARCHFLAGS="-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
Manually copy the resulting gdal_GRASS.dylib and ogr_GRASS.dylib to the GDAL plugins dir. On a /usr/local install, this will be /usr/local/lib/gdalplugins. For a GDAL framework this is /Library/Application Support/GDAL/PlugIns/$(GDALVER).