Updated Using SCons with Mapnik (markdown)

ThomasG77 2011-12-10 09:55:05 -08:00
parent d0467e0c9d
commit 9ca5646d06

@ -24,13 +24,13 @@ For the impatient just do:
* No, for convenience Mapnik bundles a `scons-local` directory that includes all the SCons python modules needed to build Mapnik..
* This allows you to run scons locally within the Mapnik source folder like:
$ python scons/scons.py
$ python scons/scons.py
### I already have SCons installed, can I use it?
* Yes, to use your installed version of SCons rather than the bundled version just run the command:
$ scons
$ scons
### How does SCons compare to `make`?
* SCons is less verbose, handles dependency checking more thoroughly, and caches configuration settings differently.
@ -98,15 +98,15 @@ For more details on SCons vs other build tools see: http://www.scons.org/wiki/Sc
* SCons accepts command-line `key=value` arguments to customize paths to look for dependecies as well as other valuable options.
* All these arguments take the form of UPPERCASE = lowercase key value pairs. To see all possible options type:
#!sh
python scons/scons.py -h
#!sh
python scons/scons.py -h
..or if you have set custom configurations and want to see what affect they have had first `configure` then see the help:
#!sh
python scons/scons.py configure SOME_VARIABLE=some_value
python scons/scons.py -h
#!sh
python scons/scons.py configure SOME_VARIABLE=some_value
python scons/scons.py -h
* If something goes wrong when finding dependencies make sure to look in the 'config.log' for any suspicious errors when SCons tried to compile the test targets.
@ -118,289 +118,287 @@ For more details on SCons vs other build tools see: http://www.scons.org/wiki/Sc
* To get a view of the various customization options specific to building Mapnik run:
#!sh
python scons/scons.py -h
#!sh
python scons/scons.py -h
* To see some overall SCons options run:
#!sh
python scons/scons.py -H
#!sh
python scons/scons.py -H
* If during the `configure` stage Scons aborts because you are missing a dependency it will print the library name or the tool used to find libraries (ie xml2-config).
* The first way to attempt to direct SCons to custom paths for your dependencies is to set the 'LIBS' and 'INCLUDES' variables for a given library, for example:
#!sh
python scons/scons.py configure BOOST_INCLUDES=/opt/local/includes/boost BOOST_LIBS=/opt/local/lib
#!sh
python scons/scons.py configure BOOST_INCLUDES=/opt/local/includes/boost BOOST_LIBS=/opt/local/lib
* If the tool used to find a library cannot be found then specify the custom path to the program:
#!sh
python scons/scons.py configure PG_CONFIG=/usr/lib/postgresql/8.3/bin/pg_config XML2_CONFIG=/usr/local/bin/xml2-config
#!sh
python scons/scons.py configure PG_CONFIG=/usr/lib/postgresql/8.3/bin/pg_config XML2_CONFIG=/usr/local/bin/xml2-config
* Building Mapnik in debug mode can be a useful thing for new users or developers as it prompts printing of status output during rendering.
* *NOTE*: Debug mode also means that Mapnik compilation is not optimized so Mapnik will run *slower*.
#!sh
python scons/scons.py configure DEBUG=True
#!sh
python scons/scons.py configure DEBUG=True
* Note: set `XML_DEBUG=True` in addition if you want to see boost spirit debug output during XML parsing.
* As noted above SCons will inherit variables from a local 'config.py' files but if you don't want this to happen you can do:
#!sh
python scons/scons.py configure USE_CONFIG=False
#!sh
python scons/scons.py configure USE_CONFIG=False
...or you can point SCons at a custom list of locations for python files to inherit variables from:
#!sh
python scons/scons.py configure CONFIG=/home/dane/config.py,/opt/mapnik/custom_config.py
#!sh
python scons/scons.py configure CONFIG=/home/dane/config.py,/opt/mapnik/custom_config.py
* *NEW in version 0.6.0*
* Libxml2 is now the default XMLPARSER which adds Entities support to Mapnik
* But you can still configure Mapnik to build against tinyxml or spirit if you like:
#!sh
python scons/scons.py configure XML_PARSER=tinyxml
#!sh
python scons/scons.py configure XML_PARSER=tinyxml
* If you are experiencing any build problems it can be helpful to clean out all previous compiled files in the source directory:
#!sh
python scons/scons.py -c
#!sh
python scons/scons.py -c
* Boost can often require extra variables (beyond the standard BOOST_INCLUDES and BOOST_LIBS) for SCons to properly find and link the boost library.
* This is largely due to the different ways that boost installations create symlinks.
* Often source installs of boost can be properly found by specifying the BOOST_TOOLKIT or BOOST_VERSION variables:
#!sh
python scons/scons.py configure BOOST_TOOLKIT=gcc43 BOOST_VERSION=1_37
#!sh
python scons/scons.py configure BOOST_TOOLKIT=gcc43 BOOST_VERSION=1_37
* The PostGIS, Shape, and Raster (TIFF) plugins are attempted to be build by default. To enable the compilation of further plugins either do:
#!sh
python scons/scons.py configure INPUT_PLUGINS=all
#!sh
python scons/scons.py configure INPUT_PLUGINS=all
or..
#!sh
python scons/scons.py configure INPUT_PLUGINS=postgis,shape,gdal,ogr,sqlite # etc...
#!sh
python scons/scons.py configure INPUT_PLUGINS=postgis,shape,gdal,ogr,sqlite # etc...
* Cairo is an optional dependency that will be built by default if the Cairo and Cairomm (C++ bindings to Cairo) can be found. To disable to default building of Cairo do:
#!sh
python scons/scons.py configure CAIRO=False
#!sh
python scons/scons.py configure CAIRO=False
* *Note*: if Cairo and Cairomm are found, pycairo will also be built by default to enable the python binding to Cairo (and therefore access to Cairo functions in Mapnik via the Mapnik python bindings).
* SCons is very good at checking if the source code of any dependencies or the mapnik codes has changed, in order to know what targets to rebuild. This means that SCons builds can start slow.
* To skip this behavior (only recommended for advanced users) at the cost of accurate builds turn on the FAST option with:
#!sh
python scons/scons.py configure FAST=True
#!sh
python scons/scons.py configure FAST=True
* If you have a machine with several processors you can run parallel builds to speed up compilation with the JOBS option:
#!sh
python scons/scons.py configure JOBS=2
#!sh
python scons/scons.py configure JOBS=2
*Below is a dump of all the SCons options*
* Below is a dump of all the SCons options*
Note: this is based on a Mac OS 10.5 setup
#!sh
$ python scons/scons.py -h
scons: Reading SConscript files ...
Welcome to Mapnik...
scons: done reading SConscript files.
CXX: The C++ compiler to use (defaults to g++).
default: g++
actual: g++
OPTIMIZATION: Set g++ optimization level (0|1|2|3)
default: 2
actual: 3
DEBUG: Compile a debug version of Mapnik (yes|no)
default: False
actual: True
XML_DEBUG: Compile a XML verbose debug version of mapnik (yes|no)
default: False
actual: False
INPUT_PLUGINS: Input drivers to include
(all|none|comma-separated list of names)
allowed names: raster sqlite postgis ogr shape osm occi gdal
default: raster,postgis,shape
actual: gdal occi ogr osm postgis raster shape sqlite
CONFIG: The path to the python file in which to save user configuration options. Currently : 'config.py'
default: config.py
actual: config.py
USE_CONFIG: Use SCons user '%s' file (will also write variables after successful configuration) (yes|no)
default: True
actual: True
FAST: Make scons faster at the cost of less precise dependency tracking (yes|no)
default: False
actual: False
PREFIX: The install path "prefix"
default: /usr/local
actual: /usr/local
PYTHON_PREFIX: Custom install path "prefix" for python bindings (default of no prefix)
default:
actual: /Users/spring/mapnik-python/
DESTDIR: The root directory to install into. Useful mainly for binary package building
default: /
actual: /
BOOST_INCLUDES: Search path for boost include files ( /path/to/BOOST_INCLUDES )
default: /usr/include
actual: /usr/include
BOOST_LIBS: Search path for boost library files ( /path/to/BOOST_LIBS )
default: /usr/lib
actual: /usr/lib
BOOST_TOOLKIT: Specify boost toolkit, e.g., gcc41.
default:
actual:
BOOST_ABI: Specify boost ABI, e.g., d.
default:
actual:
BOOST_VERSION: Specify boost version, e.g., 1_35.
default:
actual:
FREETYPE_CONFIG: The path to the freetype-config executable.
default: freetype-config
actual: freetype-config
XML2_CONFIG: The path to the xml2-config executable.
default: xml2-config
actual: xml2-config
ICU_INCLUDES: Search path for ICU include files ( /path/to/ICU_INCLUDES )
default: /usr/include
actual: /usr/include
ICU_LIBS: Search path for ICU include files ( /path/to/ICU_LIBS )
default: /usr/lib
actual: /usr/lib
PNG_INCLUDES: Search path for libpng include files ( /path/to/PNG_INCLUDES )
default: /usr/include
actual: /usr/include
PNG_LIBS: Search path for libpng include files ( /path/to/PNG_LIBS )
default: /usr/lib
actual: /usr/lib
JPEG_INCLUDES: Search path for libjpeg include files ( /path/to/JPEG_INCLUDES )
default: /usr/include
actual: /usr/include
JPEG_LIBS: Search path for libjpeg library files ( /path/to/JPEG_LIBS )
default: /usr/lib
actual: /usr/lib
TIFF_INCLUDES: Search path for libtiff include files ( /path/to/TIFF_INCLUDES )
default: /usr/include
actual: /usr/include
TIFF_LIBS: Search path for libtiff library files ( /path/to/TIFF_LIBS )
default: /usr/lib
actual: /usr/lib
PROJ_INCLUDES: Search path for PROJ.4 include files ( /path/to/PROJ_INCLUDES )
default: /usr/local/include
actual: /usr/local/include
PROJ_LIBS: Search path for PROJ.4 library files ( /path/to/PROJ_LIBS )
default: /usr/local/lib
actual: /usr/local/lib
INTERNAL_LIBAGG: Use provided libagg (yes|no)
default: True
actual: True
CAIRO: Attempt to build with Cairo rendering support (yes|no)
default: True
actual: True
GDAL_CONFIG: The path to the gdal-config executable for finding gdal and ogr details.
default: gdal-config
actual: gdal-config
PG_CONFIG: The path to the pg_config executable.
default: pg_config
actual: pg_config
OCCI_INCLUDES: Search path for OCCI include files ( /path/to/OCCI_INCLUDES )
default: /usr/lib/oracle/10.2.0.3/client/include
actual: /usr/lib/oracle/10.2.0.3/client/include
OCCI_LIBS: Search path for OCCI library files ( /path/to/OCCI_LIBS )
default: /usr/lib/oracle/10.2.0.3/client/lib
actual: /usr/lib/oracle/10.2.0.3/client/lib
SQLITE_INCLUDES: Search path for SQLITE include files ( /path/to/SQLITE_INCLUDES )
default: /usr/include/
actual: /usr/local/include
SQLITE_LIBS: Search path for SQLITE library files ( /path/to/SQLITE_LIBS )
default: /usr/lib
actual: /usr/local/lib
SYSTEM_FONTS: Provide location for python bindings to register fonts (if given aborts installation of bundled DejaVu fonts)
default:
actual:
LIB_DIR_NAME: Name to use for lib folder where fonts and plugins are installed
default: /mapnik/
actual: /mapnik/
PYTHON: Full path to Python executable used to build bindings ( /path/to/PYTHON )
default: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
actual: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
FRAMEWORK_PYTHON: Link against Framework Python on Mac OSX (yes|no)
default: True
actual: True
BINDINGS: Language bindings to build
(all|none|comma-separated list of names)
allowed names: python
default: all
actual: python
THREADING: Set threading support (multi|single)
default: multi
actual: multi
XMLPARSER: Set xml parser (tinyxml|spirit|libxml2)
default: libxml2
actual: libxml2
JOBS: Set the number of parallel compilations
default: 1
actual: 4
DEMO: Compile demo c++ application (yes|no)
default: False
actual: False
PGSQL2SQLITE: Compile and install a utility to convert postgres tables to sqlite (yes|no)
default: False
actual: True
Use scons -H for help about command-line options.
#!sh
$ python scons/scons.py -h
scons: Reading SConscript files ...
Welcome to Mapnik...
scons: done reading SConscript files.
CXX: The C++ compiler to use (defaults to g++).
default: g++
actual: g++
OPTIMIZATION: Set g++ optimization level (0|1|2|3)
default: 2
actual: 3
DEBUG: Compile a debug version of Mapnik (yes|no)
default: False
actual: True
XML_DEBUG: Compile a XML verbose debug version of mapnik (yes|no)
default: False
actual: False
INPUT_PLUGINS: Input drivers to include
(all|none|comma-separated list of names)
allowed names: raster sqlite postgis ogr shape osm occi gdal
default: raster,postgis,shape
actual: gdal occi ogr osm postgis raster shape sqlite
CONFIG: The path to the python file in which to save user configuration options. Currently : 'config.py'
default: config.py
actual: config.py
USE_CONFIG: Use SCons user '%s' file (will also write variables after successful configuration) (yes|no)
default: True
actual: True
FAST: Make scons faster at the cost of less precise dependency tracking (yes|no)
default: False
actual: False
PREFIX: The install path "prefix"
default: /usr/local
actual: /usr/local
PYTHON_PREFIX: Custom install path "prefix" for python bindings (default of no prefix)
default:
actual: /Users/spring/mapnik-python/
DESTDIR: The root directory to install into. Useful mainly for binary package building
default: /
actual: /
BOOST_INCLUDES: Search path for boost include files ( /path/to/BOOST_INCLUDES )
default: /usr/include
actual: /usr/include
BOOST_LIBS: Search path for boost library files ( /path/to/BOOST_LIBS )
default: /usr/lib
actual: /usr/lib
BOOST_TOOLKIT: Specify boost toolkit, e.g., gcc41.
default:
actual:
BOOST_ABI: Specify boost ABI, e.g., d.
default:
actual:
BOOST_VERSION: Specify boost version, e.g., 1_35.
default:
actual:
FREETYPE_CONFIG: The path to the freetype-config executable.
default: freetype-config
actual: freetype-config
XML2_CONFIG: The path to the xml2-config executable.
default: xml2-config
actual: xml2-config
ICU_INCLUDES: Search path for ICU include files ( /path/to/ICU_INCLUDES )
default: /usr/include
actual: /usr/include
ICU_LIBS: Search path for ICU include files ( /path/to/ICU_LIBS )
default: /usr/lib
actual: /usr/lib
PNG_INCLUDES: Search path for libpng include files ( /path/to/PNG_INCLUDES )
default: /usr/include
actual: /usr/include
PNG_LIBS: Search path for libpng include files ( /path/to/PNG_LIBS )
default: /usr/lib
actual: /usr/lib
JPEG_INCLUDES: Search path for libjpeg include files ( /path/to/JPEG_INCLUDES )
default: /usr/include
actual: /usr/include
JPEG_LIBS: Search path for libjpeg library files ( /path/to/JPEG_LIBS )
default: /usr/lib
actual: /usr/lib
TIFF_INCLUDES: Search path for libtiff include files ( /path/to/TIFF_INCLUDES )
default: /usr/include
actual: /usr/include
TIFF_LIBS: Search path for libtiff library files ( /path/to/TIFF_LIBS )
default: /usr/lib
actual: /usr/lib
PROJ_INCLUDES: Search path for PROJ.4 include files ( /path/to/PROJ_INCLUDES )
default: /usr/local/include
actual: /usr/local/include
PROJ_LIBS: Search path for PROJ.4 library files ( /path/to/PROJ_LIBS )
default: /usr/local/lib
actual: /usr/local/lib
INTERNAL_LIBAGG: Use provided libagg (yes|no)
default: True
actual: True
CAIRO: Attempt to build with Cairo rendering support (yes|no)
default: True
actual: True
GDAL_CONFIG: The path to the gdal-config executable for finding gdal and ogr details.
default: gdal-config
actual: gdal-config
PG_CONFIG: The path to the pg_config executable.
default: pg_config
actual: pg_config
OCCI_INCLUDES: Search path for OCCI include files ( /path/to/OCCI_INCLUDES )
default: /usr/lib/oracle/10.2.0.3/client/include
actual: /usr/lib/oracle/10.2.0.3/client/include
OCCI_LIBS: Search path for OCCI library files ( /path/to/OCCI_LIBS )
default: /usr/lib/oracle/10.2.0.3/client/lib
actual: /usr/lib/oracle/10.2.0.3/client/lib
SQLITE_INCLUDES: Search path for SQLITE include files ( /path/to/SQLITE_INCLUDES )
default: /usr/include/
actual: /usr/local/include
SQLITE_LIBS: Search path for SQLITE library files ( /path/to/SQLITE_LIBS )
default: /usr/lib
actual: /usr/local/lib
SYSTEM_FONTS: Provide location for python bindings to register fonts (if given aborts installation of bundled DejaVu fonts)
default:
actual:
LIB_DIR_NAME: Name to use for lib folder where fonts and plugins are installed
default: /mapnik/
actual: /mapnik/
PYTHON: Full path to Python executable used to build bindings ( /path/to/PYTHON )
default: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
actual: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
FRAMEWORK_PYTHON: Link against Framework Python on Mac OSX (yes|no)
default: True
actual: True
BINDINGS: Language bindings to build
(all|none|comma-separated list of names)
allowed names: python
default: all
actual: python
THREADING: Set threading support (multi|single)
default: multi
actual: multi
XMLPARSER: Set xml parser (tinyxml|spirit|libxml2)
default: libxml2
actual: libxml2
JOBS: Set the number of parallel compilations
default: 1
actual: 4
DEMO: Compile demo c++ application (yes|no)
default: False
actual: False
PGSQL2SQLITE: Compile and install a utility to convert postgres tables to sqlite (yes|no)
default: False
actual: True
Use scons -H for help about command-line options.