[PATCH] wscript: Update install directory to include RTEMS Version

aaron.nyholm at unfoldedeffective.com aaron.nyholm at unfoldedeffective.com
Tue Feb 20 03:27:04 UTC 2024


From: Aaron N <aaron at contemporary.software>

Closes #4929
---
 config/wscript         | 2 +-
 linkers/wscript        | 2 +-
 misc/tools/boot.py     | 2 +-
 misc/wscript           | 4 ++--
 rtemstoolkit/macros.py | 3 +++
 rtemstoolkit/wscript   | 4 ++--
 tester/covoar/wscript  | 4 ++--
 tester/rt/options.py   | 2 +-
 tester/wscript         | 8 ++++----
 wscript                | 3 ++-
 10 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/config/wscript b/config/wscript
index 6ae6226..d3d77aa 100644
--- a/config/wscript
+++ b/config/wscript
@@ -39,6 +39,6 @@ def build(bld):
     # Install the configuration files.
     #
     config = bld.path.find_dir('.')
-    bld.install_files('${PREFIX}/share/rtems/config',
+    bld.install_files('${PREFIX_SHARE_RTEMS}/config',
                       config.ant_glob('**/*.ini'), cwd = config,
                       relative_trick = True)
diff --git a/linkers/wscript b/linkers/wscript
index 2d2d7f0..5d9c5cf 100644
--- a/linkers/wscript
+++ b/linkers/wscript
@@ -114,7 +114,7 @@ def build(bld):
                 cxxflags = conf['cxxflags'] + conf['warningflags'],
                 linkflags = conf['linkflags'],
                 use = modules)
-    bld.install_files('${PREFIX}/share/rtems/trace-linker',
+    bld.install_files('${PREFIX_SHARE_RTEMS}/trace-linker',
                       ['libc.ini',
                        'libc-heap.ini',
                        'rtems.ini',
diff --git a/misc/tools/boot.py b/misc/tools/boot.py
index 6e8065a..c6e40f8 100644
--- a/misc/tools/boot.py
+++ b/misc/tools/boot.py
@@ -138,7 +138,7 @@ class bootloader(object):
         if path.exists(path.join(command_path, boot_ini)):
             rtdir = command_path
         else:
-            rtdir = '%{_prefix}/share/rtems'
+            rtdir = '%{PREFIX_SHARE_RTEMS}'
         boot_ini = '%s/%s' % (rtdir, boot_ini)
         self.build = None
         self.macros = macros.macros(rtdir = rtdir, show_minimal = True)
diff --git a/misc/wscript b/misc/wscript
index 5775dcf..0e4dd1d 100644
--- a/misc/wscript
+++ b/misc/wscript
@@ -82,13 +82,13 @@ def build(bld):
                   'tools/getmac/__init__.py',
                   'tools/getmac/getmac.py'],
         install_from = '.',
-        install_path = '${PREFIX}/share/rtems/misc')
+        install_path = '${PREFIX_SHARE_RTEMS}/misc')
     bld.install_files('${PREFIX}/bin',
                       ['rtems-boot-image',
                        'rtems-tftp-proxy',
                        'tools/mkimage.py'],
                       chmod = 0o755)
-    bld.install_files('${PREFIX}/share/rtems/tools/config',
+    bld.install_files('${PREFIX_SHARE_RTEMS}/tools/config',
                       'tools/config/rtems-boot.ini')
 
 def tags(ctx):
diff --git a/rtemstoolkit/macros.py b/rtemstoolkit/macros.py
index 136f52d..fb235d9 100644
--- a/rtemstoolkit/macros.py
+++ b/rtemstoolkit/macros.py
@@ -43,6 +43,7 @@ import string
 from rtemstoolkit import error
 from rtemstoolkit import log
 from rtemstoolkit import path
+from rtemstoolkit import version
 
 #
 # Macro tables
@@ -92,6 +93,8 @@ class macros:
             self.rtpath = path.abspath(path.dirname(inspect.getfile(macros)))
             if path.dirname(self.rtpath).endswith('/share/rtems'):
                 self.prefix = path.dirname(self.rtpath)[:-len('/share/rtems')]
+            elif path.dirname(self.rtpath).endswith('/share/rtems' + version()):
+                self.prefix = path.dirname(self.rtpath)[:-len('/share/rtems' + version())]
             else:
                 self.prefix = '.'
             self.macros['global'] = {}
diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript
index d1d5127..ac3521c 100644
--- a/rtemstoolkit/wscript
+++ b/rtemstoolkit/wscript
@@ -158,8 +158,8 @@ def build(bld):
                   'version.py',
                   'windows.py'],
         install_from = '.',
-        install_path = '${PREFIX}/share/rtems/rtemstoolkit')
-    bld.install_files('${PREFIX}/share/rtems/rtemstoolkit',
+        install_path = '${PREFIX_SHARE_RTEMS}/rtemstoolkit')
+    bld.install_files('${PREFIX_SHARE_RTEMS}/rtemstoolkit',
                       'python-wrapper.sh',
                       relative_trick = True)
 
diff --git a/tester/covoar/wscript b/tester/covoar/wscript
index 8dab4d8..f5ff071 100644
--- a/tester/covoar/wscript
+++ b/tester/covoar/wscript
@@ -135,8 +135,8 @@ def build(bld):
     bld.program(target = 'covoar',
                 source = ['covoar.cc'],
                 use = ['ccovoar'] + modules,
-                install_path = '${PREFIX}/share/rtems/tester/bin',
+                install_path = '${PREFIX_SHARE_RTEMS}/tester/bin',
                 cflags = ['-O2', '-g'],
                 cxxflags = ['-std=c++11', '-O2', '-g'],
                 includes = ['.'] + rtl_includes)
-    bld.install_files('${PREFIX}/share/rtems/tester/covoar', ['covoar.css', 'table.js'])
+    bld.install_files('${PREFIX_SHARE_RTEMS}/tester/covoar', ['covoar.css', 'table.js'])
diff --git a/tester/rt/options.py b/tester/rt/options.py
index da743c1..ab920d1 100644
--- a/tester/rt/options.py
+++ b/tester/rt/options.py
@@ -93,7 +93,7 @@ def load(args, optargs = None,
     if path.exists(path.join(command_path, defaults_mc)):
         rtdir = command_path
     else:
-        rtdir = '%{_prefix}/share/rtems/tester'
+        rtdir = '%{PREFIX_SHARE_RTEMS}/tester'
     defaults = '%s/%s' % (rtdir, defaults_mc)
     #
     # The command line contains the base defaults object all build objects copy
diff --git a/tester/wscript b/tester/wscript
index 06eaccf..00107b1 100644
--- a/tester/wscript
+++ b/tester/wscript
@@ -70,13 +70,13 @@ def build(bld):
                   'rt/tftpserver.py',
                   'rt/wait.py'],
         install_from = '.',
-        install_path = '${PREFIX}/share/rtems/tester')
+        install_path = '${PREFIX_SHARE_RTEMS}/tester')
     bld(features = 'py',
         source = ['rt/pygdb/__init__.py',
                   'rt/pygdb/mi_parser.py',
                   'rt/pygdb/spark.py'],
         install_from = '.',
-        install_path = '${PREFIX}/share/rtems/tester')
+        install_path = '${PREFIX_SHARE_RTEMS}/tester')
     bld.install_files('${PREFIX}/bin',
                       ['rtems-run',
                        'rtems-test',
@@ -88,11 +88,11 @@ def build(bld):
     # Install the tester configuration files.
     #
     config = bld.path.find_dir('config')
-    bld.install_files('${PREFIX}/share/rtems/tester/config',
+    bld.install_files('${PREFIX_SHARE_RTEMS}/tester/config',
                       config.ant_glob('**/*'), cwd = config,
                       relative_trick = True)
     rtems = bld.path.find_dir('rtems')
-    bld.install_files('${PREFIX}/share/rtems/tester/rtems',
+    bld.install_files('${PREFIX_SHARE_RTEMS}/tester/rtems',
                       rtems.ant_glob('**/*'), cwd = rtems,
                       relative_trick = True)
 
diff --git a/wscript b/wscript
index 293409a..111ed30 100644
--- a/wscript
+++ b/wscript
@@ -89,6 +89,7 @@ def configure(ctx):
     except:
         pass
     ctx.env.RTEMS_VERSION, ctx.env.RTEMS_RELEASE = get_version(ctx)
+    ctx.env.PREFIX_SHARE_RTEMS = '%s/share/rtems%s' % (ctx.env.PREFIX, ctx.env.RTEMS_VERSION)
     ctx.start_msg('Version')
     ctx.end_msg('%s (%s)' % (ctx.env.RTEMS_RELEASE, ctx.env.RTEMS_VERSION))
     ctx.env.C_OPTS = ctx.options.c_opts.split(',')
@@ -113,7 +114,7 @@ def configure(ctx):
 
 def build(ctx):
     if os.path.exists('VERSION'):
-        ctx.install_files('${PREFIX}/share/rtems/rtemstoolkit', ['VERSION'])
+        ctx.install_files('${PREFIX_SHARE_RTEMS}/rtemstoolkit', ['VERSION'])
     recurse(ctx)
     if ctx.cmd == 'test':
         rtemstoolkit_tests(ctx)
-- 
2.42.0



More information about the devel mailing list