From 5a5168b145284d0871b3ee61c8b50bfb68354135 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 19 Nov 2025 22:40:08 +0100 Subject: [PATCH] Build: fix problem that prevented installation into absolute path ...funny enough I never noticed this obvious mistake, since I never install software directly into my system, while the DEB-build does not use absolute paths... Solution: * SCons has this speical convention that a path prefixed with '#' is resolved relative to the root of the build (where the SConstruct resides) * now we apply this automatically to the two relevant settings ** INSTALLDIR ** TARGDIR * but only (conditionally) if the configured path is relative, not absolute As a consequence, most other hard-coded usages of the '#'-prefix can then be dropped --- admin/scons/LumieraEnvironment.py | 36 ++++++--- admin/scons/Setup.py | 26 +++---- src/SConscript | 2 +- tests/SConscript | 4 +- wiki/thinkPad.ichthyo.mm | 117 +++++++++++++++++++----------- 5 files changed, 117 insertions(+), 68 deletions(-) diff --git a/admin/scons/LumieraEnvironment.py b/admin/scons/LumieraEnvironment.py index 11dc15b5a..e85dbee62 100644 --- a/admin/scons/LumieraEnvironment.py +++ b/admin/scons/LumieraEnvironment.py @@ -29,14 +29,17 @@ class LumieraEnvironment(Environment): using global vars. Idea inspired by Ardour. """ def __init__(self, buildSetup, buildVars, **kw): - kw.update(VERSION = buildSetup.VERSION - ,TARGDIR = buildSetup.TARGDIR - ,DESTDIR = '$INSTALLDIR/$PREFIX' - ,toolpath = [buildSetup.TOOLDIR ] - ,variables = buildVars - ) - Environment.__init__ (self, **kw) - self.path = Record (extract_localPathDefs(buildSetup)) # e.g. buildExe -> env.path.buildExe + Environment.__init__ (self, toolpath = [buildSetup.TOOLDIR ] + , variables = buildVars # ◁───── reads settings from the commandline (see Options.py) + , **kw) + # + self['TARGDIR'] = buildSetup.TARGDIR + self['VERSION'] = buildSetup.VERSION + self['DESTDIR'] = '$INSTALLDIR/$PREFIX' + self._anchor_relative('INSTALLDIR') + self._anchor_relative('TARGDIR') + # + self.path = Record (extract_localPathDefs(buildSetup)) # ◁───── e.g. buildExe -> env.path.buildExe self.libInfo = {} self.Tool("BuilderDoxygen") self.Tool("ToolDistCC") @@ -44,6 +47,16 @@ class LumieraEnvironment(Environment): register_LumieraResourceBuilder(self) register_LumieraCustomBuilders(self) + def _anchor_relative(self, key): + """ ensure that a relative path spec becomes anchored at build-root + @note: a special convention within scons: '#' implies directory of SConstruct + """ + spec = self[key].strip() + if not (spec.startswith('/') or spec.startswith('#')): + spec = '#'+spec + self[key] = spec + + def Configure (self, *args, **kw): kw['env'] = self @@ -120,12 +133,13 @@ def register_LumieraResourceBuilder(env): """ import IconSvgRenderer as renderer # load Joel's python script for invoking the rsvg-convert (SVG render) - renderer.rsvgPath = env.subst("$TARGDIR/rsvg-convert") + renderer.rsvgPath = env.subst("$TARGDIR/rsvg-convert").removeprefix('#') + # # the prefix '#' is a SCons specific convention, + # # which the external tool can not handle def invokeRenderer(target, source, env): source = str(source[0]) - targetdir = env.subst(env.path.buildIcon) - if targetdir.startswith('#'): targetdir = targetdir[1:] + targetdir = env.subst(env.path.buildIcon).removeprefix('#') renderer.main([source,targetdir]) return 0 diff --git a/admin/scons/Setup.py b/admin/scons/Setup.py index af2cfae53..ba15e32d7 100644 --- a/admin/scons/Setup.py +++ b/admin/scons/Setup.py @@ -28,19 +28,19 @@ OPTCACHE = 'optcache' CUSTOPTFILE = 'custom-options' # these are accessible via env.path.xxxx -buildExe = '#$TARGDIR' -buildLib = '#$TARGDIR/modules' -buildPlug = '#$TARGDIR/modules' -buildIcon = '#$TARGDIR/gui/icons' # for IconResource() and IconRender() -buildUIRes = '#$TARGDIR/gui/' # for GuiResource() -buildConf = '#$TARGDIR/config' # for ConfigData() -installExe = '#$DESTDIR/lib/lumiera' -installLib = '#$DESTDIR/lib/lumiera/modules' -installPlug = '#$DESTDIR/lib/lumiera/modules' -installIcon = '#$DESTDIR/share/lumiera/icons' -installUIRes = '#$DESTDIR/share/lumiera/' -installConf = '#$DESTDIR/lib/lumiera/config' -installDoc = '#$DESTDIR/share/doc/lumiera/' +buildExe = '$TARGDIR' +buildLib = '$TARGDIR/modules' +buildPlug = '$TARGDIR/modules' +buildIcon = '$TARGDIR/gui/icons' # for IconResource() and IconRender() +buildUIRes = '$TARGDIR/gui/' # for GuiResource() +buildConf = '$TARGDIR/config' # for ConfigData() +installExe = '$DESTDIR/lib/lumiera' +installLib = '$DESTDIR/lib/lumiera/modules' +installPlug = '$DESTDIR/lib/lumiera/modules' +installIcon = '$DESTDIR/share/lumiera/icons' +installUIRes = '$DESTDIR/share/lumiera/' +installConf = '$DESTDIR/lib/lumiera/config' +installDoc = '$DESTDIR/share/doc/lumiera/' #-------------------------------------------------------Configuration diff --git a/src/SConscript b/src/SConscript index 284569b7b..018937615 100644 --- a/src/SConscript +++ b/src/SConscript @@ -29,7 +29,7 @@ lumiera = ( env.Program('lumiera', ['lumiera/main.cpp'] + core, install=True) # Install the lumiera application: # symlink the executable into the bin dir -env.SymLink('#$DESTDIR/bin/lumiera',env.path.installExe+'lumiera','../lib/lumiera/lumiera') +env.SymLink('$DESTDIR/bin/lumiera',env.path.installExe+'lumiera','../lib/lumiera/lumiera') # building Lumiera Plugins diff --git a/tests/SConscript b/tests/SConscript index 4fb38d9e7..c233bf178 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -130,10 +130,10 @@ propagateSetting(testEnv, 'TESTMODE') propagateSetting(testEnv, 'LUMIERA_PLUGIN_PATH') propagateSetting(testEnv, 'HOME') -testDir = env.Dir('#$TARGDIR') +testDir = env.Dir('$TARGDIR') runTest = env.File("test.sh").abspath -runTests = testEnv.Command('#$TARGDIR/,testlog', testsuite, runTest, chdir=testDir) +runTests = testEnv.Command('$TARGDIR/,testlog', testsuite, runTest, chdir=testDir) Depends(runTests,vgsuppression) diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index a63370e0a..7abeb096c 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -171393,7 +171393,7 @@ Since then others have made contributions, see the log for the history. - + @@ -177762,9 +177762,9 @@ Since then others have made contributions, see the log for the history. - - - + + + @@ -177789,11 +177789,14 @@ Since then others have made contributions, see the log for the history. - + + - + + + @@ -177807,12 +177810,52 @@ Since then others have made contributions, see the log for the history. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ Effektiv ist das '#'-Präfix jetzt in $INSTALLDIR und $TARGDIR hineingewandert. Das ist aber eine SCons-spezifische Konvention, mit der der Icon-Renderer natürlich nix anfangen kann +

+ +
+ + +
@@ -180105,8 +180148,7 @@ Since then others have made contributions, see the log for the history.unbedingt per Diff/Merge  aktualisieren vom Website-Content!

- -
+
@@ -180172,8 +180214,7 @@ Since then others have made contributions, see the log for the history. - - +
@@ -180325,8 +180366,7 @@ Since then others have made contributions, see the log for the history.und außerdem  auch über alle Compiler-Schalter und Environment-Settings

- - +
@@ -180348,8 +180388,7 @@ Since then others have made contributions, see the log for the history. *** Directory path for variable 'INSTALLDIR' does not exist: debian/lumiera

- - + @@ -180362,8 +180401,7 @@ Since then others have made contributions, see the log for the history. - - + @@ -180529,8 +180567,7 @@ Since then others have made contributions, see the log for the history. - - + @@ -180545,8 +180582,8 @@ Since then others have made contributions, see the log for the history. - - + + @@ -180583,8 +180620,7 @@ Since then others have made contributions, see the log for the history. - - + @@ -180619,9 +180655,9 @@ Since then others have made contributions, see the log for the history. - + - + @@ -180664,14 +180700,14 @@ Since then others have made contributions, see the log for the history. - - - + + + - + - + @@ -180691,7 +180727,8 @@ Since then others have made contributions, see the log for the history. - + + @@ -180719,7 +180756,7 @@ Since then others have made contributions, see the log for the history. - + @@ -180728,8 +180765,9 @@ Since then others have made contributions, see the log for the history. + - + @@ -180801,8 +180839,7 @@ Since then others have made contributions, see the log for the history.außer mir  das SCons mag und pflegt. Also geht es höchstens darum, nach bestehendem Schema die eine oder andere Datei hinzuzufügen. Überdies frage ich mich, wie lange wir bei SCons bleiben können (hoffentlich noch lange, und hoffentlich darf dann nicht ich einen Ersatz programmieren, oder mich mit CMake herumärgern, das bei Weitem nicht so deklarativ ist

- - +
@@ -180818,8 +180855,7 @@ Since then others have made contributions, see the log for the history.Das ist es mir dann doch nicht wert!

- - + @@ -180834,11 +180870,10 @@ Since then others have made contributions, see the log for the history.Installationsziel: <prefix>/share/doc/lumiera/manual-html/index.html

- - +
- - + +