From 9674171eb4827071e3bfeab5e329aa72504d124d Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 26 Aug 2010 01:21:47 +0000 Subject: [PATCH] fixes for building on solaris and opensolaris, in addition to automatic running of ldconfig (will benefit builds on linux and fail silently otherwise) --- demo/c++/SConscript | 8 +++-- .../scons-local-1.2.0/SCons/Tool/__init__.py | 6 ++-- src/SConscript | 32 +++++++++++++++---- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/demo/c++/SConscript b/demo/c++/SConscript index ccbdbad19..db736fb6f 100644 --- a/demo/c++/SConscript +++ b/demo/c++/SConscript @@ -32,17 +32,19 @@ source = Split( headers = env['CPPPATH'] -boost_thread = 'boost_thread%s' % env['BOOST_APPEND'] boost_regex = 'boost_regex%s' % env['BOOST_APPEND'] -libraries = [boost_thread,'mapnik2'] +libraries = ['mapnik2'] + +if env['THREADING'] == 'multi': + libraries.append('boost_thread%s' % env['BOOST_APPEND']) if env['HAS_CAIRO'] in env['CXXFLAGS']: # add cairo and cairomm-1.0 to libs libraries.append('cairomm-1.0') libraries.append('cairo') -if env['PLATFORM'] == 'Darwin': +if env['PLATFORM'] in ('Darwin','SunOS'): libraries.append(boost_regex) libraries.append(env['ICU_LIB_NAME']) diff --git a/scons/scons-local-1.2.0/SCons/Tool/__init__.py b/scons/scons-local-1.2.0/SCons/Tool/__init__.py index 0b032820b..803defea2 100644 --- a/scons/scons-local-1.2.0/SCons/Tool/__init__.py +++ b/scons/scons-local-1.2.0/SCons/Tool/__init__.py @@ -581,9 +581,9 @@ def tool_list(platform, env): ars = ['sgiar'] elif str(platform) == 'sunos': "prefer Forte tools on SunOS" - linkers = ['sunlink', 'gnulink'] - c_compilers = ['suncc', 'gcc', 'cc'] - cxx_compilers = ['sunc++', 'g++', 'c++'] + linkers = ['gnulink','sunlink'] + c_compilers = ['gcc','suncc', 'cc'] + cxx_compilers = ['g++','sunc++', 'c++'] assemblers = ['as', 'gas'] fortran_compilers = ['sunf95', 'sunf90', 'sunf77', 'f95', 'f90', 'f77', 'gfortran', 'g77', 'fortran'] diff --git a/src/SConscript b/src/SConscript index ac0c367f5..63ff94e7b 100644 --- a/src/SConscript +++ b/src/SConscript @@ -20,11 +20,23 @@ # $Id$ -import glob import os +import glob +from subprocess import Popen, PIPE Import('env') +def call(cmd, silent=True): + stdin, stderr = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE).communicate() + if not stderr: + return stdin.strip() + elif not silent: + print stderr + + +def ldconfig(*args,**kwargs): + call('ldconfig') + ABI_VERSION = env['ABI_VERSION'] prefix = env['PREFIX'] @@ -74,8 +86,11 @@ if env['PLATFORM'] == 'Darwin': linkflags = '-Wl,-install_name,%s' % lib_path _d = {'version':env['MAPNIK_VERSION_STRING']} linkflags += ' -current_version %(version)s -compatibility_version %(version)s' % _d -elif env['PLATFORM'] == 'SunOS' and env['CXX'].startswith('CC'): - linkflags = '-R. -h %s' % mapnik_libname +elif env['PLATFORM'] == 'SunOS': + if env['CXX'].startswith('CC'): + linkflags = '-R. -h %s' % mapnik_libname + else: + linkflags = '-Wl,-h,%s' % mapnik_libname else: # Linux and others linkflags = '-Wl,-rpath-link,. -Wl,-soname,%s' % mapnik_libname @@ -226,7 +241,11 @@ if env['PLATFORM'] != 'Darwin': target = os.path.join(libDir, soFile) if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Alias(target='install', source=env.InstallAs(target=target, source=mapnik)) + result = env.InstallAs(target=target, source=mapnik) + env.Alias(target='install', source=result) + if result: + env.AddPostAction(result, ldconfig) + # Install symlinks target1 = os.path.join(libDir, "%s.%d.%d" % (os.path.basename(str(mapnik[0])),major, minor)) @@ -235,7 +254,6 @@ if env['PLATFORM'] != 'Darwin': if 'install' in COMMAND_LINE_TARGETS: link1 = env.Command(target1, target, symlink) env.Alias(target='install', source=link1) - if 'install' in COMMAND_LINE_TARGETS: link2 = env.Command(target2, target1, symlink) env.Alias(target='install', source=link2) # delete in reverse order.. @@ -246,7 +264,9 @@ if env['PLATFORM'] != 'Darwin': else: target_path = os.path.normpath(install_prefix + '/' + env['LIBDIR_SCHEMA']) if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Alias(target='install', source=env.Install(target_path, mapnik)) + result = env.Install(target_path, mapnik) + env.Alias(target='install', source=result) + env['create_uninstall_target'](env, os.path.join(target_path,mapnik_libname)) includes = glob.glob('../include/mapnik/*.hpp')