From bc22ec7faaf0d30c08a9470cafb4b1a1182e4a1a Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 29 Jan 2011 16:45:22 +0100 Subject: [PATCH] Install: first preliminary working installation setup the installed lumiera exe can even be started... ...well with a bit of cheating: you need to cd into the lib/lumiera because the PLUGINPATH problem isn't solved yet --- SConstruct | 32 +++++++++++++------ admin/scons/Buildhelper.py | 8 ++--- admin/scons/LumieraEnvironment.py | 52 ++++++++++++++++++++++++++----- data/config/dummy_lumiera.ini | 4 +++ 4 files changed, 75 insertions(+), 21 deletions(-) create mode 100644 data/config/dummy_lumiera.ini diff --git a/SConstruct b/SConstruct index b2e9d803a..3ae0c4fcb 100644 --- a/SConstruct +++ b/SConstruct @@ -336,9 +336,9 @@ def defineBuildTargets(env, artifacts): core = lLib+lApp+lBack+lProc - artifacts['lumiera'] = env.LumieraExe('$TARDIR/lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core) - artifacts['corelib'] = lLib+lApp + artifacts['corelib'] = core artifacts['support'] = lLib + artifacts['lumiera'] = env.LumieraExe('$TARDIR/lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core) # building Lumiera Plugins envPlu = env.Clone() @@ -351,6 +351,7 @@ def defineBuildTargets(env, artifacts): artifacts['icons'] = ( [env.IconRender(f) for f in scanSubtree(vector_icon_dir, ['*.svg'])] + [env.IconCopy(f) for f in scanSubtree(prerendered_icon_dir, ['*.png'])] ) + ##TODO make that into a resource builder # the Lumiera GTK GUI envGtk = env.Clone() @@ -363,6 +364,7 @@ def defineBuildTargets(env, artifacts): + env.Install('$TARDIR', env.Glob('$SRCDIR/gui/*.rc')) + artifacts['icons'] ) + artifacts['guimodule'] = guimodule ###TODO better organisation of GUI components # call subdir SConscript(s) for independent components SConscript(dirs=[SRCDIR+'/tool'], exports='env artifacts core') @@ -376,10 +378,10 @@ def definePostBuildTargets(env, artifacts): """ ib = env.Alias('install-bin', '$DESTDIR/bin') il = env.Alias('install-lib', '$DESTDIR/lib') - env.Alias('install', [ib, il]) + id = env.Alias('install-dat', '$DESTDIR/share') + env.Alias('install', [ib, il, id]) build = env.Alias('build', artifacts['lumiera']+artifacts['gui']+artifacts['plugins']+artifacts['tools']) - allbu = env.Alias('allbuild', build+artifacts['testsuite']) env.Default('build') # additional files to be cleaned when cleaning 'build' env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log' ]) @@ -388,17 +390,27 @@ def definePostBuildTargets(env, artifacts): doxydoc = artifacts['doxydoc'] = env.Doxygen('doc/devel/Doxyfile') env.Alias ('doc', doxydoc) env.Clean ('doc', doxydoc + ['doc/devel/,doxylog','doc/devel/warnings.txt']) + + allbu = env.Alias('allbuild', build+artifacts['testsuite']+doxydoc) def defineInstallTargets(env, artifacts): - """ define some artifacts to be installed into target locations. + """ define artifacts to be installed into target locations. """ - env.Install(dir = '$DESTDIR/bin', source=artifacts['lumiera']) - env.Install(dir = '$DESTDIR/lib', source=artifacts['corelib']) - env.Install(dir = '$DESTDIR/lib', source=artifacts['plugins']) - env.Install(dir = '$DESTDIR/bin', source=artifacts['tools']) + binDir = '$DESTDIR/bin/' + lumDir = '$DESTDIR/lib/lumiera/' + modDir = '$DESTDIR/lib/lumiera/$MODULES/' + shaDir = '$DESTDIR/share/lumiera/' + env.Install(dir = modDir, source=artifacts['corelib']) + env.Install(dir = modDir, source=artifacts['plugins']) + env.Install(dir = modDir, source=artifacts['guimodule']) + lumi = env.Install(dir = lumDir, source=artifacts['lumiera']) + tool = env.Install(dir = lumDir, source=artifacts['tools']) + print "Aufruf LINK DESTDIR=" + env.get('DESTDIR') + env.SymLink(binDir+"lumiera",lumi,"../lib/lumiera/lumiera") - env.Install(dir = '$DESTDIR/share/doc/lumiera$VERSION/devel', source=artifacts['doxydoc']) + env.Install(dir = shaDir, source="data/config/dummy_lumiera.ini") ### TODO should become a resource builder +# env.Install(dir = '$DESTDIR/share/doc/lumiera$VERSION/devel', source=artifacts['doxydoc']) ##################################################################### diff --git a/admin/scons/Buildhelper.py b/admin/scons/Buildhelper.py index 2fef49cf3..8e7356271 100644 --- a/admin/scons/Buildhelper.py +++ b/admin/scons/Buildhelper.py @@ -151,10 +151,10 @@ def createPlugins(env, dir): """ investigate the given source directory to identify all contained source trees. @return: a list of build nodes defining a plugin for each of these source trees. """ - return [env.LoadableModule( '#$TARDIR/$MODULES/%s' % getDirname(tree) - , srcSubtree(env, tree) - , SHLIBPREFIX='', SHLIBSUFFIX='.lum' - ) + return [env.LumieraPlugin( '#$TARDIR/$MODULES/%s' % getDirname(tree) + , srcSubtree(env, tree) + , SHLIBPREFIX='', SHLIBSUFFIX='.lum' + ) for tree in findSrcTrees(dir) ] diff --git a/admin/scons/LumieraEnvironment.py b/admin/scons/LumieraEnvironment.py index 3a08695f9..b9a018c08 100644 --- a/admin/scons/LumieraEnvironment.py +++ b/admin/scons/LumieraEnvironment.py @@ -22,12 +22,14 @@ ##################################################################### +import os +from os import path + import SCons import SCons.SConf from SCons.Environment import Environment from Buildhelper import * -from os import path @@ -82,10 +84,29 @@ class LumieraEnvironment(Environment): return libInfo - 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 + def SymLink(self, target, source, linktext=None): + """ use python to create a symlink + """ + def makeLink(target,source,env): + if linktext: + dest = linktext + else: + dest = str(source[0]) + link = str(target[0]) + os.symlink(dest, link) + def reportLink(target,source,env): + dest = str(source[0]) + link = str(target[0]) + return "Install link %s -> %s" % (link,dest) + + 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 @@ -102,15 +123,32 @@ class LumieraEnvironment(Environment): 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="+soname ) + 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, diff --git a/data/config/dummy_lumiera.ini b/data/config/dummy_lumiera.ini new file mode 100644 index 000000000..cfe91da1e --- /dev/null +++ b/data/config/dummy_lumiera.ini @@ -0,0 +1,4 @@ +/* This is an dummy Lumiera config file + * + * Actually Lumiera can't yet load any config, as of 1/2011 + */