From 6247bcbdfd166a5dfac5e96b9778c9f0e22c9673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Sat, 20 Sep 2014 21:47:29 +0200 Subject: [PATCH] Also build a shared library --- SConstruct | 4 ++++ src/SConscript | 8 +++++--- test/SConscript | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index f0fc4bb..160a212 100644 --- a/SConstruct +++ b/SConstruct @@ -9,6 +9,9 @@ version_info = { 'version_minor': 0 , 'version_patch': 0 , 'version_revision': revision, +#version_abi is the abi version of the shared library. Only bump it when +#backwards compatibility breaks. Strive to not break the ABI. + 'version_abi': '1.0.0' } version_info['version_str'] = "%d.%d.%d.%s" % ( version_info['version_major'], @@ -99,6 +102,7 @@ env.Append(CFLAGS = ['-Wno-unused-parameter', '-Werror=implicit-function-declara env.Append(LINKFLAGS = ['-O2', '-pthread']) env.Append(CPPDEFINES = ['_FILE_OFFSET_BITS=64']) env.Append(CPPPATH = ['#include']) +env.Append(SHLIBVERSION = version_info['version_abi']) if GetOption('force32bit'): env.Append(CFLAGS = ['-m32']) diff --git a/src/SConscript b/src/SConscript index 1367097..7d060a3 100644 --- a/src/SConscript +++ b/src/SConscript @@ -13,9 +13,11 @@ sources = ucore_env.Glob('*.c') #print 'sources:', sources[len(sources)-2] #Build library -ucore_lib = ucore_env.StaticLibrary(target='ucore' + lib_suffix , source=sources) +ucore_staticlib = ucore_env.StaticLibrary(target='ucore' + lib_suffix , source=sources) +ucore_sharedlib = ucore_env.SharedLibrary(target='ucore' + lib_suffix , source=sources) #install targets ucore_env.Alias('install', - ucore_env.Install(os.path.join(prefix, 'lib'), ucore_lib)) - + ucore_env.Install(os.path.join(prefix, 'lib'), [ucore_staticlib])) +ucore_env.Alias('install', + ucore_env.InstallVersionedLib(os.path.join(prefix, 'lib'), [ucore_sharedlib])) diff --git a/test/SConscript b/test/SConscript index 30a17fa..2e42446 100644 --- a/test/SConscript +++ b/test/SConscript @@ -23,6 +23,9 @@ test_executable = 'test_runner' if test_xml: test_executable += ' -x' +#rpath to shared lib, so test_runner can actually be executed +test_env.Append(LINKFLAGS = ['-Wl,-rpath,\\$$ORIGIN/../src']) + prog = test_env.Program('test_runner', tests) cmd = test_env.Command(target='test_phony' , source = None,