diff --git a/SConstruct b/SConstruct index 5129351..4358a23 100644 --- a/SConstruct +++ b/SConstruct @@ -20,8 +20,6 @@ # ==================================================================== # -from __future__ import print_function - import sys import os import re @@ -168,7 +166,7 @@ env.Append(BUILDERS = { match = re.search('SERF_MAJOR_VERSION ([0-9]+).*' 'SERF_MINOR_VERSION ([0-9]+).*' 'SERF_PATCH_VERSION ([0-9]+)', - env.File('serf.h').get_contents().decode('utf-8'), + env.File('serf.h').get_contents(), re.DOTALL) MAJOR, MINOR, PATCH = [int(x) for x in match.groups()] env.Append(MAJOR=str(MAJOR)) @@ -185,7 +183,7 @@ CALLOUT_OKAY = not (env.GetOption('clean') or env.GetOption('help')) unknown = opts.UnknownVariables() if unknown: - print('Warning: Used unknown variables:', ', '.join(unknown.keys())) + print 'Warning: Used unknown variables:', ', '.join(unknown.keys()) apr = str(env['APR']) apu = str(env['APU']) @@ -226,6 +224,9 @@ if sys.platform != 'win32': else: LIBNAMESTATIC = 'serf-${MAJOR}' +env.Append(RPATH=libdir, + PDB='${TARGET.filebase}.pdb') + if sys.platform == 'darwin': # linkflags.append('-Wl,-install_name,@executable_path/%s.dylib' % (LIBNAME,)) env.Append(LINKFLAGS=['-Wl,-install_name,%s/%s.dylib' % (thisdir, LIBNAME,)]) @@ -384,6 +385,12 @@ if gssapi and CALLOUT_OKAY: if sys.platform == 'win32': env.Append(CPPDEFINES=['SERF_HAVE_SSPI']) +# On some systems, the -R values that APR describes never make it into actual +# RPATH flags. We'll manually map all directories in LIBPATH into new +# flags to set RPATH values. +for d in env['LIBPATH']: + env.Append(RPATH=':'+d) + # Set up the construction of serf-*.pc pkgconfig = env.Textfile('serf-%d.pc' % (MAJOR,), env.File('build/serf.pc.in'), @@ -454,6 +461,7 @@ else: TEST_EXES = [ os.path.join('test', '%s' % (prog)) for prog in TEST_PROGRAMS ] # Find the (dynamic) library in this directory +tenv.Replace(RPATH=thisdir) tenv.Prepend(LIBS=[LIBNAMESTATIC, ], LIBPATH=[thisdir, ])