mirror of
https://github.com/systemd/systemd.git
synced 2025-02-02 13:47:27 +03:00
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.
This commit is contained in:
parent
51ce4c7864
commit
05895728e6
@ -35,6 +35,11 @@ if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then
|
|||||||
MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux"
|
MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux"
|
||||||
fi
|
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
|
# 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
|
# 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
|
# 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" \
|
BUILDDIR="$PWD/pkg/$ID" \
|
||||||
PKGDEST="$OUTPUTDIR" \
|
PKGDEST="$OUTPUTDIR" \
|
||||||
PKGEXT=".pkg.tar" \
|
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"
|
cp "$OUTPUTDIR"/*.pkg.tar "$PACKAGEDIR"
|
||||||
|
@ -61,6 +61,11 @@ if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then
|
|||||||
MKOSI_LDFLAGS="$MKOSI_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
|
fi
|
||||||
|
|
||||||
|
MKOSI_MESON_OPTIONS="-D mode=developer -D b_sanitize=${SANITIZERS:-none}"
|
||||||
|
if ((WIPE)); then
|
||||||
|
MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
|
||||||
|
fi
|
||||||
|
|
||||||
IFS=
|
IFS=
|
||||||
# TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once
|
# TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once
|
||||||
# https://github.com/mesonbuild/meson/pull/12835 is available.
|
# 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 "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} %{nil}}" \
|
||||||
--define "meson_install %{shrink:DESTDIR=%{buildroot} %{__meson} install -C %{_vpath_builddir} --no-rebuild --quiet %{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}") \
|
$( ((WITH_DEBUG)) || echo "--define=__brp_strip %{nil}") \
|
||||||
--define "__brp_compress %{nil}" \
|
--define "__brp_compress %{nil}" \
|
||||||
--define "__brp_mangle_shebangs %{nil}" \
|
--define "__brp_mangle_shebangs %{nil}" \
|
||||||
|
@ -55,6 +55,11 @@ if ((LLVM)) && [[ -n "$SANITIZERS" ]]; then
|
|||||||
MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux"
|
MKOSI_LDFLAGS="$MKOSI_LDFLAGS -Wl,-rpath=$(clang --print-file-name="")lib/linux"
|
||||||
fi
|
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.
|
# TODO: Drop GENSYMBOLS_LEVEL once https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=986746 is fixed.
|
||||||
build() {
|
build() {
|
||||||
env \
|
env \
|
||||||
@ -81,12 +86,19 @@ build() {
|
|||||||
DPKG_FORCE="unsafe-io" \
|
DPKG_FORCE="unsafe-io" \
|
||||||
DPKG_DEB_COMPRESSOR_TYPE="none" \
|
DPKG_DEB_COMPRESSOR_TYPE="none" \
|
||||||
DH_MISSING="--fail-missing" \
|
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)" \
|
GENSYMBOLS_LEVEL="$( ((LLVM)) && echo 0 || echo 1)" \
|
||||||
dpkg-buildpackage \
|
dpkg-buildpackage \
|
||||||
--no-pre-clean \
|
--no-pre-clean \
|
||||||
--unsigned-changes \
|
--unsigned-changes \
|
||||||
--build=binary
|
--build=binary
|
||||||
|
|
||||||
|
EXIT_STATUS=$?
|
||||||
|
|
||||||
|
# Make sure we don't reconfigure twice.
|
||||||
|
MKOSI_MESON_OPTIONS="${MKOSI_MESON_OPTIONS//"--wipe"/}"
|
||||||
|
|
||||||
|
return $EXIT_STATUS
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! build; then
|
if ! build; then
|
||||||
|
@ -62,6 +62,11 @@ if [[ -z "${MKOSI_LDFLAGS// }" ]]; then
|
|||||||
MKOSI_LDFLAGS="%{nil}"
|
MKOSI_LDFLAGS="%{nil}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
MKOSI_MESON_OPTIONS="-D mode=developer -D b_sanitize=${SANITIZERS:-none}"
|
||||||
|
if ((WIPE)); then
|
||||||
|
MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
|
||||||
|
fi
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
IFS=
|
IFS=
|
||||||
# TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once
|
# 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 "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} %{nil}}" \
|
||||||
--define "meson_install %{shrink:DESTDIR=%{buildroot} %{__meson} install -C %{_vpath_builddir} --no-rebuild --quiet %{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 "__os_install_post /usr/lib/rpm/brp-suse %{nil}" \
|
||||||
--define "__elf_exclude_path ^/usr/lib/systemd/tests/unit-tests/.*$" \
|
--define "__elf_exclude_path ^/usr/lib/systemd/tests/unit-tests/.*$" \
|
||||||
--define "__script_requires %{nil}" \
|
--define "__script_requires %{nil}" \
|
||||||
@ -107,6 +112,13 @@ build() {
|
|||||||
--noclean \
|
--noclean \
|
||||||
"$@" \
|
"$@" \
|
||||||
"pkg/$ID/systemd.spec"
|
"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
|
if ! build; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user