1
0
mirror of https://github.com/systemd/systemd.git synced 2025-06-02 17:07:47 +03:00

mkosi: Add environment variable to set the optimization level

This commit is contained in:
Daan De Meyer 2024-04-22 09:32:35 +02:00
parent d714891f05
commit 4de750ce90
4 changed files with 4 additions and 4 deletions

View File

@ -25,7 +25,7 @@ mount --mkdir --rbind "$PWD/pkg/$ID" "pkg/$ID/src/"
# on the makepkg command line so we append to /etc/makepkg.conf instead. The rootfs is overlaid with a
# writable 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 -O0 -Wp,-U_FORTIFY_SOURCE"
CFLAGS="$CFLAGS -O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE"
OPTIONS=(
docs
!libtool

View File

@ -32,7 +32,7 @@ ARCH="$(rpm --eval %_arch)"
SRCDEST="/usr/src/debug/systemd-$VERSION-${RELEASE}${DIST}.$ARCH"
# TODO: Drop -U_FORTIFY_SOURCE when we switch to CentOS Stream 10.
CFLAGS="$(rpm --define "_fortify_level 0" --undefine _lto_cflags --eval %build_cflags) -O0 -Wp,-U_FORTIFY_SOURCE"
CFLAGS="$(rpm --define "_fortify_level 0" --undefine _lto_cflags --eval %build_cflags) -O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE"
if ((WITH_DEBUG)); then
CFLAGS="$CFLAGS -ffile-prefix-map=../src=$SRCDEST"
fi

View File

@ -48,13 +48,13 @@ build() {
$( ((WITH_DEBUG)) || echo nostrip) \
terse \
optimize=-lto \
noopt \
" \
DEB_BUILD_PROFILES="\
$( ((WITH_TESTS)) || echo nocheck) \
$( ((WITH_DOCS)) || echo nodoc) \
pkg.systemd.upstream \
" \
DEB_CFLAGS_APPEND="-O${OPTIMIZATION:-0}" \
DPKG_FORCE="unsafe-io" \
DPKG_DEB_COMPRESSOR_TYPE="none" \
DH_MISSING="--fail-missing" \

View File

@ -37,7 +37,7 @@ ARCH="$(rpm --eval %_arch)"
SRCDEST="/usr/src/debug/systemd-$VERSION-${RELEASE}${DIST}.$ARCH"
# TODO: Enable this when the opensuse spec stops unconditionally setting FORTIFY_SOURCE=2.
# EXTRA_CFLAGS="-O0 -Wp,-U_FORTIFY_SOURCE"
# EXTRA_CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE"
EXTRA_CFLAGS=""
if ((WITH_DEBUG)); then
EXTRA_CFLAGS="$EXTRA_CFLAGS -ffile-prefix-map=../src=$SRCDEST"