- added --git-revision to mapnik-config

- related to #903
This commit is contained in:
kunitoki 2011-10-19 00:22:47 +02:00
parent 8ed3b4aa0d
commit 31f42bd5c1
2 changed files with 19 additions and 9 deletions

View file

@ -10,7 +10,7 @@ config_env = env.Clone()
# TODO # TODO
# major/minor versions # major/minor versions
# git hash # git rev-list --max-count=1 HEAD
config_variables = '''#!/bin/sh config_variables = '''#!/bin/sh
@ -26,6 +26,7 @@ CONFIG_DEP_LIBS='%(dep_libs)s'
CONFIG_OTHER_INCLUDES='%(other_includes)s' CONFIG_OTHER_INCLUDES='%(other_includes)s'
CONFIG_FONTS='%(fonts)s' CONFIG_FONTS='%(fonts)s'
CONFIG_INPUT_PLUGINS='%(input_plugins)s' CONFIG_INPUT_PLUGINS='%(input_plugins)s'
CONFIG_GIT_REVISION='%(git_revision)s'
CONFIG_SVN_REVISION='%(svn_revision)s' CONFIG_SVN_REVISION='%(svn_revision)s'
CONFIG_JSON="{ CONFIG_JSON="{
@ -39,7 +40,8 @@ CONFIG_JSON="{
\\"other_includes\\": \\"${CONFIG_OTHER_INCLUDES}\\", \\"other_includes\\": \\"${CONFIG_OTHER_INCLUDES}\\",
\\"fonts\\": \\"${CONFIG_FONTS}\\", \\"fonts\\": \\"${CONFIG_FONTS}\\",
\\"input_plugins\\": \\"${CONFIG_INPUT_PLUGINS}\\", \\"input_plugins\\": \\"${CONFIG_INPUT_PLUGINS}\\",
\\"svn_revision\\": ${CONFIG_SVN_REVISION} \\"git_revision\\": \\"${CONFIG_GIT_REVISION}\\",
\\"svn_revision\\": ${CONFIG_SVN_REVISION},
}" }"
''' '''
@ -63,7 +65,7 @@ other_includes += ' '.join(config_env['LIBMAPNIK_CXXFLAGS'])
other_includes += ' ' other_includes += ' '
if config_env['HAS_CAIRO']: if config_env['HAS_CAIRO']:
other_includes += ''.join([' -I%s' % i for i in env['CAIROMM_CPPPATHS'] if not i.startswith('#')]) other_includes += ''.join([' -I%s' % i for i in env['CAIROMM_CPPPATHS'] if not i.startswith('#')])
ldflags = config_env['CUSTOM_LDFLAGS'] + ''.join([' -L%s' % i for i in config_env['LIBPATH'] if not i.startswith('#')]) ldflags = config_env['CUSTOM_LDFLAGS'] + ''.join([' -L%s' % i for i in config_env['LIBPATH'] if not i.startswith('#')])
@ -73,6 +75,8 @@ dep_libs = ''.join([' -l%s' % i for i in env['LIBMAPNIK_LIBS']])
if env['INTERNAL_LIBAGG']: if env['INTERNAL_LIBAGG']:
dep_libs = dep_libs.replace('-lagg','') dep_libs = dep_libs.replace('-lagg','')
git_revision = os.popen("git rev-list --max-count=1 HEAD").read()
configuration = { configuration = {
"prefix": config_env['PREFIX'], "prefix": config_env['PREFIX'],
"mapnik_libname": 'mapnik2', "mapnik_libname": 'mapnik2',
@ -83,6 +87,7 @@ configuration = {
"fonts": config_env['MAPNIK_FONTS'], "fonts": config_env['MAPNIK_FONTS'],
"input_plugins": config_env['MAPNIK_INPUT_PLUGINS'], "input_plugins": config_env['MAPNIK_INPUT_PLUGINS'],
"svn_revision": config_env['SVN_REVISION'], "svn_revision": config_env['SVN_REVISION'],
"git_revision": git_revision,
"version": config_env['MAPNIK_VERSION_STRING'], "version": config_env['MAPNIK_VERSION_STRING'],
} }
@ -100,7 +105,7 @@ if 'install' in COMMAND_LINE_TARGETS:
# we must add 'install' catch here because otherwise # we must add 'install' catch here because otherwise
# custom command will be run when not installing # custom command will be run when not installing
env.Alias('install',full_target) env.Alias('install',full_target)
env.Command(full_target, config_file, env.Command(full_target, config_file,
[ [
Copy("$TARGET","$SOURCE"), Copy("$TARGET","$SOURCE"),

View file

@ -19,7 +19,8 @@ Known values for OPTION are:
--json print all config options as json object --json print all config options as json object
--help display this help and exit --help display this help and exit
-v --version output version information -v --version output version information
--svn-revision output svn revision information --git-revision output git hash
--svn-revision output svn revision information (deprecated)
EOF EOF
exit $1 exit $1
@ -36,7 +37,7 @@ while test $# -gt 0; do
esac esac
case "$1" in case "$1" in
--prefix=*) --prefix=*)
prefix=$optarg prefix=$optarg
includedir=$CONFIG_PREFIX/include includedir=$CONFIG_PREFIX/include
@ -59,6 +60,10 @@ while test $# -gt 0; do
echo $CONFIG_JSON echo $CONFIG_JSON
;; ;;
--git-revision)
echo ${CONFIG_GIT_REVISION}
;;
--svn-revision) --svn-revision)
echo ${CONFIG_SVN_REVISION} echo ${CONFIG_SVN_REVISION}
;; ;;
@ -68,13 +73,13 @@ while test $# -gt 0; do
;; ;;
--fonts) --fonts)
echo ${CONFIG_FONTS} echo ${CONFIG_FONTS}
;; ;;
--input-plugins) --input-plugins)
echo ${CONFIG_INPUT_PLUGINS} echo ${CONFIG_INPUT_PLUGINS}
;; ;;
--cflags) --cflags)
echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_OTHER_INCLUDES} echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_OTHER_INCLUDES}
;; ;;