mirror of
https://github.com/systemd/systemd.git
synced 2025-03-09 12:58:26 +03:00
mkosi: Add support for building debug packages
This allows building debug packages by setting WITH_DEBUG=1. This slows down the build a lot so it's opt in. We don't yet install these but can do so in a future commit.
This commit is contained in:
parent
f1884281a0
commit
4980ae0fbc
@ -26,7 +26,17 @@ mount --mkdir --rbind "$PWD/pkg/$ID" "pkg/$ID/src/"
|
||||
# tmpfs during the build script so these changes don't end up in the image itself.
|
||||
tee --append /etc/makepkg.conf >/dev/null <<EOF
|
||||
CFLAGS="$CFLAGS -Og"
|
||||
OPTIONS=(!strip docs !libtool !staticlibs emptydirs !zipman purge !debug !lto)
|
||||
OPTIONS=(
|
||||
docs
|
||||
!libtool
|
||||
!staticlibs
|
||||
emptydirs
|
||||
!zipman
|
||||
purge
|
||||
$( ((WITH_DEBUG)) && echo strip || echo !strip)
|
||||
$( ((WITH_DEBUG)) && echo debug || echo !debug)
|
||||
!lto
|
||||
)
|
||||
EOF
|
||||
|
||||
# Linting the PKGBUILD takes multiple seconds every build so avoid that by nuking all the linting functions.
|
||||
|
@ -16,6 +16,15 @@ else
|
||||
TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
|
||||
fi
|
||||
|
||||
# Fix the %install override so debuginfo packages are generated even when --build-in-place is used.
|
||||
# See https://github.com/rpm-software-management/rpm/issues/3042.
|
||||
tee --append /usr/lib/rpm/redhat/macros <<'EOF'
|
||||
%install %{?_enable_debug_packages:%{debug_package}}\
|
||||
%%install\
|
||||
%{nil}
|
||||
EOF
|
||||
|
||||
IFS=
|
||||
# TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once
|
||||
# https://github.com/mesonbuild/meson/pull/12835 is available.
|
||||
# shellcheck disable=SC2046
|
||||
@ -32,14 +41,16 @@ rpmbuild \
|
||||
${BUILDDIR:+"_vpath_builddir $BUILDDIR"} \
|
||||
--define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
|
||||
--define "_binary_payload w.ufdio" \
|
||||
--define "debug_package %{nil}" \
|
||||
$( ((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 "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}" \
|
||||
--define "__brp_strip %{nil}" \
|
||||
$( ((WITH_DEBUG)) || echo --define) \
|
||||
$( ((WITH_DEBUG)) || echo "__brp_strip %{nil}") \
|
||||
--define "__brp_compress %{nil}" \
|
||||
--define "__brp_mangle_shebangs %{nil}" \
|
||||
--define "__brp_strip_comment_note %{nil}" \
|
||||
|
@ -42,8 +42,18 @@ cat debian/changelog >>debian/changelog.new
|
||||
mv debian/changelog.new debian/changelog
|
||||
|
||||
build() {
|
||||
DEB_BUILD_OPTIONS="$( ((WITH_TESTS)) || echo nocheck) $( ((WITH_DOCS)) || echo nodoc) nostrip terse optimize=-lto" \
|
||||
DEB_BUILD_PROFILES="$( ((WITH_TESTS)) || echo nocheck) $( ((WITH_DOCS)) || echo nodoc) pkg.systemd.upstream" \
|
||||
DEB_BUILD_OPTIONS="\
|
||||
$( ((WITH_TESTS)) || echo nocheck) \
|
||||
$( ((WITH_DOCS)) || echo nodoc) \
|
||||
$( ((WITH_DEBUG)) || echo nostrip) \
|
||||
terse
|
||||
optimize=-lto \
|
||||
" \
|
||||
DEB_BUILD_PROFILES="\
|
||||
$( ((WITH_TESTS)) || echo nocheck) \
|
||||
$( ((WITH_DOCS)) || echo nodoc) \
|
||||
pkg.systemd.upstream \
|
||||
" \
|
||||
DEB_CFLAGS_APPEND="-Og" \
|
||||
DPKG_FORCE="unsafe-io" \
|
||||
DPKG_DEB_COMPRESSOR_TYPE="none" \
|
||||
|
@ -22,7 +22,15 @@ fi
|
||||
# extension.
|
||||
find "pkg/$ID" -name "files.*" -exec sed --in-place 's/\.gz$//' {} \;
|
||||
|
||||
# Fix the %install override so debuginfo packages are generated.
|
||||
tee --append /usr/lib/rpm/suse/macros <<'EOF'
|
||||
%install %{debug_package}\
|
||||
%%install\
|
||||
%{nil}
|
||||
EOF
|
||||
|
||||
build() {
|
||||
IFS=
|
||||
# TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once
|
||||
# https://github.com/mesonbuild/meson/pull/12835 is available.
|
||||
# shellcheck disable=SC2046
|
||||
@ -38,7 +46,8 @@ build() {
|
||||
${BUILDDIR:+"_vpath_builddir $BUILDDIR"} \
|
||||
--define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
|
||||
--define "_binary_payload w.ufdio" \
|
||||
--define "debug_package %{nil}" \
|
||||
$( ((WITH_DEBUG)) || echo --define) \
|
||||
$( ((WITH_DEBUG)) || echo "debug_package %{nil}") \
|
||||
--define "vendor openSUSE" \
|
||||
--define "version_override $(cat meson.version)" \
|
||||
--define "release_override $(date "+%Y%m%d%H%M%S" --date "@$TS")" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user