From 05dccd9a341d587030a2f1d305d81cb76941990a Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 2 Jul 2024 17:06:02 -0700 Subject: [PATCH] Bundle libunwind as part of Sysprof This builds libunwind-generic.a and links against it from the various Sysprof tracers instead of relying on a system installed libunwind. Resolves: RHEL-44892 --- .gitignore | 1 + sources | 1 + sysprof.spec | 59 +++++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1bcbe91..b666a7a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /sysprof-*.tar.xz +/libunwind-1.8.1.tar.gz diff --git a/sources b/sources index 73fcb46..5e74d02 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (sysprof-46.0.tar.xz) = f04d887218257d177f7bc68485bcc47c310188335530ff9bf5e3efa7c383d56e97d5d969b2e8b5b0469993456aa734873c599f3d743615716305b8c7f113f534 +SHA512 (libunwind-1.8.1.tar.gz) = aba7b578c1b8cbe78f05b64e154f3530525f8a34668b2a9f1ee6acb4b22c857befe34ad4e9e8cca99dbb66689d41bc72060a8f191bd8be232725d342809431b3 diff --git a/sysprof.spec b/sysprof.spec index e932805..7fe79e7 100644 --- a/sysprof.spec +++ b/sysprof.spec @@ -1,15 +1,23 @@ %global glib2_version 2.76.0 - %global tarball_version %%(echo %{version} | tr '~' '.') +%global bundled_libunwind 1 + +%if 0%{?bundled_libunwind} +%global libunwind_version 1.8.1 +%global _legacy_common_support 1 +%endif Name: sysprof Version: 46.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A system-wide Linux profiler License: GPL-2.0-or-later AND GPL-3.0-or-later AND CC-BY-SA-4.0 AND BSD-2-Clause-Patent URL: http://www.sysprof.com Source0: https://download.gnome.org/sources/sysprof/46/sysprof-%{tarball_version}.tar.xz +%if 0%{?bundled_libunwind} +Source1: https://github.com/libunwind/libunwind/releases/download/v%{libunwind_version}/libunwind-%{libunwind_version}.tar.gz +%endif BuildRequires: gcc BuildRequires: gcc-c++ @@ -26,12 +34,17 @@ BuildRequires: pkgconfig(libadwaita-1) BuildRequires: pkgconfig(libdex-1) BuildRequires: pkgconfig(libpanel-1) BuildRequires: pkgconfig(libsystemd) -BuildRequires: pkgconfig(libunwind-generic) BuildRequires: pkgconfig(polkit-gobject-1) BuildRequires: pkgconfig(systemd) BuildRequires: /usr/bin/appstream-util BuildRequires: /usr/bin/desktop-file-validate +%if 0%{?bundled_libunwind} +BuildRequires: automake libtool autoconf make +%else +BuildRequires: pkgconfig(libunwind-generic) +%endif + Requires: glib2%{?_isa} >= %{glib2_version} Requires: hicolor-icon-theme Requires: %{name}-cli%{?_isa} = %{version}-%{release} @@ -65,6 +78,9 @@ The %{name}-cli package contains the sysprof-cli command line utility. Summary: Sysprof libraries # Subpackage removed/obsoleted in F39 Obsoletes: libsysprof-ui < 45.0 +%if 0%{?bundled_libunwind} +Provides: bundled(libunwind) = %{libunwind_version} +%endif %description -n libsysprof The libsysprof package contains the Sysprof libraries. @@ -90,17 +106,47 @@ developing applications that use %{name}. %prep -%autosetup -p1 -n sysprof-%{tarball_version} +%if 0%{?bundled_libunwind} +%setup -b 1 -n libunwind-%{libunwind_version} +%endif +%setup -n sysprof-%{tarball_version} %build -%meson +%if 0%{?bundled_libunwind} +# First build private libunwind +%global libunwind_install_dir %{buildroot}%{_builddir}/libunwind +pushd ../libunwind-%{libunwind_version} +mkdir -p %{_builddir}/libunwind/ +aclocal +libtoolize --force +autoheader +automake --add-missing +autoconf +%configure --enable-static --disable-shared --enable-setjmp=no --disable-debug --disable-documentation --disable-ptrace --disable-coredump --disable-minidebuginfo --disable-zlibdebuginfo --with-pic +make %{?_smp_mflags} install DESTDIR=%{libunwind_install_dir} +popd +# Our "/usr" install to DESTDIR wont get picked up by the +# pkgconfig use in meson so ensure access to those include +# and linker directories manually. +export CFLAGS="$CFLAGS -I%{libunwind_install_dir}/usr/include" +export LDFLAGS="$LDFLAGS -L%{libunwind_install_dir}/usr/%{_lib}" +%global pkg_config_path_override --pkg-config-path %{libunwind_install_dir}/usr/%{_lib}/pkgconfig +%endif + +# Now build sysprof +%meson %{?pkg_config_path_override} %meson_build %install %meson_install %find_lang %{name} --with-gnome +%if 0%{?bundled_libunwind} +# Appease checks which would include buildroot paths for the +# libunwind-generic.a linked in. +strip -s %{buildroot}/usr/%{_lib}/libsysprof-*.so +%endif %check @@ -166,6 +212,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %changelog +* Tue Jul 02 2024 Christian Hergert - 46.0-3 +- Use static libunwind for Sysprof tracers + * Mon Jun 24 2024 Troy Dawson - 46.0-2 - Bump release for June 2024 mass rebuild