2010-07-18 23:34:08 +02:00
|
|
|
#
|
|
|
|
# This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
#
|
|
|
|
# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
Import ('env')
|
|
|
|
import re
|
|
|
|
import os
|
|
|
|
|
|
|
|
prefix = env['PREFIX']
|
|
|
|
install_prefix = env['DESTDIR'] + '/' + prefix
|
|
|
|
LIBDIR_SCHEMA = env['LIBDIR_SCHEMA']
|
|
|
|
version = env['MAPNIK_VERSION_STRING']
|
|
|
|
mapnik_libname = 'mapnik2'
|
|
|
|
|
|
|
|
filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
|
|
|
|
regex = 'boost_regex%s' % env['BOOST_APPEND']
|
|
|
|
|
2010-07-20 01:01:52 +02:00
|
|
|
private_libs = ' -lfreetype -l%s -l%s -l%s' % (env['ICU_LIB_NAME'],filesystem,regex)
|
2010-07-18 23:34:08 +02:00
|
|
|
|
|
|
|
if env['THREADING'] == 'multi':
|
|
|
|
private_libs += ' -lboost_thread%s' % env['BOOST_APPEND']
|
|
|
|
|
|
|
|
if env['HAS_BOOST_SYSTEM']:
|
|
|
|
private_libs += ' -lboost_system%s' % env['BOOST_APPEND']
|
|
|
|
|
|
|
|
if env['HAS_CAIRO']:
|
2010-07-20 01:01:52 +02:00
|
|
|
private_libs += ' -lcairomm-1.0 -lcairo'
|
2010-07-18 23:34:08 +02:00
|
|
|
|
2010-07-20 01:01:52 +02:00
|
|
|
other_libs = ''.join([' -L%s' % i for i in env['LIBPATH'] if not i.startswith('#')])
|
|
|
|
other_libs += private_libs
|
2010-07-18 23:34:08 +02:00
|
|
|
|
|
|
|
# todo - refine this list
|
2010-07-20 01:01:52 +02:00
|
|
|
other_includes = ''.join([' -I%s' % i for i in env['CPPPATH'] if not i.startswith('#')])
|
2010-07-18 23:34:08 +02:00
|
|
|
|
|
|
|
top = '''#!/bin/sh
|
|
|
|
|
|
|
|
prefix=%(prefix)s
|
|
|
|
exec_prefix=${prefix}
|
|
|
|
includedir=${prefix}/include
|
|
|
|
libdir=${exec_prefix}/%(LIBDIR_SCHEMA)s
|
|
|
|
version='%(version)s'
|
|
|
|
mapnik_libname=%(mapnik_libname)s
|
|
|
|
private_libs='%(private_libs)s'
|
|
|
|
other_libs='%(other_libs)s'
|
|
|
|
other_includes='%(other_includes)s'
|
|
|
|
''' % locals()
|
|
|
|
|
|
|
|
|
|
|
|
pkg_config = '''
|
|
|
|
Name: libmapnik
|
|
|
|
Version: ${version}
|
|
|
|
Description: libmapnik library.
|
|
|
|
Requires:
|
|
|
|
Libs: -L${libdir} -l${mapnik_libname}
|
|
|
|
Libs.private: ${private_libs}
|
|
|
|
Cflags: -I${includedir}
|
|
|
|
'''
|
|
|
|
|
|
|
|
template = open('mapnik-config.template','r').read()
|
|
|
|
|
|
|
|
source = 'mapnik-config'
|
|
|
|
open(source,'w').write(top+template)
|
|
|
|
|
|
|
|
try:
|
|
|
|
os.chmod(source,0666)
|
|
|
|
except: pass
|
|
|
|
|
2010-07-18 23:40:24 +02:00
|
|
|
target_path = os.path.normpath(install_prefix+'/bin')
|
|
|
|
full_target = os.path.join(target_path,source)
|
|
|
|
|
2010-07-18 23:34:08 +02:00
|
|
|
if 'install' in COMMAND_LINE_TARGETS:
|
|
|
|
# we must add 'install' catch here because otherwise
|
|
|
|
# custom command will be run when not installing
|
|
|
|
env.Alias('install',full_target)
|
|
|
|
env.Command(full_target, source,
|
|
|
|
[
|
|
|
|
Copy("$TARGET","$SOURCE"),
|
|
|
|
Chmod("$TARGET", 0755),
|
|
|
|
])
|
|
|
|
|
2010-07-18 23:40:24 +02:00
|
|
|
env['create_uninstall_target'](env,os.path.join(target_path,source))
|
|
|
|
|
2010-07-18 23:34:08 +02:00
|
|
|
source = 'mapnik.pc'
|
|
|
|
open(source,'w').write(top+pkg_config)
|
|
|
|
try:
|
|
|
|
os.chmod(source,0666)
|
|
|
|
except: pass
|
|
|
|
target_path = os.path.normpath(install_prefix+'/lib/pkgconfig')
|
2010-07-18 23:40:24 +02:00
|
|
|
full_target = os.path.join(target_path,source)
|
2010-07-18 23:34:08 +02:00
|
|
|
env.Install(target_path,source)
|
|
|
|
env.Alias('install',target_path)
|
2010-07-18 23:40:24 +02:00
|
|
|
env['create_uninstall_target'](env,full_target)
|