| 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 | import glob |
|---|
| 23 | import re |
|---|
| 24 | import os |
|---|
| 25 | |
|---|
| 26 | Import('env') |
|---|
| 27 | |
|---|
| 28 | prefix = env['PYTHON_PREFIX'] + '/' + env['LIBDIR_SCHEMA'] + '/python' + env['PYTHON_VERSION'] + '/site-packages/' |
|---|
| 29 | install_prefix = env['DESTDIR'] + '/' + prefix |
|---|
| 30 | |
|---|
| 31 | thread_suffix = '-mt' |
|---|
| 32 | |
|---|
| 33 | if env['PLATFORM'] == 'FreeBSD': |
|---|
| 34 | thread_suffix = '' |
|---|
| 35 | |
|---|
| 36 | linkflags = '' |
|---|
| 37 | libraries = ['mapnik','png','jpeg'] |
|---|
| 38 | if env['THREADING'] == 'multi': |
|---|
| 39 | libraries.append('boost_python%s%s' % (env['BOOST_APPEND'],thread_suffix)) |
|---|
| 40 | else : |
|---|
| 41 | libraries.append('boost_python%s' % env['BOOST_APPEND']) |
|---|
| 42 | |
|---|
| 43 | if env['PLATFORM'] == 'Darwin': |
|---|
| 44 | libraries.append('icuuc') |
|---|
| 45 | libraries.append('icudata') |
|---|
| 46 | if env['THREADING'] == 'multi': |
|---|
| 47 | libraries.append('boost_regex%s%s' % (env['BOOST_APPEND'],thread_suffix)) |
|---|
| 48 | else : |
|---|
| 49 | libraries.append('boost_regex%s' % env['BOOST_APPEND']) |
|---|
| 50 | |
|---|
| 51 | if env['THREADING'] == 'multi': |
|---|
| 52 | libraries.append('boost_thread%s%s' % (env['BOOST_APPEND'],thread_suffix)) |
|---|
| 53 | |
|---|
| 54 | linkflags = '-F/ -framework Python' |
|---|
| 55 | |
|---|
| 56 | headers = [env['PYTHON_PREFIX'] + '/include/python' + env['PYTHON_VERSION']] + env['CPPPATH'] |
|---|
| 57 | |
|---|
| 58 | _mapnik = env.LoadableModule('_mapnik', glob.glob('*.cpp'), LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags) |
|---|
| 59 | |
|---|
| 60 | paths = """ |
|---|
| 61 | mapniklibpath = '%s' |
|---|
| 62 | inputpluginspath = mapniklibpath + '/input' |
|---|
| 63 | fontscollectionpath = mapniklibpath + '/fonts' |
|---|
| 64 | """ |
|---|
| 65 | |
|---|
| 66 | exp = r"%s{2,}" % os.sep |
|---|
| 67 | mapnik_plugins_dir = re.sub(exp,os.sep, env['PREFIX'] + '/'+env['LIBDIR_SCHEMA']+'/mapnik') |
|---|
| 68 | file('mapnik/paths.py','w').write(paths % (mapnik_plugins_dir,)) |
|---|
| 69 | |
|---|
| 70 | pymapnik = glob.glob('mapnik/*.py') |
|---|
| 71 | env.Alias(target='install', source=env.Install(install_prefix+'/mapnik', pymapnik)) |
|---|
| 72 | pymapnik2 = glob.glob('mapnik/ogcserver/*.py') |
|---|
| 73 | env.Alias(target='install', source=env.Install(install_prefix+'/mapnik/ogcserver', pymapnik2)) |
|---|
| 74 | pymapniklib = env.Install(install_prefix+'/mapnik',_mapnik) |
|---|
| 75 | env.Alias(target="install",source=pymapniklib) |
|---|