From 8e728c14ec802059bf6b586545c4e5241b64920a Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 17 Apr 2024 14:55:08 +0200 Subject: [PATCH] mkosi: Set up -ffile-prefix-map= correctly when building debuginfo packages This makes sure that the debuginfo files contain source files pointing to the source files shipped by the debugsource package. Normally this should be done automatically by rpm invoking debugedit but for some unknown reason debugedit refuses to rewrite the source files in our binaries. Given that debugedit is completely undebugable (does not generate any logs at all, and its source code is ridiculously obtuse), let's set -ffile-prefix-map= when building instead which achieves the same effect. --- .../10-centos-fedora/mkosi.build.chroot | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot index e2d20d4b87..bb6854c38f 100755 --- a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot @@ -24,6 +24,18 @@ tee --append /usr/lib/rpm/redhat/macros <<'EOF' %{nil} EOF +VERSION="$(cat meson.version)" +RELEASE="$(date "+%Y%m%d%H%M%S" --date "@$TS")" + +DIST="$(rpm --eval %dist)" +ARCH="$(rpm --eval %_arch)" +SRCDEST="/usr/src/debug/systemd-$VERSION-${RELEASE}${DIST}.$ARCH" + +EXTRA_CFLAGS="-Og" +if ((WITH_DEBUG)); then + EXTRA_CFLAGS="$EXTRA_CFLAGS -ffile-prefix-map=../src=$SRCDEST" +fi + IFS= # TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once # https://github.com/mesonbuild/meson/pull/12835 is available. @@ -43,9 +55,9 @@ rpmbuild \ --define "_binary_payload w.ufdio" \ $( ((WITH_DEBUG)) || echo --define) \ $( ((WITH_DEBUG)) || echo "debug_package %{nil}") \ - --define "version_override $(cat meson.version)" \ - --define "release_override $(date "+%Y%m%d%H%M%S" --date "@$TS")" \ - --define "_distro_extra_cflags -Og" \ + --define "version_override $VERSION" \ + --define "release_override $RELEASE" \ + --define "_distro_extra_cflags $EXTRA_CFLAGS" \ --define "meson_build %{shrink:%{__meson} compile -C %{_vpath_builddir} -j %{_smp_build_ncpus} %{nil}}" \ --define "meson_install %{shrink:DESTDIR=%{buildroot} %{__meson} install -C %{_vpath_builddir} --no-rebuild --quiet %{nil}}" \ --define "meson_extra_configure_options -D mode=developer -D b_sanitize=${SANITIZERS:-none}" \ -- 2.25.1