switch to use the new (better) builder implementation

especially this means to use the common well-known names again,
like "Program" "SharedLibrary". The customisation now happens
invisible in LumieraEnvironment.
This commit is contained in:
Fischlurch 2011-01-30 17:00:15 +01:00
parent ab481a80b8
commit 609873d90b
4 changed files with 15 additions and 74 deletions

View file

@ -338,16 +338,16 @@ def defineBuildTargets(env, artifacts):
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'))
lLib = env.SharedLibrary('$LIBDIR/lumiera', srcSubtree(env,'$SRCDIR/lib'))
lApp = env.SharedLibrary('$LIBDIR/lumieracommon', srcSubtree(env,'$SRCDIR/common'), LIBS=lLib)
lBack = env.SharedLibrary('$LIBDIR/lumierabackend', srcSubtree(env,'$SRCDIR/backend'))
lProc = env.SharedLibrary('$LIBDIR/lumieraproc', srcSubtree(env,'$SRCDIR/proc'))
core = lLib+lApp+lBack+lProc
artifacts['corelib'] = core
artifacts['support'] = lLib
artifacts['lumiera'] = env.LumieraExe('$TARGDIR/lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core)
artifacts['lumiera'] = env.Program('$TARGDIR/lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core)
# building Lumiera Plugins
envPlu = env.Clone()
@ -368,7 +368,7 @@ def defineBuildTargets(env, artifacts):
envGtk.Append(CPPDEFINES='LUMIERA_PLUGIN', LIBS=core)
objgui = srcSubtree(envGtk,'$SRCDIR/gui')
guimodule = envGtk.LoadableModule('$LIBDIR/gtk_gui', objgui, SHLIBPREFIX='', SHLIBSUFFIX='.lum')
guimodule = envGtk.LumieraPlugin('$LIBDIR/gtk_gui', objgui, SHLIBPREFIX='', SHLIBSUFFIX='.lum')
artifacts['gui'] = ( guimodule
+ env.Install('$TARGDIR', env.Glob('$SRCDIR/gui/*.rc'))
+ artifacts['icons']
@ -441,8 +441,6 @@ artifacts = {}
# 'gui' : the GTK UI (plugin)
# 'plugins' : plugin shared lib
# 'tools' : small tool applications (e.g mpegtoc)
# 'src,tar' : source tree as tarball (without doc)
# 'doc.tar' : uml model, wiki, dev docu (no src)
definePackagingTargets(env, artifacts)
defineBuildTargets(env, artifacts)

View file

@ -109,65 +109,6 @@ class LumieraEnvironment(Environment):
action = Action(makeLink,reportLink)
self.Command (target,source, action)
def defineSoname (self, *args,**kw):
""" internal helper to extract or guess
a suitable library SONAME, either using an
explicit spec, falling back on the lib filename
"""
if 'soname' in kw:
soname = self.subst(kw['soname']) # explicitely defined by user
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))
(dirprefix, libname) = path.split(pathname)
if not libname:
raise ValueError("Library name missing. Only got a directory: "+pathname)
libname = "${SHLIBPREFIX}%s$SHLIBSUFFIX" % libname
soname = self.subst(libname) # else: use the library filename as DT_SONAME
assert soname
return soname
def LumieraLibrary (self, *args,**kw):
""" augments the built-in SharedLibrary() builder to add
some tweaks missing in SCons 1.0, like setting a SONAME proper
instead of just passing the relative pathname to the linker
"""
subEnv = self.Clone()
subEnv.Append(LINKFLAGS = "-Wl,-soname="+self.defineSoname(*args,**kw))
libBuilder = self.get_builder('SharedLibrary')
return libBuilder(subEnv, *args,**kw); # invoke the predefined builder on the augmented environment
def LumieraPlugin (self, *args,**kw):
""" builds a shared library, autmented by some defaults for lumiera plugins.
"""
subEnv = self.Clone()
subEnv.Append(LINKFLAGS = "-Wl,-soname="+self.defineSoname(*args,**kw))
libBuilder = self.get_builder('LoadableModule')
return libBuilder(subEnv, *args,**kw); # invoke the predefined builder on the augmented environment
def LumieraExe (self, *args,**kw):
""" augments the built-in Program() builder to add a fixed rpath based on $ORIGIN
That is: after searching LD_LIBRARY_PATH, but before the standard linker search,
the directory relative to the position of the executable ($ORIGIN) is searched.
This search path is active not only for the executable, but for all libraries
it is linked with
"""
subEnv = self.Clone()
subEnv.Append( LINKFLAGS = "-Wl,-rpath=\\$$ORIGIN/$MODULES,--enable-new-dtags" )
programBuilder = self.get_builder('Program')
return programBuilder (subEnv, *args,**kw);
@ -317,7 +258,9 @@ def register_LumieraCustomBuilders (lumiEnv):
programBuilder = LumieraExeBuilder (programBuilder)
libraryBuilder = LumieraModuleBuilder (libraryBuilder)
smoduleBuilder = LumieraModuleBuilder (smoduleBuilder)
lpluginBuilder = LumieraModuleBuilder (smoduleBuilder)
lumiEnv['BUILDERS']['Program'] = programBuilder lumiEnv['BUILDERS']['SharedLibrary'] = libraryBuilder lumiEnv['BUILDERS']['LoadableModule'] = smoduleBuilder
lumiEnv['BUILDERS']['LumieraPlugin'] = lpluginBuilder

View file

@ -12,12 +12,12 @@ envSvg.mergeConf(['librsvg-2.0'])
envSvg.Append(LIBS=support_lib)
luidgen = env.LumieraExe('#$TARGDIR/luidgen', 'luidgen.c', LIBS=support_lib) ## for generating Lumiera-UIDs
rsvg = envSvg.LumieraExe('#$TARGDIR/rsvg-convert','rsvg-convert.c') ## for rendering SVG icons (uses librsvg)
luidgen = env.Program('#$TARGDIR/luidgen', 'luidgen.c', LIBS=support_lib) ## for generating Lumiera-UIDs
rsvg = envSvg.Program('#$TARGDIR/rsvg-convert','rsvg-convert.c') ## for rendering SVG icons (uses librsvg)
# build additional test and administrative tools....
artifacts['tools'] = [ env.LumieraExe('#$TARGDIR/hello-world','hello.c') #### hello world (checks C build)
+ env.LumieraExe('#$TARGDIR/try', 'try.cpp') #### to try out some feature...
artifacts['tools'] = [ env.Program('#$TARGDIR/hello-world','hello.c') #### hello world (checks C build)
+ env.Program('#$TARGDIR/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.LumieraExe('#$TARGDIR/'+exeName, obj + core)
return env.Program('#$TARGDIR/'+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.LumieraExe("#$TARGDIR/"+exeName(p), [p] + core)
buildIt = lambda p: env.Program("#$TARGDIR/"+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.LumieraExe('#$TARGDIR/vgsuppression','tool/vgsuppression.c', LIBS=core) ## for suppressing false valgrind alarms
vgsuppr = env.Program('#$TARGDIR/vgsuppression','tool/vgsuppression.c', LIBS=core) ## for suppressing false valgrind alarms
artifacts['tools'] += [vgsuppr]
Depends(ts,vgsuppr)