From 0e38731152f48245dafc2982ed3f1e884a773d9d Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 20 Jan 2014 20:16:08 -0800 Subject: [PATCH] add ENABLE_SONAME option + embed rpath/loader_path by default - closes #1225 --- SConstruct | 1 + src/build.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 33ae9ce0d..3db621e52 100644 --- a/SConstruct +++ b/SConstruct @@ -391,6 +391,7 @@ opts.AddVariables( BoolVariable('PYTHON_DYNAMIC_LOOKUP', 'On OSX, do not directly link python lib, but rather dynamically lookup symbols', 'True'), ('FRAMEWORK_SEARCH_PATH','Custom framework search path on Mac OS X', ''), BoolVariable('FULL_LIB_PATH', 'Use the full path for the libmapnik.dylib "install_name" when linking on Mac OS X', 'True'), + BoolVariable('ENABLE_SONAME', 'Use the full path for the libmapnik.dylib "install_name" when linking on Mac OS X', 'True'), ListVariable('BINDINGS','Language bindings to build','all',['python']), EnumVariable('THREADING','Set threading support','multi', ['multi','single']), EnumVariable('XMLPARSER','Set xml parser','libxml2', ['libxml2','ptree']), diff --git a/src/build.py b/src/build.py index ef6e7639d..91a7e9f69 100644 --- a/src/build.py +++ b/src/build.py @@ -100,12 +100,14 @@ if env['PLATFORM'] == 'Darwin': if env['FULL_LIB_PATH']: lib_path = '%s/%s' % (env['MAPNIK_LIB_BASE'],mapnik_libname) else: - lib_path = mapnik_libname + lib_path = '@loader_path/'+libmapnik_libname mapnik_lib_link_flag += ' -Wl,-install_name,%s' % lib_path _d = {'version':env['MAPNIK_VERSION_STRING'].replace('-pre','')} mapnik_lib_link_flag += ' -current_version %(version)s -compatibility_version %(version)s' % _d else: # unix, non-macos - mapnik_libname = env.subst(env['MAPNIK_LIB_NAME']) + (".%d.%d" % (int(ABI_VERSION[0]),int(ABI_VERSION[1]))) + mapnik_libname = env.subst(env['MAPNIK_LIB_NAME']) + if env['ENABLE_SONAME']: + mapnik_libname = env.subst(env['MAPNIK_LIB_NAME']) + (".%d.%d" % (int(ABI_VERSION[0]),int(ABI_VERSION[1]))) if env['PLATFORM'] == 'SunOS': if env['CXX'].startswith('CC'): mapnik_lib_link_flag += ' -R. -h %s' % mapnik_libname @@ -113,7 +115,13 @@ else: # unix, non-macos mapnik_lib_link_flag += ' -Wl,-h,%s' % mapnik_libname else: # Linux and others lib_env['LIBS'].append('dl') - mapnik_lib_link_flag += ' -Wl,-rpath-link,. -Wl,-soname,%s' % mapnik_libname + mapnik_lib_link_flag += ' -Wl,-rpath-link,.' + if env['ENABLE_SONAME']: + mapnik_lib_link_flag += ' -Wl,-soname,%s' % mapnik_libname + if env['FULL_LIB_PATH']: + mapnik_lib_link_flag += ' -Wl,-rpath=%s' % env['MAPNIK_LIB_BASE'] + else: + mapnik_lib_link_flag += ' -Wl,-z,origin -Wl,-rpath=\$$ORIGIN' source = Split( """