add mapnik-config script and pkg-config file - #175
This commit is contained in:
parent
51a791eb77
commit
31c60dc066
3 changed files with 205 additions and 0 deletions
|
@ -1266,3 +1266,6 @@ if not HELP_REQUESTED:
|
|||
|
||||
# build C++ tests
|
||||
SConscript('tests/cpp_tests/SConscript')
|
||||
|
||||
# install pkg-config script and mapnik-config script
|
||||
SConscript('utils/mapnik-config/SConscript')
|
||||
|
|
103
utils/mapnik-config/SConscript
Normal file
103
utils/mapnik-config/SConscript
Normal file
|
@ -0,0 +1,103 @@
|
|||
#
|
||||
# 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']
|
||||
|
||||
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 = private_libs + ' '.join(['-L%s' % i for i in env['LIBPATH'] if not i.startswith('#')])
|
||||
|
||||
# todo - refine this list
|
||||
other_includes = ' '.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'
|
||||
''' % 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
|
||||
|
||||
if 'install' in COMMAND_LINE_TARGETS:
|
||||
# we must add 'install' catch here because otherwise
|
||||
# custom command will be run when not installing
|
||||
target_path = os.path.normpath(install_prefix+'/bin')
|
||||
full_target = os.path.join(target_path,source)
|
||||
env.Alias('install',full_target)
|
||||
env.Command(full_target, source,
|
||||
[
|
||||
Copy("$TARGET","$SOURCE"),
|
||||
Chmod("$TARGET", 0755),
|
||||
])
|
||||
|
||||
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')
|
||||
env.Install(target_path,source)
|
||||
env.Alias('install',target_path)
|
99
utils/mapnik-config/mapnik-config.template
Executable file
99
utils/mapnik-config/mapnik-config.template
Executable file
|
@ -0,0 +1,99 @@
|
|||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: mapnik-config [OPTION]
|
||||
|
||||
Known values for OPTION are:
|
||||
|
||||
--prefix display mapnik prefix [default $prefix]
|
||||
--prefix=DIR change mapnik prefix [default $prefix]
|
||||
--exec-prefix=DIR change mapnik exec prefix [default $exec_prefix]
|
||||
--libs print library linking information
|
||||
--cflags print pre-processor and compiler flags
|
||||
--fonts print default fonts directory
|
||||
--input-plugins print default plugins directory
|
||||
--help display this help and exit
|
||||
-v --version output version information
|
||||
EOF
|
||||
|
||||
exit $1
|
||||
}
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
cflags=false
|
||||
libs=false
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
includedir=$prefix/include
|
||||
libdir=$prefix/lib
|
||||
;;
|
||||
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
libdir=$exec_prefix/lib
|
||||
;;
|
||||
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
|
||||
-v)
|
||||
echo $version
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--version)
|
||||
echo $version
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--help)
|
||||
usage 0
|
||||
;;
|
||||
|
||||
--fonts)
|
||||
echo ${libdir}/mapnik2/fonts
|
||||
;;
|
||||
|
||||
--plugins)
|
||||
echo ${libdir}/mapnik2/input
|
||||
;;
|
||||
|
||||
--cflags)
|
||||
echo -I${includedir} ${other_includes}
|
||||
;;
|
||||
|
||||
#
|
||||
# --modules)
|
||||
# echo 1
|
||||
# ;;
|
||||
|
||||
--libs)
|
||||
echo -L${libdir} -l${mapnik_libname} ${other_libs}
|
||||
;;
|
||||
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
exit 0
|
Loading…
Reference in a new issue