From 6f02a9fd338074aa20b69dd9add196af2170172c Mon Sep 17 00:00:00 2001 From: Nan Liu Date: Fri, 14 Aug 2026 22:37:48 +0000 Subject: [PATCH] feat(gcc): add libbacktrace-static subpackage Expose GCC's internal libbacktrace static library (libbacktrace.a) and its header (backtrace.h) as a new libbacktrace-static subpackage --- .../0002-libbacktrace-static.overlay.toml | 67 +++++++++++++++++++ locks/gcc.lock | 2 +- specs/g/gcc/gcc.spec | 21 +++++- 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 base/comps/gcc/overlays/0002-libbacktrace-static.overlay.toml diff --git a/base/comps/gcc/overlays/0002-libbacktrace-static.overlay.toml b/base/comps/gcc/overlays/0002-libbacktrace-static.overlay.toml new file mode 100644 index 00000000000..b380fa49072 --- /dev/null +++ b/base/comps/gcc/overlays/0002-libbacktrace-static.overlay.toml @@ -0,0 +1,67 @@ +# Azure Linux exposes GCC's internal libbacktrace as a standalone +# `libbacktrace-static` subpackage. There is no upstream package to +# import. Downstream consumers need the static library + header +# at build time, so we install them here. + +[metadata] +category = "azl-platform-adaptation" +upstream-status = "inapplicable" + +# Bump the manual gcc release so the new subpackage and its dependents rebuild. +[[overlays]] +description = "Bump gcc release for the added libbacktrace-static subpackage" +type = "spec-search-replace" +regex = '^%global gcc_release 7$' +replacement = "%global gcc_release 8" + +# Declare the new subpackage right after the C++ package/description block. +[[overlays]] +description = "Declare the libbacktrace-static subpackage" +type = "spec-append-lines" +section = "%description" +package = "c++" +lines = [ + "%package -n libbacktrace-static", + "Summary: Static library for GCC's libbacktrace", + "", + "%description -n libbacktrace-static", + "This package contains GCC's static libbacktrace library and its header.", + "", +] + +# Install the internal libbacktrace static archive and its header. +[[overlays]] +description = "Install libbacktrace static library and header into the buildroot" +type = "spec-append-lines" +section = "%install" +lines = [ + "# Azure Linux: expose GCC's internal libbacktrace as a static library + header.", + "_azl_bt=%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/libbacktrace/.libs/libbacktrace.a", + "install -m 0644 -D \"$_azl_bt\" %{buildroot}%{_libdir}/libbacktrace.a", + "install -m 0644 -D %{_builddir}/gcc-%{version}-%{DATE}/libbacktrace/backtrace.h %{buildroot}%{_includedir}/backtrace.h", + "", +] + +# List the installed libbacktrace-static files. +[[overlays]] +description = "Package the libbacktrace-static files" +type = "spec-append-lines" +section = "%files" +package = "c++" +lines = [ + "%files -n libbacktrace-static", + "%{_includedir}/backtrace.h", + "%{_libdir}/libbacktrace.a", + "", +] + +[[overlays]] +description = "Add changelog entry for the libbacktrace-static subpackage" +type = "spec-prepend-lines" +section = "%changelog" +lines = [ + "* Fri Aug 14 2026 Nan Liu - 15.2.1-8", + "- Add libbacktrace-static subpackage exposing GCC's internal libbacktrace", + " static library and header for downstream consumers.", + "", +] diff --git a/locks/gcc.lock b/locks/gcc.lock index 14d19842f85..e0cb1d493d5 100644 --- a/locks/gcc.lock +++ b/locks/gcc.lock @@ -2,5 +2,5 @@ version = 1 import-commit = 'fef47e540ee170873511546e35fc912cceed23f1' upstream-commit = 'fef47e540ee170873511546e35fc912cceed23f1' -input-fingerprint = 'sha256:9cba33f3d0d76e1ebc779c654cb919773192af830efc66a9bc45454c89b42071' +input-fingerprint = 'sha256:f7bfc24cb117570fda996fc1a6963305202fc45b15c114a7984cca4be7957394' resolution-input-hash = 'sha256:466421704711c4fd3c71f0b2ed715a0e61d49e3e26f3a2637fee755795849c8e' diff --git a/specs/g/gcc/gcc.spec b/specs/g/gcc/gcc.spec index b0db8dd6342..52613494c0c 100644 --- a/specs/g/gcc/gcc.spec +++ b/specs/g/gcc/gcc.spec @@ -7,7 +7,7 @@ %global gcc_major 15 # Note, gcc_release must be integer, if you want to add suffixes to # %%{release}, append them after %%{gcc_release} on Release: line. -%global gcc_release 7 +%global gcc_release 8 %global nvptx_tools_gitrev a0c1fff6534a4df9fb17937c3c4a4b1071212029 %global newlib_cygwin_gitrev d35cc82b5ec15bb8a5fe0fe11e183d1887992e99 %global _unpackaged_files_terminate_build 0 @@ -402,6 +402,12 @@ This package adds C++ support to the GNU Compiler Collection. It includes support for most of the current C++ specification, including templates and exception handling. +%package -n libbacktrace-static +Summary: Static library for GCC's libbacktrace + +%description -n libbacktrace-static +This package contains GCC's static libbacktrace library and its header. + %package -n libstdc++ Summary: GNU Standard C++ Library Autoreq: true @@ -2473,6 +2479,11 @@ ln -sf gcc-annobin.so.0.0.0 $FULLPATH/plugin/gcc-annobin.so.0 ln -sf gcc-annobin.so.0.0.0 $FULLPATH/plugin/gcc-annobin.so %endif +# Azure Linux: expose GCC's internal libbacktrace as a static library + header. +_azl_bt=%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/libbacktrace/.libs/libbacktrace.a +install -m 0644 -D "$_azl_bt" %{buildroot}%{_libdir}/libbacktrace.a +install -m 0644 -D %{_builddir}/gcc-%{version}-%{DATE}/libbacktrace/backtrace.h %{buildroot}%{_includedir}/backtrace.h + %check cd obj-%{gcc_target_platform} @@ -3032,6 +3043,10 @@ end %endif %doc rpm.doc/changelogs/gcc/cp/ChangeLog* +%files -n libbacktrace-static +%{_includedir}/backtrace.h +%{_libdir}/libbacktrace.a + %files -n libstdc++ %{_prefix}/%{_lib}/libstdc++.so.6* %dir %{_datadir}/gdb @@ -3814,6 +3829,10 @@ end %endif %changelog +* Fri Aug 14 2026 Nan Liu - 15.2.1-8 +- Add libbacktrace-static subpackage exposing GCC's internal libbacktrace + static library and header for downstream consumers. + * Fri Jan 23 2026 Jakub Jelinek 15.2.1-7 - update from releases/gcc-15 branch - PRs c++/122070, c++/122550, c++/123597, libstdc++/123147,