From b7865c2408fa1960f416213ab22783a0bcf3171a Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 3 Jun 2024 09:31:26 +0200 Subject: [PATCH 01/12] meson: Pass -Wno-deprecated-declarations when detecting libcryptsetup functions Otherwise we fail to detect crypt_reencrypt() if -Werror is used. --- meson.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meson.build b/meson.build index b0b8697d50..ea4e12aa1c 100644 --- a/meson.build +++ b/meson.build @@ -1268,6 +1268,9 @@ foreach ident : ['crypt_set_metadata_size', have_ident = have and cc.has_function( ident, prefix : '#include ', + # crypt_reencrypt() raises a deprecation warning so make sure -Wno-deprecated-declarations is + # specified otherwise we fail to detect crypt_reencrypt() if -Werror is used. + args : '-Wno-deprecated-declarations', dependencies : libcryptsetup) conf.set10('HAVE_' + ident.to_upper(), have_ident) endforeach From 6a88774c96bff269c58defc06803d48a3a78a3a2 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 2 Jun 2024 17:07:53 +0200 Subject: [PATCH 02/12] mkosi: Use env where appropriate --- .../mkosi.conf.d/10-centos-fedora/mkosi.build.chroot | 4 +++- .../mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot | 11 ++++++----- 2 files changed, 9 insertions(+), 6 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 f3981c99a4..9895f23908 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 @@ -47,7 +47,9 @@ 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 -ANNOBIN="no-active-checks" rpmbuild \ +env \ +ANNOBIN="no-active-checks" \ +rpmbuild \ -bb \ --build-in-place \ --with upstream \ diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot index 8819b46eaf..023cfdf632 100755 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot @@ -45,25 +45,26 @@ cat debian/changelog >>debian/changelog.new mv debian/changelog.new debian/changelog build() { - DEB_BUILD_OPTIONS=$(awk '$1=$1' <<<"\ + env \ + DEB_BUILD_OPTIONS="$(awk '$1=$1' <<<"\ $( ((WITH_TESTS)) || echo nocheck) \ $( ((WITH_DOCS)) || echo nodoc) \ $( ((WITH_DEBUG)) && echo debug || echo nostrip) \ terse \ optimize=-lto \ hardening=-fortify \ - ") \ - DEB_BUILD_PROFILES=$(awk '$1=$1' <<<"\ + ")" \ + DEB_BUILD_PROFILES="$(awk '$1=$1' <<<"\ $( ((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" \ CONFFLAGS_UPSTREAM="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" \ - dpkg-buildpackage \ + dpkg-buildpackage \ --no-pre-clean \ --unsigned-changes \ --build=binary From 9d25dc0d86b743d9315c8bec5056712f5d4dfe63 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 2 Jun 2024 17:54:41 +0200 Subject: [PATCH 03/12] mkosi: Disable iscsiuio.socket as well --- .../mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset | 1 + 1 file changed, 1 insertion(+) diff --git a/mkosi.images/system/mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset b/mkosi.images/system/mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset index 0f69549f6a..c3640585e5 100644 --- a/mkosi.images/system/mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset +++ b/mkosi.images/system/mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset @@ -38,3 +38,4 @@ enable autorelabel.service # Enabled by default on OpenSUSE and not conditioned out in containers, so let's disable these here instead. disable iscsi.service disable iscsid.socket +disable iscsiuio.socket From 90ce4096c68d1ff2581895feed9adb038183541f Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 1 Jun 2024 13:18:35 +0200 Subject: [PATCH 04/12] mkosi: Update debian packaging to latest --- mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf index 047dbc1dc3..6c0eda2bcd 100644 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf @@ -8,7 +8,7 @@ Distribution=|ubuntu Environment= GIT_URL=https://salsa.debian.org/systemd-team/systemd.git GIT_BRANCH=debian/master - GIT_COMMIT=18201fa98d74172fa1a17242326e3275995cde13 + GIT_COMMIT=1ac6c92c9633fe6fd47f34119c04cae36da14d6a VolatilePackages= libnss-myhostname From 4548e53ee5336b06d7b3c023212e19a4945d3292 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 2 Jun 2024 10:26:20 +0200 Subject: [PATCH 05/12] mkosi: Make sure initrd coredumps are also stored in the journal Let's also translate the coredump config into a dropin so we don't accidentally override any existing configuration. --- .../systemd/coredump.conf => coredump-journal-storage.conf} | 0 mkosi.images/system/initrd/mkosi.conf | 4 +++- mkosi.images/system/mkosi.conf | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) rename mkosi.images/system/{mkosi.extra/usr/lib/systemd/coredump.conf => coredump-journal-storage.conf} (100%) diff --git a/mkosi.images/system/mkosi.extra/usr/lib/systemd/coredump.conf b/mkosi.images/system/coredump-journal-storage.conf similarity index 100% rename from mkosi.images/system/mkosi.extra/usr/lib/systemd/coredump.conf rename to mkosi.images/system/coredump-journal-storage.conf diff --git a/mkosi.images/system/initrd/mkosi.conf b/mkosi.images/system/initrd/mkosi.conf index 56bd4d0aa7..ed9bfdc5d8 100644 --- a/mkosi.images/system/initrd/mkosi.conf +++ b/mkosi.images/system/initrd/mkosi.conf @@ -2,4 +2,6 @@ [Content] PostInstallationScripts=../mkosi.sanitizers.chroot -ExtraTrees=../leak-sanitizer-suppressions:/usr/lib/systemd/leak-sanitizer-suppressions +ExtraTrees= + ../leak-sanitizer-suppressions:/usr/lib/systemd/leak-sanitizer-suppressions + ../coredump-journal-storage.conf:/usr/lib/systemd/coredump.conf.d/10-coredump-journal-storage.conf diff --git a/mkosi.images/system/mkosi.conf b/mkosi.images/system/mkosi.conf index aad7984ba3..bc4d80cc05 100644 --- a/mkosi.images/system/mkosi.conf +++ b/mkosi.images/system/mkosi.conf @@ -12,6 +12,7 @@ Autologin=yes ExtraTrees= %D/mkosi.crt:/usr/lib/verity.d/mkosi.crt # sysext verification key leak-sanitizer-suppressions:/usr/lib/systemd/leak-sanitizer-suppressions + coredump-journal-storage.conf:/usr/lib/systemd/coredump.conf.d/10-coredump-journal-storage.conf PostInstallationScripts=mkosi.sanitizers.chroot From 02bfe0fa1bd886afd472b1c5d077cb14a3bd42e9 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 1 Jun 2024 12:27:45 +0200 Subject: [PATCH 06/12] mkosi: Add support for building with LLVM Now you can do mkosi -E LLVM=1 to build with clang+lld. This includes support for building with sanitizers. --- mkosi.images/system/mkosi.conf | 3 ++ .../mkosi.conf.d/10-arch/mkosi.build.chroot | 19 +++++++++++- .../system/mkosi.conf.d/10-arch/mkosi.conf | 2 ++ .../10-centos-fedora/mkosi.build.chroot | 31 ++++++++++++++++--- .../mkosi.conf.d/10-centos-fedora/mkosi.conf | 1 + .../10-debian-ubuntu/mkosi.build.chroot | 21 ++++++++++++- .../mkosi.conf.d/10-debian-ubuntu/mkosi.conf | 2 ++ .../10-opensuse/mkosi.build.chroot | 28 +++++++++++++++-- .../mkosi.conf.d/10-opensuse/mkosi.conf | 3 +- 9 files changed, 99 insertions(+), 11 deletions(-) diff --git a/mkosi.images/system/mkosi.conf b/mkosi.images/system/mkosi.conf index bc4d80cc05..7a52061276 100644 --- a/mkosi.images/system/mkosi.conf +++ b/mkosi.images/system/mkosi.conf @@ -26,6 +26,7 @@ Packages= attr bash-completion bpftrace + clang coreutils curl diffutils @@ -42,6 +43,8 @@ Packages= kmod knot less + lld + llvm lvm2 man mdadm diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot index 7df218823e..12575eef6a 100755 --- a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot @@ -24,12 +24,29 @@ ln --symbolic . "pkg/$ID/src" # shellcheck source=/dev/null . /etc/makepkg.conf +CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE" +if ((LLVM)); then + # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed. + CFLAGS="$CFLAGS -shared-libasan -fno-sanitize=function" +fi + +LDFLAGS="" +if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then + LDFLAGS="$LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" +fi + # Override the default options. Disable FORTIFY_SOURCE because it doesn't work with O0. We specifically # disable "strip", "zipman" and "lto" as they slow down builds significantly. OPTIONS= cannot be overridden # 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 <>debian/changelog.new mv debian/changelog.new debian/changelog +CFLAGS="-O${OPTIMIZATION:-0}" +if ((LLVM)); then + # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed. + CFLAGS="$CFLAGS -shared-libasan -fno-sanitize=function" +fi + +LDFLAGS="" +if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then + LDFLAGS="$LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" +fi + +# TODO: Drop GENSYMBOLS_LEVEL once https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=986746 is fixed. build() { env \ + CC="$( ((LLVM)) && echo clang || echo gcc)" \ + CXX="$( ((LLVM)) && echo clang++ || echo g++)" \ + CC_LD="$( ((LLVM)) && echo lld)" \ + CXX_LD="$( ((LLVM)) && echo lld)" \ DEB_BUILD_OPTIONS="$(awk '$1=$1' <<<"\ $( ((WITH_TESTS)) || echo nocheck) \ $( ((WITH_DOCS)) || echo nodoc) \ @@ -59,11 +75,14 @@ build() { $( ((WITH_DOCS)) || echo nodoc) \ pkg.systemd.upstream \ ")" \ - DEB_CFLAGS_APPEND="-O${OPTIMIZATION:-0}" \ + DEB_CFLAGS_APPEND="$CFLAGS" \ + DEB_CXXFLAGS_APPEND="$CFLAGS" \ + DEB_LDFLAGS_APPEND="$LDFLAGS" \ DPKG_FORCE="unsafe-io" \ DPKG_DEB_COMPRESSOR_TYPE="none" \ DH_MISSING="--fail-missing" \ CONFFLAGS_UPSTREAM="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" \ + GENSYMBOLS_LEVEL="$( ((LLVM)) && echo 0 || echo 1)" \ dpkg-buildpackage \ --no-pre-clean \ --unsigned-changes \ diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf index 6c0eda2bcd..386c1923a5 100644 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf @@ -56,6 +56,7 @@ Packages= iputils-ping isc-dhcp-server libcap-ng-utils + libclang-rt-dev libtss2-rc0 libtss2-tcti-device0 locales @@ -83,6 +84,7 @@ Packages= InitrdPackages= btrfs-progs + libclang-rt-dev tpm2-tools InitrdVolatilePackages= diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot index 13cda4c9b8..11be720453 100755 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot @@ -42,9 +42,24 @@ DIST="$(rpm --eval %dist)" ARCH="$(rpm --eval %_arch)" SRCDEST="/usr/src/debug/systemd-$VERSION-${RELEASE}${DIST}.$ARCH" -EXTRA_CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE" +CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE" if ((WITH_DEBUG)); then - EXTRA_CFLAGS="$EXTRA_CFLAGS -fdebug-prefix-map=../src=$SRCDEST" + CFLAGS="$CFLAGS -fdebug-prefix-map=../src=$SRCDEST" +fi +if ((LLVM)); then + # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed. + CFLAGS="$CFLAGS -shared-libasan -fno-sanitize=function" +fi + +LDFLAGS="$(rpm --eval "%{?build_ldflags}") $LDFLAGS" +if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then + LDFLAGS="$LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" +fi + +# A macro can't have an empty body and currently opensuse does not specify any of its own linker flags so +# set LDFLAGS to %{nil} if there are no linker flags. +if [[ -z "${LDFLAGS// }" ]]; then + LDFLAGS="%{nil}" fi build() { @@ -54,6 +69,11 @@ build() { # TODO: Replace __meson_auto_features override with meson_extra_configure_options once the suse spec # starts to use it. # shellcheck disable=SC2046 + env \ + CC="$( ((LLVM)) && echo clang || echo gcc)" \ + CXX="$( ((LLVM)) && echo clang++ || echo g++)" \ + CC_LD="$( ((LLVM)) && echo lld)" \ + CXX_LD="$( ((LLVM)) && echo lld)" \ rpmbuild \ -bb \ --build-in-place \ @@ -70,7 +90,9 @@ build() { --define "version_override $VERSION" \ --define "release_override $RELEASE" \ --define "__check_files sh -c '$(rpm --define "_topdir /var/tmp" --eval %__check_files) | tee /tmp/unpackaged-files'" \ - --define "build_cflags $(rpm --eval %build_cflags) $EXTRA_CFLAGS" \ + --define "build_cflags $(rpm --eval "%{?build_cflags}") $CFLAGS" \ + --define "build_cxxflags $(rpm --eval "%{?build_cxxflags}") $CFLAGS" \ + --define "build_ldflags $LDFLAGS" \ --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_auto_features auto -D mode=developer -D b_sanitize=${SANITIZERS:-none}" \ diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf index 188f548643..71e315f869 100644 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf @@ -39,8 +39,8 @@ Packages= docbook-xsl-stylesheets f2fs-tools gawk - git-core gcc-c++ + git-core glibc-locale-base gnutls grep @@ -90,6 +90,7 @@ Packages= InitrdPackages= btrfs-progs + clang kmod libkmod2 tpm2.0-tools From 0ccbd22f04833b008adcd8a42f1c25663874d68a Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 3 Jun 2024 12:57:57 +0200 Subject: [PATCH 07/12] mkosi: Fix comment --- mkosi.images/system/mkosi.sanitizers.chroot | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mkosi.images/system/mkosi.sanitizers.chroot b/mkosi.images/system/mkosi.sanitizers.chroot index 48c5d147aa..854a419933 100755 --- a/mkosi.images/system/mkosi.sanitizers.chroot +++ b/mkosi.images/system/mkosi.sanitizers.chroot @@ -25,11 +25,7 @@ ASAN_RT_PATH="$(grep libasan.so < <(ldd /usr/lib/systemd/systemd) | cut -d ' ' - if [[ -z "$ASAN_RT_PATH" ]]; then ASAN_RT_PATH="$(grep libclang_rt.asan < <(ldd /usr/lib/systemd/systemd) | cut -d ' ' -f 3)" - # As clang's ASan DSO is usually in a non-standard path, let's check if - # the environment is set accordingly. If not, warn the user and exit. - # We're not setting the LD_LIBRARY_PATH automagically here, because - # user should encounter (and fix) the same issue when running the unit - # tests (meson test) + # As clang's ASan DSO is usually in a non-standard path, let's check if the RUNPATH is set accordingly. if ldd /usr/lib/systemd/systemd | grep -q "libclang_rt.asan.*not found"; then echo >&2 "clang's ASan DSO libclang_rt.asan is not present in the runtime library path" exit 1 From 51ce4c78646c252028ac700cbfd0d12b5c6db9a3 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 1 Jun 2024 12:58:29 +0200 Subject: [PATCH 08/12] mkosi: Allow setting custom CFLAGS and LDFLAGS --- .../mkosi.conf.d/10-arch/mkosi.build.chroot | 14 +++++------ .../10-centos-fedora/mkosi.build.chroot | 19 ++++++++------- .../10-debian-ubuntu/mkosi.build.chroot | 14 +++++------ .../10-opensuse/mkosi.build.chroot | 23 +++++++++++-------- 4 files changed, 38 insertions(+), 32 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot index 12575eef6a..0085bb1166 100755 --- a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot @@ -24,15 +24,15 @@ ln --symbolic . "pkg/$ID/src" # shellcheck source=/dev/null . /etc/makepkg.conf -CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE" +MKOSI_CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE" if ((LLVM)); then # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed. - CFLAGS="$CFLAGS -shared-libasan -fno-sanitize=function" + MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function" fi -LDFLAGS="" +MKOSI_LDFLAGS="" if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then - LDFLAGS="$LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" + MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" fi # Override the default options. Disable FORTIFY_SOURCE because it doesn't work with O0. We specifically @@ -44,9 +44,9 @@ export CC="$( ((LLVM)) && echo clang || echo gcc)" export CXX="$( ((LLVM)) && echo clang++ || echo g++)" export CC_LD="$( ((LLVM)) && echo lld)" export CXX_LD="$( ((LLVM)) && echo lld)" -export CFLAGS="\$CFLAGS $CFLAGS" -export CXXFLAGS="\$CXXFLAGS $CFLAGS" -export LDFLAGS="\$LDFLAGS $LDFLAGS" +export CFLAGS="\$CFLAGS $MKOSI_CFLAGS $CFLAGS" +export CXXFLAGS="\$CXXFLAGS $MKOSI_CFLAGS $CFLAGS" +export LDFLAGS="\$LDFLAGS $MKOSI_LDFLAGS $LDFLAGS" OPTIONS=( docs !libtool 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 3bac3fbce9..bd55e4d971 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 @@ -47,18 +47,18 @@ COMMON_MACRO_OVERRIDES=( ) # TODO: Drop -U_FORTIFY_SOURCE when we switch to CentOS Stream 10. -CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE" +MKOSI_CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE" if ((WITH_DEBUG)); then - CFLAGS="$CFLAGS -fdebug-prefix-map=../src=$SRCDEST" + MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=$SRCDEST" fi if ((LLVM)); then # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed. - CFLAGS="$CFLAGS -shared-libasan -fno-sanitize=function" + MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function" fi -LDFLAGS="" +MKOSI_LDFLAGS="" if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then - LDFLAGS="$LDFLAGS -Wl,-rpath=$(dirname "$(clang --print-file-name=libclang_rt.asan.so)")" + MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(dirname "$(clang --print-file-name=libclang_rt.asan.so)")" fi IFS= @@ -66,6 +66,9 @@ IFS= # https://github.com/mesonbuild/meson/pull/12835 is available. # shellcheck disable=SC2046 env \ +--unset=CFLAGS \ +--unset=CXXFLAGS \ +--unset=LDFLAGS \ ANNOBIN="no-active-checks" \ CC_LD="$( ((LLVM)) && echo lld)" \ CXX_LD="$( ((LLVM)) && echo lld)" \ @@ -85,9 +88,9 @@ CXX_LD="$( ((LLVM)) && echo lld)" \ --define "version_override $VERSION" \ --define "release_override $RELEASE" \ "${COMMON_MACRO_OVERRIDES[@]}" \ - --define "build_cflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_cflags}") $CFLAGS" \ - --define "build_cxxflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_cxxflags}") $CFLAGS" \ - --define "build_ldflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_ldflags}") $LDFLAGS" \ + --define "build_cflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_cflags}") $MKOSI_CFLAGS $CFLAGS" \ + --define "build_cxxflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_cxxflags}") $MKOSI_CFLAGS $CFLAGS" \ + --define "build_ldflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_ldflags}") $MKOSI_LDFLAGS $LDFLAGS" \ --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}" \ diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot index 8cdfdb719e..1db5b7afa9 100755 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot @@ -44,15 +44,15 @@ EOF cat debian/changelog >>debian/changelog.new mv debian/changelog.new debian/changelog -CFLAGS="-O${OPTIMIZATION:-0}" +MKOSI_CFLAGS="-O${OPTIMIZATION:-0}" if ((LLVM)); then # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed. - CFLAGS="$CFLAGS -shared-libasan -fno-sanitize=function" + MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function" fi -LDFLAGS="" +MKOSI_LDFLAGS="" if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then - LDFLAGS="$LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" + MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" fi # TODO: Drop GENSYMBOLS_LEVEL once https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=986746 is fixed. @@ -75,9 +75,9 @@ build() { $( ((WITH_DOCS)) || echo nodoc) \ pkg.systemd.upstream \ ")" \ - DEB_CFLAGS_APPEND="$CFLAGS" \ - DEB_CXXFLAGS_APPEND="$CFLAGS" \ - DEB_LDFLAGS_APPEND="$LDFLAGS" \ + DEB_CFLAGS_APPEND="$MKOSI_CFLAGS $CFLAGS" \ + DEB_CXXFLAGS_APPEND="$MKOSI_CFLAGS $CFLAGS" \ + DEB_LDFLAGS_APPEND="$MKOSI_LDFLAGS $LDFLAGS" \ DPKG_FORCE="unsafe-io" \ DPKG_DEB_COMPRESSOR_TYPE="none" \ DH_MISSING="--fail-missing" \ diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot index 11be720453..c6f4155f95 100755 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot @@ -42,24 +42,24 @@ DIST="$(rpm --eval %dist)" ARCH="$(rpm --eval %_arch)" SRCDEST="/usr/src/debug/systemd-$VERSION-${RELEASE}${DIST}.$ARCH" -CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE" +MKOSI_CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE" if ((WITH_DEBUG)); then - CFLAGS="$CFLAGS -fdebug-prefix-map=../src=$SRCDEST" + MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=$SRCDEST" fi if ((LLVM)); then # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed. - CFLAGS="$CFLAGS -shared-libasan -fno-sanitize=function" + MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function" fi -LDFLAGS="$(rpm --eval "%{?build_ldflags}") $LDFLAGS" +MKOSI_LDFLAGS="$(rpm --eval "%{?build_ldflags}")" if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then - LDFLAGS="$LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" + MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" fi # A macro can't have an empty body and currently opensuse does not specify any of its own linker flags so # set LDFLAGS to %{nil} if there are no linker flags. -if [[ -z "${LDFLAGS// }" ]]; then - LDFLAGS="%{nil}" +if [[ -z "${MKOSI_LDFLAGS// }" ]]; then + MKOSI_LDFLAGS="%{nil}" fi build() { @@ -70,6 +70,9 @@ build() { # starts to use it. # shellcheck disable=SC2046 env \ + --unset CFLAGS \ + --unset CXXFLAGS \ + --unset LDFLAGS \ CC="$( ((LLVM)) && echo clang || echo gcc)" \ CXX="$( ((LLVM)) && echo clang++ || echo g++)" \ CC_LD="$( ((LLVM)) && echo lld)" \ @@ -90,9 +93,9 @@ build() { --define "version_override $VERSION" \ --define "release_override $RELEASE" \ --define "__check_files sh -c '$(rpm --define "_topdir /var/tmp" --eval %__check_files) | tee /tmp/unpackaged-files'" \ - --define "build_cflags $(rpm --eval "%{?build_cflags}") $CFLAGS" \ - --define "build_cxxflags $(rpm --eval "%{?build_cxxflags}") $CFLAGS" \ - --define "build_ldflags $LDFLAGS" \ + --define "build_cflags $(rpm --eval "%{?build_cflags}") $MKOSI_CFLAGS $CFLAGS" \ + --define "build_cxxflags $(rpm --eval "%{?build_cxxflags}") $MKOSI_CFLAGS $CFLAGS" \ + --define "build_ldflags $MKOSI_LDFLAGS $LDFLAGS" \ --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_auto_features auto -D mode=developer -D b_sanitize=${SANITIZERS:-none}" \ From 05895728e650906a335285878af05af52a0fde15 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 1 Jun 2024 14:45:22 +0200 Subject: [PATCH 09/12] mkosi: Allow clearing meson cache with WIPE=1 meson does not support changing compilation flags on the fly, when doing so, the entire build directory has to be cleared explicitly, so let's add a way to do that by setting WIPE=1. Let's also allow developers to specify their own meson options via $MESON_OPTIONS. --- .../system/mkosi.conf.d/10-arch/mkosi.build.chroot | 7 ++++++- .../10-centos-fedora/mkosi.build.chroot | 7 ++++++- .../10-debian-ubuntu/mkosi.build.chroot | 14 +++++++++++++- .../mkosi.conf.d/10-opensuse/mkosi.build.chroot | 14 +++++++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot index 0085bb1166..e3c694ba93 100755 --- a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot @@ -35,6 +35,11 @@ if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" fi +MKOSI_MESON_OPTIONS="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" +if ((WIPE)); then + MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe" +fi + # Override the default options. Disable FORTIFY_SOURCE because it doesn't work with O0. We specifically # disable "strip", "zipman" and "lto" as they slow down builds significantly. OPTIONS= cannot be overridden # on the makepkg command line so we append to /etc/makepkg.conf instead. The rootfs is overlaid with a @@ -86,6 +91,6 @@ env --chdir="pkg/$ID" \ BUILDDIR="$PWD/pkg/$ID" \ PKGDEST="$OUTPUTDIR" \ PKGEXT=".pkg.tar" \ - MESON_EXTRA_CONFIGURE_OPTIONS="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" + MESON_EXTRA_CONFIGURE_OPTIONS="$MKOSI_MESON_OPTIONS $MESON_OPTIONS" cp "$OUTPUTDIR"/*.pkg.tar "$PACKAGEDIR" 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 bd55e4d971..8c7c413cfc 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 @@ -61,6 +61,11 @@ if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(dirname "$(clang --print-file-name=libclang_rt.asan.so)")" fi +MKOSI_MESON_OPTIONS="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" +if ((WIPE)); then + MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe" +fi + IFS= # TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once # https://github.com/mesonbuild/meson/pull/12835 is available. @@ -93,7 +98,7 @@ CXX_LD="$( ((LLVM)) && echo lld)" \ --define "build_ldflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_ldflags}") $MKOSI_LDFLAGS $LDFLAGS" \ --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 "meson_extra_configure_options $MKOSI_MESON_OPTIONS $MESON_OPTIONS" \ $( ((WITH_DEBUG)) || echo "--define=__brp_strip %{nil}") \ --define "__brp_compress %{nil}" \ --define "__brp_mangle_shebangs %{nil}" \ diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot index 1db5b7afa9..8e5c25b229 100755 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot @@ -55,6 +55,11 @@ if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux" fi +MKOSI_MESON_OPTIONS="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" +if ((WIPE)); then + MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe" +fi + # TODO: Drop GENSYMBOLS_LEVEL once https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=986746 is fixed. build() { env \ @@ -81,12 +86,19 @@ build() { DPKG_FORCE="unsafe-io" \ DPKG_DEB_COMPRESSOR_TYPE="none" \ DH_MISSING="--fail-missing" \ - CONFFLAGS_UPSTREAM="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" \ + CONFFLAGS_UPSTREAM="$MKOSI_MESON_OPTIONS $MESON_OPTIONS" \ GENSYMBOLS_LEVEL="$( ((LLVM)) && echo 0 || echo 1)" \ dpkg-buildpackage \ --no-pre-clean \ --unsigned-changes \ --build=binary + + EXIT_STATUS=$? + + # Make sure we don't reconfigure twice. + MKOSI_MESON_OPTIONS="${MKOSI_MESON_OPTIONS//"--wipe"/}" + + return $EXIT_STATUS } if ! build; then diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot index c6f4155f95..8351200d99 100755 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot @@ -62,6 +62,11 @@ if [[ -z "${MKOSI_LDFLAGS// }" ]]; then MKOSI_LDFLAGS="%{nil}" fi +MKOSI_MESON_OPTIONS="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" +if ((WIPE)); then + MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe" +fi + build() { IFS= # TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once @@ -98,7 +103,7 @@ build() { --define "build_ldflags $MKOSI_LDFLAGS $LDFLAGS" \ --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_auto_features auto -D mode=developer -D b_sanitize=${SANITIZERS:-none}" \ + --define "__meson_auto_features auto $MKOSI_MESON_OPTIONS $MESON_OPTIONS" \ --define "__os_install_post /usr/lib/rpm/brp-suse %{nil}" \ --define "__elf_exclude_path ^/usr/lib/systemd/tests/unit-tests/.*$" \ --define "__script_requires %{nil}" \ @@ -107,6 +112,13 @@ build() { --noclean \ "$@" \ "pkg/$ID/systemd.spec" + + EXIT_STATUS=$? + + # Make sure we don't reconfigure twice. + MKOSI_MESON_OPTIONS="${MKOSI_MESON_OPTIONS//"--wipe"/}" + + return $EXIT_STATUS } if ! build; then From aacf9527d654a7427403f23057f142561175cd25 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 1 Jun 2024 13:01:03 +0200 Subject: [PATCH 10/12] mkosi: Build with --werror in CI --- .github/workflows/mkosi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index e4e233b236..a4831bae6a 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -123,6 +123,7 @@ jobs: # Enabling optimizations significantly speeds up integration tests. OPTIMIZATION=g SANITIZERS=${{ matrix.sanitizers }} + MESON_OPTIONS=--werror [Host] ToolsTree=default From 9ee96e73822c6058ae7a0e72e4c78eb54edbe4fa Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 1 Jun 2024 15:14:08 +0200 Subject: [PATCH 11/12] mkosi: Build Fedora Rawhide sanitizers job with LLVM More coverage and clang tends to be better at sanitizers than gcc. --- .github/workflows/mkosi.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index a4831bae6a..c9d670134d 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -57,24 +57,31 @@ jobs: - distro: arch release: rolling sanitizers: "" + llvm: 0 - distro: debian release: testing sanitizers: "" + llvm: 0 - distro: ubuntu release: noble sanitizers: "" + llvm: 0 - distro: fedora release: "40" sanitizers: "" + llvm: 0 - distro: fedora release: rawhide sanitizers: address,undefined + llvm: 1 - distro: opensuse release: tumbleweed sanitizers: "" + llvm: 0 - distro: centos release: "9" sanitizers: "" + llvm: 0 steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 @@ -124,6 +131,7 @@ jobs: OPTIMIZATION=g SANITIZERS=${{ matrix.sanitizers }} MESON_OPTIONS=--werror + LLVM=${{ matrix.llvm }} [Host] ToolsTree=default From c45ce65f2f923a04819d66078e9194763f75bed6 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 3 Jun 2024 09:47:33 +0200 Subject: [PATCH 12/12] mkosi: Allow using $MESON_VERBOSE to enable verbose meson output --- mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot | 2 +- .../system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot | 2 +- .../system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot | 2 +- mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot index e3c694ba93..9407c1e053 100755 --- a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot @@ -87,7 +87,7 @@ env --chdir="pkg/$ID" \ $( ((WITH_TESTS)) || echo --nocheck) \ --force \ _systemd_UPSTREAM=1 \ - _systemd_QUIET=1 \ + _systemd_QUIET=$( ((MESON_VERBOSE)); echo $? ) \ BUILDDIR="$PWD/pkg/$ID" \ PKGDEST="$OUTPUTDIR" \ PKGEXT=".pkg.tar" \ 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 8c7c413cfc..d2ba46bb56 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 @@ -96,7 +96,7 @@ CXX_LD="$( ((LLVM)) && echo lld)" \ --define "build_cflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_cflags}") $MKOSI_CFLAGS $CFLAGS" \ --define "build_cxxflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_cxxflags}") $MKOSI_CFLAGS $CFLAGS" \ --define "build_ldflags $(rpm "${COMMON_MACRO_OVERRIDES[@]}" --eval "%{?build_ldflags}") $MKOSI_LDFLAGS $LDFLAGS" \ - --define "meson_build %{shrink:%{__meson} compile -C %{_vpath_builddir} -j %{_smp_build_ncpus} %{nil}}" \ + --define "meson_build %{shrink:%{__meson} compile -C %{_vpath_builddir} -j %{_smp_build_ncpus} $( ((MESON_VERBOSE)) && echo --verbose) %{nil}}" \ --define "meson_install %{shrink:DESTDIR=%{buildroot} %{__meson} install -C %{_vpath_builddir} --no-rebuild --quiet %{nil}}" \ --define "meson_extra_configure_options $MKOSI_MESON_OPTIONS $MESON_OPTIONS" \ $( ((WITH_DEBUG)) || echo "--define=__brp_strip %{nil}") \ diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot index 8e5c25b229..e36fb4887c 100755 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot @@ -71,7 +71,7 @@ build() { $( ((WITH_TESTS)) || echo nocheck) \ $( ((WITH_DOCS)) || echo nodoc) \ $( ((WITH_DEBUG)) && echo debug || echo nostrip) \ - terse \ + $( ! ((MESON_VERBOSE)) && echo terse) \ optimize=-lto \ hardening=-fortify \ ")" \ diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot index 8351200d99..03bef75400 100755 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot @@ -101,7 +101,7 @@ build() { --define "build_cflags $(rpm --eval "%{?build_cflags}") $MKOSI_CFLAGS $CFLAGS" \ --define "build_cxxflags $(rpm --eval "%{?build_cxxflags}") $MKOSI_CFLAGS $CFLAGS" \ --define "build_ldflags $MKOSI_LDFLAGS $LDFLAGS" \ - --define "meson_build %{shrink:%{__meson} compile -C %{_vpath_builddir} -j %{_smp_build_ncpus} %{nil}}" \ + --define "meson_build %{shrink:%{__meson} compile -C %{_vpath_builddir} -j %{_smp_build_ncpus} $( ((MESON_VERBOSE)) && echo --verbose) %{nil}}" \ --define "meson_install %{shrink:DESTDIR=%{buildroot} %{__meson} install -C %{_vpath_builddir} --no-rebuild --quiet %{nil}}" \ --define "__meson_auto_features auto $MKOSI_MESON_OPTIONS $MESON_OPTIONS" \ --define "__os_install_post /usr/lib/rpm/brp-suse %{nil}" \