SCons: experimental support for some library lookup concerns

- setting -rpath with $ORIGIN  to build a relocatable package
 - fix missing DT_SONAME (likely just a problem of very old SCons version)
This commit is contained in:
Fischlurch 2011-01-28 23:31:00 +01:00
parent a29591c299
commit 764a38abe6
4 changed files with 58 additions and 12 deletions

View file

@ -337,14 +337,14 @@ def defineBuildTargets(env, artifacts):
lApp = env.SharedLibrary('$LIBDIR/lumieracommon', srcSubtree(env,'$SRCDIR/common'))
lBack = env.SharedLibrary('$LIBDIR/lumierabackend', srcSubtree(env,'$SRCDIR/backend'))
lProc = env.SharedLibrary('$LIBDIR/lumieraproc', srcSubtree(env,'$SRCDIR/proc'))
lLib = env.SharedLibrary('$LIBDIR/lumiera', srcSubtree(env,'$SRCDIR/lib'))
lLib = env.LumieraLibrary('$LIBDIR/lumiera', srcSubtree(env,'$SRCDIR/lib'))
lApp = env.LumieraLibrary('$LIBDIR/lumieracommon', srcSubtree(env,'$SRCDIR/common'), LIBS=lLib)
lBack = env.LumieraLibrary('$LIBDIR/lumierabackend', srcSubtree(env,'$SRCDIR/backend'))
lProc = env.LumieraLibrary('$LIBDIR/lumieraproc', srcSubtree(env,'$SRCDIR/proc'))
core = lLib+lApp+lBack+lProc
artifacts['lumiera'] = env.Program('$BINDIR/lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core)
artifacts['lumiera'] = env.LumieraExe('$BINDIR/lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core)
artifacts['corelib'] = lLib+lApp
artifacts['support'] = lLib

View file

@ -27,6 +27,7 @@ import SCons.SConf
from SCons.Environment import Environment
from Buildhelper import *
from os import path
@ -79,6 +80,51 @@ class LumieraEnvironment(Environment):
if alias:
self.libInfo[alias] = libInfo
return libInfo
def LumieraLibrary (self, *args,**kw):
""" add some tweaks missing in SCons 1.0
like proper handling for SONAME
"""
print "hurgha"
if 'soname' in kw:
soname = self.subst(kw['soname'])
else:
if len(args) > 0:
pathname = args[0]
elif 'target' in kw:
pathname = kw['target']
else:
raise SyntaxError("Library builder requires target spec. Arguments: %s %s" % (args,kw))
print "SharedLib: path=%s" % pathname
(dirprefix, libname) = path.split(pathname)
if not libname:
raise ValueError("Library name missing. Only got a directory: "+pathname)
libname = "${SHLIBPREFIX}%s$SHLIBSUFFIX" % libname
print "name = "+libname
soname = self.subst(libname)
print "konstruierter name "+soname
assert soname
subEnv = self.Clone()
subEnv.Append(LINKFLAGS = "-Wl,-soname="+soname )
libBuilder = self.get_builder('SharedLibrary')
print "libBuilder=%s" % libBuilder
print "args = %s, kw = %s" % (args,kw)
return libBuilder(subEnv, *args,**kw);
def LumieraExe (self, *args,**kw):
""" add handling for rpath with $ORIGIN
"""
print "progrom"
subEnv = self.Clone()
subEnv.Append( LINKFLAGS = "-Wl,-rpath=\\$$ORIGIN/$LIBDIR,--enable-new-dtags" )
programBuilder = self.get_builder('Program')
return programBuilder (subEnv, *args,**kw);

View file

@ -12,12 +12,12 @@ envSvg.mergeConf(['librsvg-2.0'])
envSvg.Append(LIBS=support_lib)
luidgen = env.Program('#$BINDIR/luidgen', 'luidgen.c', LIBS=support_lib) ## for generating Lumiera-UIDs
rsvg = envSvg.Program('#$BINDIR/rsvg-convert','rsvg-convert.c') ## for rendering SVG icons (uses librsvg)
luidgen = env.LumieraExe('#$BINDIR/luidgen', 'luidgen.c', LIBS=support_lib) ## for generating Lumiera-UIDs
rsvg = envSvg.LumieraExe('#$BINDIR/rsvg-convert','rsvg-convert.c') ## for rendering SVG icons (uses librsvg)
# build additional test and administrative tools....
artifacts['tools'] = [ env.Program('#$BINDIR/hello-world','hello.c') #### hello world (checks C build)
+ env.Program('#$BINDIR/try', 'try.cpp') #### to try out some feature...
artifacts['tools'] = [ env.LumieraExe('#$BINDIR/hello-world','hello.c') #### hello world (checks C build)
+ env.LumieraExe('#$BINDIR/try', 'try.cpp') #### to try out some feature...
# + luidgen
+ rsvg
]

View file

@ -35,7 +35,7 @@ def testExecutable(env,tree, exeName=None, obj=None):
obj = srcSubtree(env,tree, isShared=False) # use all sourcefiles found in subtree
if not exeName:
exeName = 'test-%s' % tree
return env.Program('#$BINDIR/'+exeName, obj + core)
return env.LumieraExe('#$BINDIR/'+exeName, obj + core)
def testCollection(env,dir):
@ -44,7 +44,7 @@ def testCollection(env,dir):
"""
srcpatt = ['test-*.c']
exeName = lambda p: path.basename(path.splitext(p)[0])
buildIt = lambda p: env.Program("#$BINDIR/"+exeName(p), [p] + core)
buildIt = lambda p: env.LumieraExe("#$BINDIR/"+exeName(p), [p] + core)
return [buildIt(f) for f in scanSubtree(dir,srcpatt)]
@ -67,7 +67,7 @@ artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in ['bugs'] ]
# for creating a Valgrind-Suppression file
vgsuppr = env.Program('#$BINDIR/vgsuppression','tool/vgsuppression.c', LIBS=core) ## for suppressing false valgrind alarms
vgsuppr = env.LumieraExe('#$BINDIR/vgsuppression','tool/vgsuppression.c', LIBS=core) ## for suppressing false valgrind alarms
artifacts['tools'] += [vgsuppr]
Depends(ts,vgsuppr)