RTEMS Source Builder | Draft: rtems/config/tools: Add checks to stdcxx.py install script (!48)

Chris Johns (@chris) gitlab at rtems.org
Wed Aug 21 06:38:54 UTC 2024




Chris Johns commented on a discussion: https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/merge_requests/48#note_111368


With !49 and the following patch I can build a tool chain for `aarch64` with `--no-install` and `--bet-tar-file`. The patch is:

```diff
diff --git a/rtems/config/tools/rtems-install-stdcxx.cfg b/rtems/config/tools/rtems-install-stdcxx.cfg
index e32f1d2..3ec7f2f 100644
--- a/rtems/config/tools/rtems-install-stdcxx.cfg
+++ b/rtems/config/tools/rtems-install-stdcxx.cfg
@@ -5,12 +5,14 @@
 # Path to the location of the template script.
 %define stdcxx_template %{rtems_configdir}/stdcxx-template.py

-# Get the current GCC version of the target being built.
-%define rsb_rtems_gcc_version %(%{_bindir}/%{_target}-gcc --version | head -1 | awk '{print $3}')
-
 # Path to the target location of the script: gdb/python
-%define stdcxx_script %{_prefix}/share/gdb/python/rtems/stdcxx.py
+%define stdcxx_script_path $SB_BUILD_ROOT/%{_prefix}/share/gdb/python/rtems
+%define stdcxx_script      %{stdcxx_script_path}/stdcxx.py

 # Modify the template script and update the current GCC version
 # and place it in the target location.
-%(cat "%{stdcxx_template}" | sed "s/@RSB_GCC_VERSION@/%{rsb_rtems_gcc_version}/g" > "%{stdcxx_script}")
+%install
+  echo "Installing RTEMS stdc++ Pretty Printer support"
+  RSB_RTEMS_GCC_VERSION=$($SB_BUILD_ROOT_BINDIR/%{_target}-gcc --version | head -1 | awk '{print $3}')
+  mkdir -p %{stdcxx_script_path}
+  cat "%{stdcxx_template}" | sed "s/@RSB_GCC_VERSION@/${RSB_RTEMS_GCC_VERSION}/g" > "%{stdcxx_script}"
diff --git a/source-builder/config/gcc-common-1.cfg b/source-builder/config/gcc-common-1.cfg
index 250930a..b317eb1 100644
--- a/source-builder/config/gcc-common-1.cfg
+++ b/source-builder/config/gcc-common-1.cfg
@@ -225,10 +225,6 @@ URL:          http://gcc.gnu.org/
   %{__make} DESTDIR=$SB_BUILD_ROOT install
   cd ${build_top}

-  %if %{defined gcc_pre_install}
-    %{gcc_pre_install}
-  %endif
-  
   # libiberty doesn't honor --libdir, but always installs to a
   # magically guessed _libdir
   %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
@@ -242,6 +238,10 @@ URL:          http://gcc.gnu.org/
   # Don't want libffi's man-pages
   %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*

+  %if %{defined gcc_pre_install}
+    %{gcc_pre_install}
+  %endif
+
   # Clean the symlinks away incase the source is a repo
   # Note, delete as a directory because of MSYS2 support on Windows.
   %{__rmdir} ${source_dir_gcc}/newlib
```

The command is:

```
../source-builder/sb-set-builder --prefix=/bad/bad --no-install --bset-tar-file --log=ni-aa.txt --trace --no-clean 6/rtems-aarch64
```

Checking the tar file shows the install Python file:

```
 $ tar ztvf tar/rtems-aarch64.tar.bz2 | grep stdcxx.py
-rw-r--r--  0 chris  chris      1420 Aug 21 16:08 bad/bad/share/gdb/python/rtems/stdcxx.py
```

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/merge_requests/48#note_111368
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240821/0be84a9d/attachment-0001.htm>


More information about the bugs mailing list