This also makes mkosi.functions included after the trivial execution checks.
# SPDX-License-Identifier: LGPL-2.1-or-later
+# This is intended to be included by mkosi.build.chroot,
+# and sets the following variables and one common function:
+# - $MKOSI_CFLAGS
+# - $MKOSI_LDFLAGS
+# - $MKOSI_MESON_OPTIONS
+
+MKOSI_CFLAGS="-O0 -g"
+if ((LLVM)); then
+ # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed.
+ MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function"
+fi
+
+MKOSI_LDFLAGS=""
+if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then
+ MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(realpath "$(clang --print-runtime-dir)")"
+fi
+
+MKOSI_MESON_OPTIONS="-D mode=developer -D vcs-tag=${VCS_TAG:-true} -D b_sanitize=${SANITIZERS:-none} -Dtime-epoch=1744207869"
+if ((WIPE)) && [[ -d "$BUILDDIR/meson-private" ]]; then
+ MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
+fi
+
+if ((COVERAGE)); then
+ MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS -D b_coverage=true"
+ MKOSI_CFLAGS="$MKOSI_CFLAGS -fprofile-dir=/coverage"
+fi
+
make_sysext_unsigned() {
if ! ((SYSEXT)); then
return
exit 1
fi
-MKOSI_CFLAGS="-O0 -g -Wp,-U_FORTIFY_SOURCE"
-if ((LLVM)); then
- # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed.
- MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function"
-fi
-
-MKOSI_LDFLAGS=""
-if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then
- MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(realpath "$(clang --print-runtime-dir)")"
-fi
+. mkosi/mkosi.functions
-MKOSI_MESON_OPTIONS="-D mode=developer -D vcs-tag=${VCS_TAG:-true} -D b_sanitize=${SANITIZERS:-none} -Dtime-epoch=1744207869"
-if ((WIPE)) && [[ -d "$BUILDDIR/meson-private" ]]; then
- MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
-fi
-if ((COVERAGE)); then
- MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS -D b_coverage=true"
- MKOSI_CFLAGS="$MKOSI_CFLAGS -fprofile-dir=/coverage"
-fi
+MKOSI_CFLAGS="$MKOSI_CFLAGS -Wp,-U_FORTIFY_SOURCE"
# Override the default options. 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
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
-. mkosi/mkosi.functions
-
if [[ "$1" == "clangd" ]]; then
exit 0
fi
exit 1
fi
+. mkosi/mkosi.functions
+
TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
if [[ "$(rpm --eval "%{lua:print(rpm.vercmp('$(rpm --version | cut -d ' ' -f3)', '4.19.91'))}")" == "-1" ]]; then
)
# TODO: Drop -U_FORTIFY_SOURCE when we switch to CentOS Stream 10.
-MKOSI_CFLAGS="-O0 -g -Wp,-U_FORTIFY_SOURCE"
+MKOSI_CFLAGS="$MKOSI_CFLAGS -Wp,-U_FORTIFY_SOURCE"
if ((WITH_DEBUG)); then
MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=/usr/src/debug/systemd"
fi
-if ((LLVM)); then
- # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed.
- MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function"
-fi
-
-MKOSI_LDFLAGS=""
-if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then
- MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(realpath "$(clang --print-runtime-dir)")"
-fi
-
-MKOSI_MESON_OPTIONS="-D mode=developer -D vcs-tag=${VCS_TAG:-true} -D b_sanitize=${SANITIZERS:-none} -Dtime-epoch=1744207869"
-if ((WIPE)) && [[ -d "$BUILDDIR/meson-private" ]]; then
- MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
-fi
-if ((COVERAGE)); then
- MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS -D b_coverage=true"
- MKOSI_CFLAGS="$MKOSI_CFLAGS -fprofile-dir=/coverage"
-fi
(
shopt -s nullglob
exit 1
fi
-MKOSI_CFLAGS="-O0 -g"
-if ((LLVM)); then
- # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed.
- MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function"
-fi
-
-MKOSI_LDFLAGS=""
-if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then
- MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(realpath "$(clang --print-runtime-dir)")"
-fi
-
-MKOSI_MESON_OPTIONS="-D mode=developer -D vcs-tag=${VCS_TAG:-true} -D b_sanitize=${SANITIZERS:-none} -Dtime-epoch=1744207869"
-if ((WIPE)) && [[ -d "$BUILDDIR/meson-private" ]]; then
- MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
-fi
-if ((COVERAGE)); then
- MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS -D b_coverage=true"
- MKOSI_CFLAGS="$MKOSI_CFLAGS -fprofile-dir=/coverage"
-fi
+. mkosi/mkosi.functions
# We transplant the debian/ folder from the deb package sources into the upstream sources.
mount --mkdir --bind "$SRCDIR/pkg/$PKG_SUBDIR/debian" "$SRCDIR"/debian
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
-. mkosi/mkosi.functions
-
if [[ "$1" == "clangd" ]]; then
exit 0
fi
exit 1
fi
+. mkosi/mkosi.functions
+
TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
# The openSUSE filelists hardcode the manpage compression extension. This causes rpmbuild errors since we
VERSION="$(cat meson.version)"
RELEASE="$(date "+%Y%m%d%H%M%S" --date "@$TS")"
-MKOSI_CFLAGS="-O0 -g -Wp,-U_FORTIFY_SOURCE"
+MKOSI_CFLAGS="$MKOSI_CFLAGS -Wp,-U_FORTIFY_SOURCE"
if ((WITH_DEBUG)); then
MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=/usr/src/debug/systemd"
fi
-if ((LLVM)); then
- # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed.
- MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function"
-fi
-MKOSI_LDFLAGS="$(rpm --eval "%{?build_ldflags}")"
-if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then
- MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(realpath "$(clang --print-runtime-dir)")"
-fi
+MKOSI_LDFLAGS="$(rpm --eval "%{?build_ldflags}") $MKOSI_LDFLAGS"
# 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.
MKOSI_LDFLAGS="%{nil}"
fi
-MKOSI_MESON_OPTIONS="-D mode=developer -D vcs-tag=${VCS_TAG:-true} -D b_sanitize=${SANITIZERS:-none} -Dtime-epoch=1744207869"
-if ((WIPE)) && [[ -d "$BUILDDIR/meson-private" ]]; then
- MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
-fi
-if ((COVERAGE)); then
- MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS -D b_coverage=true"
- MKOSI_CFLAGS="$MKOSI_CFLAGS -fprofile-dir=/coverage"
-fi
-
# The opensuse spec tars up stuff in test/ and unpacks it in test/integration-tests, which we now use for our
# own purposes, so let's get rid of that specific bit of logic in the opensuse spec until they've had a chance
# to adapt.