# # 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' input_plugins = os.path.normpath(env['PREFIX'] + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + "/input" ) if env['SYSTEM_FONTS']: fonts = os.path.normpath(env['SYSTEM_FONTS']) else: fonts = os.path.normpath(prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/fonts') svn_revision = env['SVN_REVISION'] filesystem = 'boost_filesystem%s' % env['BOOST_APPEND'] regex = 'boost_regex%s' % env['BOOST_APPEND'] private_libs = ' -lfreetype -l%s -l%s -l%s' % (env['ICU_LIB_NAME'],filesystem,regex) 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']: private_libs += ' -lcairomm-1.0 -lcairo' other_libs = env['CUSTOM_LDFLAGS'] + ''.join([' -L%s' % i for i in env['LIBPATH'] if not i.startswith('#')]) other_libs += private_libs # todo - refine this list other_includes = env['CUSTOM_CXXFLAGS'] + ''.join([' -I%s' % i for i in env['CPPPATH'] if not i.startswith('#')]) 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' fonts='%(fonts)s' input_plugins='%(input_plugins)s' svn_revision='%(svn_revision)s' ''' % locals() # TODO - add fonts and input_plugins to pkg-config? 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 target_path = os.path.normpath(install_prefix+'/bin') full_target = os.path.join(target_path,source) 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), ]) env['create_uninstall_target'](env,os.path.join(target_path,source)) source = 'mapnik2.pc' open(source,'w').write(top+pkg_config) try: os.chmod(source,0666) except: pass target_path = os.path.normpath(install_prefix+'/'+LIBDIR_SCHEMA+'/pkgconfig') full_target = os.path.join(target_path,source) if 'install' in COMMAND_LINE_TARGETS: env.Install(target_path,source) env.Alias('install',target_path) env['create_uninstall_target'](env,full_target)