From 9ace7f56f9d12c67d904661a8df9e1b442bede89 Mon Sep 17 00:00:00 2001 From: Florian Schmaus <flow@cs.fau.de> Date: Fri, 16 Apr 2021 09:30:14 +0200 Subject: [PATCH] [repare-build-dir] Check for unknown meson options Meson does only emit a warning if unknown options are passed. In our case, this is always something we should take care of, because an option we assumed we configured, had no effect. See also https://github.com/mesonbuild/meson/pull/8658 --- tools/prepare-build-dir | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/prepare-build-dir b/tools/prepare-build-dir index 1dd77115..b366c80a 100755 --- a/tools/prepare-build-dir +++ b/tools/prepare-build-dir @@ -14,11 +14,13 @@ cd "`dirname "${SCRIPTDIR}"`" > /dev/null SCRIPTDIR="`pwd`"; popd > /dev/null +DEBUG=false QUIET=false while getopts :dq OPT; do case $OPT in d) set -x + DEBUG=true ;; q) QUIET=true @@ -87,9 +89,27 @@ for var in $(compgen -e); do MESON_ARGS+=("-D${MESON_BUILD_OPTION_NAME}=${MESON_BUILD_OPTION_VALUE}") done +LOGFILE=$(mktemp --tmpdir=/var/tmp) +cleanup() { + rm -f "${LOGFILE}" +} +trap cleanup EXIT + if ! $QUIET; then set -x fi -exec meson --buildtype=${BUILDTYPE} \ + +meson --buildtype=${BUILDTYPE} \ ${MESON_ARGS[@]} \ - "${ABSOLUTE_BUILDDIR}" + "${ABSOLUTE_BUILDDIR}" |\ + tee "${LOGFILE}" + +if ! $DEBUG; then + set +x +fi + +if grep -F "WARNING: Unknown options:" "${LOGFILE}"; then + echo "ERROR: Unknown meson options found" + rm -r "${ABSOLUTE_BUILDDIR}" "${ABSOLUTE_BUILDDIR_SYMLINK}" + exit 1 +fi -- GitLab