From 2de1805aa3fae7a818124ece94317ce31c1bea71 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 27 Apr 2015 16:02:41 -0700 Subject: [PATCH] make mapnik-config able to report relative paths to share/ data --- SConstruct | 2 ++ utils/mapnik-config/build.py | 17 ++++++++++++++++- utils/mapnik-config/mapnik-config.template.sh | 15 +++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index e54fce9c1..365fa53be 100644 --- a/SConstruct +++ b/SConstruct @@ -324,6 +324,7 @@ opts.AddVariables( ('PATH_REMOVE', 'A path prefix to exclude from all known command and compile paths (create multiple excludes separated by :)', ''), ('PATH_REPLACE', 'Two path prefixes (divided with a :) to search/replace from all known command and compile paths', ''), ('MAPNIK_NAME', 'Name of library', 'mapnik'), + BoolVariable('MAPNIK_BUNDLED_SHARE_DIRECTORY', 'For portable packaging: instruct mapnik-config to report relative paths to bundled GDAL_DATA, PROJ_LIB, and ICU_DATA','False'), # Boost variables # default is '/usr/include', see FindBoost method below @@ -463,6 +464,7 @@ pickle_store = [# Scons internal variables 'MAPNIK_INPUT_PLUGINS_DEST', 'MAPNIK_FONTS', 'MAPNIK_FONTS_DEST', + 'MAPNIK_BUNDLED_SHARE_DIRECTORY', 'MAPNIK_LIB_BASE', 'MAPNIK_LIB_BASE_DEST', 'EXTRA_FREETYPE_LIBS', diff --git a/utils/mapnik-config/build.py b/utils/mapnik-config/build.py index 31fd9ed31..d21b2a789 100644 --- a/utils/mapnik-config/build.py +++ b/utils/mapnik-config/build.py @@ -50,6 +50,9 @@ CONFIG_MAPNIK_INCLUDE="${CONFIG_PREFIX}/include -I${CONFIG_PREFIX}/include/mapni CONFIG_DEP_INCLUDES="%(dep_includes)s" CONFIG_CXXFLAGS="%(cxxflags)s" CONFIG_CXX='%(cxx)s' +CONFIG_MAPNIK_GDAL_DATA='%(mapnik_bundled_gdal_data)s' +CONFIG_MAPNIK_PROJ_LIB='%(mapnik_bundled_proj_data)s' +CONFIG_MAPNIK_ICU_DATA='%(mapnik_bundled_icu_data)s' ''' @@ -107,6 +110,15 @@ if lib_root in inputpluginspath: lib_path = "${CONFIG_PREFIX}/" + config_env['LIBDIR_SCHEMA'] +mapnik_bundled_gdal_data = '' +mapnik_bundled_proj_data = '' +mapnik_bundled_icu_data = '' + +if config_env.get('MAPNIK_BUNDLED_SHARE_DIRECTORY'): + mapnik_bundled_gdal_data = 'lib/mapnik/share/gdal' + mapnik_bundled_proj_data = 'lib/mapnik/share/proj' + mapnik_bundled_icu_data = 'lib/mapnik/share/icu' + configuration = { "git_revision": git_revision, "git_describe": git_describe, @@ -121,7 +133,10 @@ configuration = { "input_plugins": inputpluginspath, "defines":defines, "cxxflags":cxxflags, - "cxx":env['CXX'] + "cxx":env['CXX'], + "mapnik_bundled_gdal_data":mapnik_bundled_gdal_data, + "mapnik_bundled_proj_data":mapnik_bundled_proj_data, + "mapnik_bundled_icu_data":mapnik_bundled_icu_data, } ## if we are statically linking depedencies diff --git a/utils/mapnik-config/mapnik-config.template.sh b/utils/mapnik-config/mapnik-config.template.sh index a71fdf642..27dc32cdf 100755 --- a/utils/mapnik-config/mapnik-config.template.sh +++ b/utils/mapnik-config/mapnik-config.template.sh @@ -27,6 +27,9 @@ Known values for OPTION are: --cflags all include paths, compiler flags, and pre-processor defines (for back-compatibility) --cxx c++ compiler used to build mapnik (new in 2.2.0) --all-flags all compile and link flags (new in 2.2.0) + --gdal-data path to GDAL_DATA directory, if known (relevant only for packaged builds of Mapnik) (new in 3.0.0) + --proj-lib path to PROJ_LIB directory, if known (relevant only for packaged builds of Mapnik) (new in 3.0.0) + --icu-data path to ICU_DATA directory, if known (relevant only for packaged builds of Mapnik) (new in 3.0.0) EOF exit $1 @@ -128,6 +131,18 @@ while test $# -gt 0; do echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_DEP_INCLUDES} ${CONFIG_MAPNIK_DEFINES} ${CONFIG_CXXFLAGS} -L${CONFIG_MAPNIK_LIBPATH} -l${CONFIG_MAPNIK_LIBNAME} ${CONFIG_MAPNIK_LDFLAGS} ${CONFIG_DEP_LIBS} ;; + --gdal-data) + if [[ ${CONFIG_MAPNIK_GDAL_DATA:-unset} != "unset" ]]; then echo ${CONFIG_PREFIX}/${CONFIG_MAPNIK_GDAL_DATA}; fi; + ;; + + --proj-lib) + if [[ ${CONFIG_MAPNIK_PROJ_LIB:-unset} != "unset" ]]; then echo ${CONFIG_PREFIX}/${CONFIG_MAPNIK_PROJ_LIB}; fi; + ;; + + --icu-data) + if [[ ${CONFIG_MAPNIK_ICU_DATA:-unset} != "unset" ]]; then echo ${CONFIG_PREFIX}/${CONFIG_MAPNIK_ICU_DATA}; fi; + ;; + *) # push to stderr any invalid options echo "unknown option $1" 1>&2;