root/tags/release-0.4.0/SConstruct

Revision 445, 7.7 kB (checked in by pavlenko, 2 years ago)

reverting to r432 ( to make it work on Debian based distros).

/usr/lib/libboost_xxx.so -> libboost_xxx-gcc-mt-1_33_1.so

  • Property svn:keywords set to Id
Line 
1#
2# This file is part of Mapnik (c++ mapping toolkit)
3#
4# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
5#
6# Mapnik is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Lesser General Public
8# License as published by the Free Software Foundation; either
9# version 2.1 of the License, or (at your option) any later version.
10#
11# This library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14# Lesser General Public License for more details.
15#
16# You should have received a copy of the GNU Lesser General Public
17# License along with this library; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19#
20# $Id$
21
22
23import os, sys, platform
24
25if platform.uname()[4] == 'x86_64':
26    LIBDIR_SCHEMA='lib64'
27else:
28    LIBDIR_SCHEMA='lib'
29
30opts = Options()
31opts.Add('PREFIX', 'The install path "prefix"', '/usr/local')
32opts.Add(PathOption('BOOST_INCLUDES', 'Search path for boost include files', '/usr/include'))
33opts.Add(PathOption('BOOST_LIBS', 'Search path for boost library files', '/usr/' + LIBDIR_SCHEMA))
34opts.Add('BOOST_TOOLKIT','Specify boost toolkit e.g. gcc41.','',False)
35
36opts.Add(PathOption('FREETYPE_CONFIG', 'The path to the freetype-config executable.', '/usr/bin/freetype-config'))
37opts.Add(PathOption('FRIBIDI_INCLUDES', 'Search path for fribidi include files', '/usr/include'))
38opts.Add(PathOption('FRIBIDI_LIBS','Search path for fribidi include files','/usr/' + LIBDIR_SCHEMA))
39opts.Add(PathOption('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include'))
40opts.Add(PathOption('PNG_LIBS','Search path for libpng include files','/usr/' + LIBDIR_SCHEMA))
41opts.Add(PathOption('JPEG_INCLUDES', 'Search path for libjpeg include files', '/usr/include'))
42opts.Add(PathOption('JPEG_LIBS', 'Search path for libjpeg library files', '/usr/' + LIBDIR_SCHEMA))
43opts.Add(PathOption('TIFF_INCLUDES', 'Search path for libtiff include files', '/usr/include'))
44opts.Add(PathOption('TIFF_LIBS', 'Search path for libtiff library files', '/usr/' + LIBDIR_SCHEMA))
45opts.Add(PathOption('PGSQL_INCLUDES', 'Search path for PostgreSQL include files', '/usr/include'))
46opts.Add(PathOption('PGSQL_LIBS', 'Search path for PostgreSQL library files', '/usr/' + LIBDIR_SCHEMA))
47opts.Add(PathOption('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/usr/local/include'))
48opts.Add(PathOption('PROJ_LIBS', 'Search path for PROJ.4 include files', '/usr/local/' + LIBDIR_SCHEMA))
49opts.Add(PathOption('PYTHON','Python executable', sys.executable))
50opts.Add(ListOption('INPUT_PLUGINS','Input drivers to include','all',['postgis','shape','raster']))
51opts.Add(ListOption('BINDINGS','Language bindings to build','all',['python']))
52opts.Add('DEBUG', 'Compile a debug version of mapnik', '')
53opts.Add('DESTDIR', 'The root directory to install into. Useful mainly for binary package building', '/')
54opts.Add('BIDI', 'BIDI support', '')
55
56env = Environment(ENV=os.environ, options=opts)
57env['LIBDIR_SCHEMA'] = LIBDIR_SCHEMA
58
59Help(opts.GenerateHelpText(env))
60
61conf = Configure(env)
62
63# Libraries and headers dependency checks
64
65env['CPPPATH'] = ['#agg/include', '#tinyxml', '#include', '#']
66
67for path in [env['BOOST_INCLUDES'],
68             env['PNG_INCLUDES'],
69             env['JPEG_INCLUDES'],
70             env['TIFF_INCLUDES'],
71             env['PGSQL_INCLUDES'],
72             env['PROJ_INCLUDES']]:
73    if path not in env['CPPPATH']: env['CPPPATH'].append(path)
74
75env['LIBPATH'] = ['#agg', '#src']
76
77for path in [env['BOOST_LIBS'],
78             env['PNG_LIBS'],
79             env['JPEG_LIBS'],
80             env['TIFF_LIBS'],
81             env['PGSQL_LIBS'],
82             env['PROJ_LIBS']]:
83    if path not in env['LIBPATH']: env['LIBPATH'].append(path)
84   
85env.ParseConfig(env['FREETYPE_CONFIG'] + ' --libs --cflags')
86
87if env['BIDI']:
88    env.Append(CXXFLAGS = '-DUSE_FRIBIDI')
89    if env['FRIBIDI_INCLUDES'] not in env['CPPPATH']:
90        env['CPPPATH'].append(env['FRIBIDI_INCLUDES'])
91    if env['FRIBIDI_LIBS'] not in env['LIBPATH']:
92        env['CPPPATH'].append(env['FRIBIDI_LIBS']) 
93    env['LIBS'].append('fribidi')
94
95C_LIBSHEADERS = [
96    ['m', 'math.h', True],
97    ['ltdl', 'ltdl.h', True],
98    ['png', 'png.h', True],
99    ['tiff', 'tiff.h', True],
100    ['z', 'zlib.h', True],
101    ['jpeg', ['stdio.h', 'jpeglib.h'], True],
102    ['proj', 'proj_api.h', True],
103    ['pq', 'libpq-fe.h', False]
104]
105
106if env['BIDI'] : C_LIBSHEADERS.append(['fribidi','fribidi/fribidi.h',True])
107
108BOOST_LIBSHEADERS = [
109    ['thread', 'boost/thread/mutex.hpp', True],
110    #['system', 'boost/system/system_error.hpp', True],
111    ['filesystem', 'boost/filesystem/operations.hpp', True],
112    ['regex', 'boost/regex.hpp', True],
113    ['program_options', 'boost/program_options.hpp', False]
114]
115
116for libinfo in C_LIBSHEADERS:
117    if not conf.CheckLibWithHeader(libinfo[0], libinfo[1], 'C') and libinfo[2]:
118        print 'Could not find header or shared library for %s, exiting!' % libinfo[0]
119        Exit(1)
120
121env['BOOST_APPEND'] = ''
122
123if len(env['BOOST_TOOLKIT']): toolkit = env['BOOST_TOOLKIT']
124else: toolkit = env['CC']
125
126for count, libinfo in enumerate(BOOST_LIBSHEADERS):
127    if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0], env['BOOST_APPEND']), libinfo[1], 'C++'):
128        if not conf.CheckLibWithHeader('boost_%s-%s-mt' % (libinfo[0], toolkit), libinfo[1], 'C++') and libinfo[2] and count == 0:
129            print 'Could not find header or shared library for boost %s, exiting!' % libinfo[0]
130            Exit(1)
131        else:
132            env['BOOST_APPEND'] = '-%s-mt' % toolkit
133
134Export('env')
135
136inputplugins = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
137
138bindings = [ binding.strip() for binding in Split(env['BINDINGS'])]
139
140# Check out the Python situation
141
142if 'python' in env['BINDINGS']:
143    if not os.access(env['PYTHON'], os.X_OK):
144        print "Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON']
145        Exit(1)
146
147    env['PYTHON_PREFIX'] = os.popen("%s -c 'import sys; print sys.prefix'" % env['PYTHON']).read().strip()
148    env['PYTHON_VERSION'] = os.popen("%s -c 'import sys; print sys.version'" % env['PYTHON']).read()[0:3]
149
150    print 'Bindings Python version... %s' % env['PYTHON_VERSION']
151
152    majver, minver = env['PYTHON_VERSION'].split('.')
153
154    if (int(majver), int(minver)) < (2, 2):
155        print "Python version 2.2 or greater required"
156        Exit(1)
157
158    print 'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_PREFIX'])
159
160    SConscript('bindings/python/SConscript')
161
162   
163env = conf.Finish()
164
165# Setup the c++ args for our own codebase
166
167if env['DEBUG']:
168    env.Append(CXXFLAGS = '-ansi -Wall -ftemplate-depth-100 -O0 -fno-inline -g -pthread -DDEBUG -DMAPNIK_DEBUG -DBOOST_PROPERTY_TREE_XML_PARSER_TINYXML -DTIXML_USE_STL')
169else:
170    env.Append(CXXFLAGS = '-ansi -Wall -ftemplate-depth-100 -O3 -finline-functions -Wno-inline -pthread -DNDEBUG -DBOOST_PROPERTY_TREE_XML_PARSER_TINYXML -DTIXML_USE_STL')
171
172# Build agg first, doesn't need anything special
173
174SConscript('agg/SConscript')
175
176# Build shapeindex and remove its dependency from the LIBS
177
178if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']:
179    SConscript('utils/shapeindex/SConscript')
180    env['LIBS'].remove('boost_program_options%s' % env['BOOST_APPEND'])
181
182# Build the input plug-ins
183
184if 'postgis' in inputplugins and 'pq' in env['LIBS']:
185    SConscript('plugins/input/postgis/SConscript')
186    env['LIBS'].remove('pq')
187
188if 'shape' in inputplugins:
189    SConscript('plugins/input/shape/SConscript')
190
191if 'raster' in inputplugins:
192    SConscript('plugins/input/raster/SConscript')
193
194# Build the core library
195
196SConscript('src/SConscript')
197
198# Install some free default fonts
199
200SConscript('fonts/SConscript')
Note: See TracBrowser for help on using the browser.