2005-06-17 14:40:51 +02:00
|
|
|
#
|
2006-03-31 12:32:02 +02:00
|
|
|
# This file is part of Mapnik (c++ mapping toolkit)
|
2006-02-01 00:18:24 +01:00
|
|
|
#
|
2006-03-31 12:32:02 +02:00
|
|
|
# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
2006-02-01 00:18:24 +01:00
|
|
|
#
|
2006-03-31 12:32:02 +02:00
|
|
|
# Mapnik is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2006-02-01 00:18:24 +01:00
|
|
|
#
|
2005-06-17 14:40:51 +02:00
|
|
|
# $Id$
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-03-31 12:32:02 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
import os, sys
|
|
|
|
|
|
|
|
opts = Options()
|
|
|
|
|
|
|
|
opts.Add('PREFIX', 'The install path "prefix"', '/usr/local')
|
|
|
|
opts.Add(PathOption('BOOST_INCLUDES', 'Search path for boost include files', '/usr/include'))
|
|
|
|
opts.Add(PathOption('BOOST_LIBS', 'Search path for boost library files', '/usr/lib'))
|
2006-02-26 22:47:35 +01:00
|
|
|
opts.Add(PathOption('FREETYPE_CONFIG', 'The path to the freetype-config executable.', '/usr/bin/freetype-config'))
|
2006-02-01 00:18:24 +01:00
|
|
|
opts.Add(PathOption('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include'))
|
|
|
|
opts.Add(PathOption('PNG_LIBS', 'Search path for libpng include files', '/usr/lib'))
|
|
|
|
opts.Add(PathOption('JPEG_INCLUDES', 'Search path for libjpeg include files', '/usr/include'))
|
|
|
|
opts.Add(PathOption('JPEG_LIBS', 'Search path for libjpeg library files', '/usr/lib'))
|
|
|
|
opts.Add(PathOption('TIFF_INCLUDES', 'Search path for libtiff include files', '/usr/include'))
|
|
|
|
opts.Add(PathOption('TIFF_LIBS', 'Search path for libtiff library files', '/usr/lib'))
|
|
|
|
opts.Add(PathOption('PGSQL_INCLUDES', 'Search path for PostgreSQL include files', '/usr/include'))
|
|
|
|
opts.Add(PathOption('PGSQL_LIBS', 'Search path for PostgreSQL library files', '/usr/lib'))
|
2006-03-27 00:36:55 +02:00
|
|
|
opts.Add(PathOption('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/usr/local/include'))
|
|
|
|
opts.Add(PathOption('PROJ_LIBS', 'Search path for PROJ.4 include files', '/usr/local/lib'))
|
2006-02-05 22:01:54 +01:00
|
|
|
opts.Add(PathOption('PYTHON','Python executable', sys.executable))
|
2006-02-01 00:18:24 +01:00
|
|
|
opts.Add(ListOption('INPUT_PLUGINS','Input drivers to include','all',['postgis','shape','raster']))
|
|
|
|
opts.Add(ListOption('BINDINGS','Language bindings to build','all',['python']))
|
2006-02-05 23:19:25 +01:00
|
|
|
opts.Add('DEBUG', 'Compile a debug version of mapnik', '')
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
env = Environment(ENV=os.environ, options=opts)
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
Help(opts.GenerateHelpText(env))
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
conf = Configure(env)
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
# Libraries and headers dependency checks
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
env['CPPPATH'] = ['#agg/include', '#include']
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-04-21 21:05:23 +02:00
|
|
|
for path in [env['BOOST_INCLUDES'], env['PNG_INCLUDES'], env['JPEG_INCLUDES'], env['TIFF_INCLUDES'], env['PGSQL_INCLUDES'], env['PROJ_INCLUDES']]:
|
2006-02-01 00:18:24 +01:00
|
|
|
if path not in env['CPPPATH']: env['CPPPATH'].append(path)
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
env['LIBPATH'] = ['#agg', '#src']
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-04-21 21:05:23 +02:00
|
|
|
for path in [env['BOOST_LIBS'], env['PNG_LIBS'], env['JPEG_LIBS'], env['TIFF_LIBS'], env['PGSQL_LIBS'], env['PROJ_LIBS']]:
|
2006-02-01 00:18:24 +01:00
|
|
|
if path not in env['LIBPATH']: env['LIBPATH'].append(path)
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-26 22:47:35 +01:00
|
|
|
env.ParseConfig(env['FREETYPE_CONFIG'] + ' --libs --cflags')
|
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
C_LIBSHEADERS = [
|
|
|
|
['ltdl', 'ltdl.h', True],
|
|
|
|
['png', 'png.h', True],
|
|
|
|
['tiff', 'tiff.h', True],
|
|
|
|
['z', 'zlib.h', True],
|
2006-02-26 22:47:35 +01:00
|
|
|
['jpeg', ['stdio.h', 'jpeglib.h'], True],
|
2006-03-27 00:36:55 +02:00
|
|
|
['pq', 'libpq-fe.h', False],
|
|
|
|
['proj', 'proj_api.h', False]
|
2006-02-01 00:18:24 +01:00
|
|
|
]
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
BOOST_LIBSHEADERS = [
|
|
|
|
['thread', 'boost/thread/mutex.hpp', True],
|
|
|
|
['filesystem', 'boost/filesystem/operations.hpp', True],
|
2006-03-08 14:49:59 +01:00
|
|
|
['serialization', ['boost/archive/text_oarchive.hpp',
|
2006-02-01 00:18:24 +01:00
|
|
|
'boost/archive/text_iarchive.hpp',
|
|
|
|
'boost/archive/xml_oarchive.hpp',
|
|
|
|
'boost/archive/xml_iarchive.hpp'], True
|
|
|
|
],
|
|
|
|
['regex', 'boost/regex.hpp', True],
|
|
|
|
['program_options', 'boost/program_options.hpp', False]
|
|
|
|
]
|
|
|
|
|
|
|
|
for libinfo in C_LIBSHEADERS:
|
|
|
|
if not conf.CheckLibWithHeader(libinfo[0], libinfo[1], 'C') and libinfo[2]:
|
|
|
|
print 'Could not find header or shared library for %s, exiting!' % libinfo[0]
|
|
|
|
Exit(1)
|
|
|
|
|
2006-02-06 02:08:32 +01:00
|
|
|
env['BOOST_APPEND'] = ''
|
|
|
|
|
2006-02-15 00:59:53 +01:00
|
|
|
for count, libinfo in enumerate(BOOST_LIBSHEADERS):
|
2006-02-06 02:08:32 +01:00
|
|
|
if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0], env['BOOST_APPEND']), libinfo[1], 'C++'):
|
2006-02-15 00:59:53 +01:00
|
|
|
if not conf.CheckLibWithHeader('boost_%s-%s-mt' % (libinfo[0], env['CC']), libinfo[1], 'C++') and libinfo[2] and count == 0:
|
2006-02-01 00:18:24 +01:00
|
|
|
print 'Could not find header or shared library for boost %s, exiting!' % libinfo[0]
|
|
|
|
Exit(1)
|
2006-02-06 02:08:32 +01:00
|
|
|
else:
|
|
|
|
env['BOOST_APPEND'] = '-%s-mt' % env['CC']
|
2006-02-01 00:18:24 +01:00
|
|
|
|
2006-02-05 23:03:43 +01:00
|
|
|
Export('env')
|
|
|
|
|
|
|
|
inputplugins = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
|
|
|
|
|
|
|
|
bindings = [ binding.strip() for binding in Split(env['BINDINGS'])]
|
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
# Check out the Python situation
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
if 'python' in env['BINDINGS']:
|
|
|
|
if not os.access(env['PYTHON'], os.X_OK):
|
2006-02-05 23:03:43 +01:00
|
|
|
print "Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON']
|
2006-02-01 00:18:24 +01:00
|
|
|
Exit(1)
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
env['PYTHON_PREFIX'] = os.popen("%s -c 'import sys; print sys.prefix'" % env['PYTHON']).read().strip()
|
|
|
|
env['PYTHON_VERSION'] = os.popen("%s -c 'import sys; print sys.version'" % env['PYTHON']).read()[0:3]
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
print 'Bindings Python version... %s' % env['PYTHON_VERSION']
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
majver, minver = env['PYTHON_VERSION'].split('.')
|
|
|
|
|
2006-02-20 02:17:04 +01:00
|
|
|
if (int(majver), int(minver)) < (2, 2):
|
2006-02-01 00:18:24 +01:00
|
|
|
print "Python version 2.2 or greater required"
|
|
|
|
Exit(1)
|
|
|
|
|
|
|
|
print 'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_PREFIX'])
|
|
|
|
|
2006-02-05 23:03:43 +01:00
|
|
|
SConscript('bindings/python/SConscript')
|
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
env = conf.Finish()
|
|
|
|
|
|
|
|
# Setup the c++ args for our own codebase
|
|
|
|
|
2006-02-05 22:01:54 +01:00
|
|
|
if env['DEBUG']:
|
2006-03-08 14:49:59 +01:00
|
|
|
env.Append(CXXFLAGS = '-ansi -Wall -ftemplate-depth-100 -O0 -fno-inline -g -pthread -DDEBUG')
|
2006-02-01 00:18:24 +01:00
|
|
|
else:
|
2006-03-08 14:49:59 +01:00
|
|
|
env.Append(CXXFLAGS = '-ansi -Wall -ftemplate-depth-100 -O3 -finline-functions -Wno-inline -pthread -DNDEBUG')
|
2006-02-01 00:18:24 +01:00
|
|
|
|
|
|
|
# Build agg first, doesn't need anything special
|
|
|
|
|
|
|
|
SConscript('agg/SConscript')
|
2005-11-30 01:25:45 +01:00
|
|
|
|
2006-02-05 23:03:43 +01:00
|
|
|
# Build shapeindex and remove its dependency from the LIBS
|
2005-11-30 01:25:45 +01:00
|
|
|
|
2006-02-06 02:08:32 +01:00
|
|
|
if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']:
|
2006-02-01 00:18:24 +01:00
|
|
|
SConscript('utils/shapeindex/SConscript')
|
2006-02-06 02:08:32 +01:00
|
|
|
env['LIBS'].remove('boost_program_options%s' % env['BOOST_APPEND'])
|
2005-06-14 17:06:59 +02:00
|
|
|
|
2006-03-27 00:36:55 +02:00
|
|
|
if 'proj' in env['LIBS']:
|
|
|
|
SConscript('bindings/python/pyprojection/SConscript')
|
|
|
|
env['LIBS'].remove('proj')
|
|
|
|
|
2006-02-05 23:03:43 +01:00
|
|
|
# Build the input plug-ins
|
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
if 'postgis' in inputplugins and 'pq' in env['LIBS']:
|
|
|
|
SConscript('plugins/input/postgis/SConscript')
|
|
|
|
env['LIBS'].remove('pq')
|
2005-06-17 14:40:51 +02:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
if 'shape' in inputplugins:
|
|
|
|
SConscript('plugins/input/shape/SConscript')
|
2005-11-30 01:25:45 +01:00
|
|
|
|
2006-02-01 00:18:24 +01:00
|
|
|
if 'raster' in inputplugins:
|
|
|
|
SConscript('plugins/input/raster/SConscript')
|
|
|
|
|
|
|
|
# Build the core library
|
|
|
|
|
|
|
|
SConscript('src/SConscript')
|
2006-03-03 01:18:08 +01:00
|
|
|
|
|
|
|
# Install some free default fonts
|
|
|
|
|
|
|
|
SConscript('fonts/SConscript')
|