From 714d02697fee3b0a7e95fc56bb01e5cba22c1607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Wed, 22 May 2024 13:23:57 +0200 Subject: [PATCH] contrib: configure-for-system: use meson by default With the deprecation of autotools, use meson by default. For the moment, it's still possible to build with autotools passing -a/--autotools. Additionally, as we allow to specify different build directories other than './build', let's not asume that the user wants to overwrite it by default. Instead, the script will asume ./build if the user doesn't specify the build directory, but only if it doesn't exist. If it does, the user will have to force overwritting it with `--meson ./build`. --- contrib/fedora/rpm/configure-for-system.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/contrib/fedora/rpm/configure-for-system.sh b/contrib/fedora/rpm/configure-for-system.sh index 638fa0739..37966ae40 100755 --- a/contrib/fedora/rpm/configure-for-system.sh +++ b/contrib/fedora/rpm/configure-for-system.sh @@ -149,8 +149,9 @@ P_NOBUILD="${NOBUILD-0}" P_DEBUG="${DEBUG-1}" -P_BUILD_TYPE="${BUILD_TYPE-}" +P_BUILD_TYPE="${BUILD_TYPE-meson}" P_MESON_BUILDDIR="${MESON_BUILDDIR-./build}" +[ -n "$MESON_BUILDDIR" ] && P_MESON_BUILDDIR_FORCE=1 P_CFLAGS="${CFLAGS-}" P_CC="${CC-$((! command -v gcc && command -v clang) &>/dev/null && echo clang || echo gcc)}" @@ -307,16 +308,6 @@ else P_CFLAGS="-g -O2 -fexceptions${P_CFLAGS:+ }$P_CFLAGS" fi -if [ -z "$P_BUILD_TYPE" ] ; then - if [ -d "$P_MESON_BUILDDIR" -a ! -f ./configure ] ; then - P_BUILD_TYPE=meson - elif [ ! -d "$P_MESON_BUILDDIR" -a -f ./configure ] ; then - P_BUILD_TYPE=autotools - else - P_BUILD_TYPE=autotools - fi -fi - while [[ $# -gt 0 ]] ; do A="$1" shift @@ -324,6 +315,7 @@ while [[ $# -gt 0 ]] ; do --meson|-m) P_BUILD_TYPE=meson P_MESON_BUILDDIR="$1" + P_MESON_BUILDDIR_FORCE=1 shift ;; --autotools|-a) @@ -346,6 +338,14 @@ while [[ $# -gt 0 ]] ; do esac done +if [ "$P_BUILD_TYPE" = meson -a "$P_MESON_BUILDDIR_FORCE" != 1 ]; then + if [ -d "$P_MESON_BUILDDIR" ]; then + echo "Build directory '$P_MESON_BUILDDIR' chosen by default, but it exists and will be overwritten." \ + "If you really want that, pass '--meson \"$P_MESON_BUILDDIR\"'." >&2 + exit 1 + fi +fi + vars_with_vals if [ "$P_BUILD_TYPE" == meson ] ; then