contrib: configure-for-system: specify meson build dir
Instead of forcing to use ./build directory, let's make the the user specify what directory he wants to use. This will allow to have multiple build directories with different configurations as meson is designed to allow, without having to overwrite the existing build one.
This commit is contained in:

committed by
Íñigo Huguet

parent
bd1763ebea
commit
a07627fdcc
@@ -30,7 +30,7 @@ vars_with_vals() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "$ $0 [-m|--meson] [-a|--autotools] [-s|--show] [-B|--no-build] [-h|--help]"
|
echo "$ $0 [-m|--meson <builddir>] [-a|--autotools] [-s|--show] [-B|--no-build] [-h|--help]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Configure NetworkManager in a way that is similar to when building"
|
echo "Configure NetworkManager in a way that is similar to when building"
|
||||||
echo "RPMs of NetworkManager for Fedora/RHEL. The effect is that \`make install\`"
|
echo "RPMs of NetworkManager for Fedora/RHEL. The effect is that \`make install\`"
|
||||||
@@ -150,6 +150,7 @@ P_NOBUILD="${NOBUILD-0}"
|
|||||||
P_DEBUG="${DEBUG-1}"
|
P_DEBUG="${DEBUG-1}"
|
||||||
|
|
||||||
P_BUILD_TYPE="${BUILD_TYPE-}"
|
P_BUILD_TYPE="${BUILD_TYPE-}"
|
||||||
|
P_MESON_BUILDDIR="${MESON_BUILDDIR-./build}"
|
||||||
P_CFLAGS="${CFLAGS-}"
|
P_CFLAGS="${CFLAGS-}"
|
||||||
P_CC="${CC-$((! command -v gcc && command -v clang) &>/dev/null && echo clang || echo gcc)}"
|
P_CC="${CC-$((! command -v gcc && command -v clang) &>/dev/null && echo clang || echo gcc)}"
|
||||||
|
|
||||||
@@ -307,9 +308,9 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$P_BUILD_TYPE" ] ; then
|
if [ -z "$P_BUILD_TYPE" ] ; then
|
||||||
if [ -d ./build -a ! -f ./configure ] ; then
|
if [ -d "$P_MESON_BUILDDIR" -a ! -f ./configure ] ; then
|
||||||
P_BUILD_TYPE=meson
|
P_BUILD_TYPE=meson
|
||||||
elif [ ! -d ./build -a -f ./configure ] ; then
|
elif [ ! -d "$P_MESON_BUILDDIR" -a -f ./configure ] ; then
|
||||||
P_BUILD_TYPE=autotools
|
P_BUILD_TYPE=autotools
|
||||||
else
|
else
|
||||||
P_BUILD_TYPE=autotools
|
P_BUILD_TYPE=autotools
|
||||||
@@ -322,6 +323,8 @@ while [[ $# -gt 0 ]] ; do
|
|||||||
case "$A" in
|
case "$A" in
|
||||||
--meson|-m)
|
--meson|-m)
|
||||||
P_BUILD_TYPE=meson
|
P_BUILD_TYPE=meson
|
||||||
|
P_MESON_BUILDDIR="$1"
|
||||||
|
shift
|
||||||
;;
|
;;
|
||||||
--autotools|-a)
|
--autotools|-a)
|
||||||
P_BUILD_TYPE=autotools
|
P_BUILD_TYPE=autotools
|
||||||
@@ -347,7 +350,7 @@ vars_with_vals
|
|||||||
|
|
||||||
if [ "$P_BUILD_TYPE" == meson ] ; then
|
if [ "$P_BUILD_TYPE" == meson ] ; then
|
||||||
MESON_RECONFIGURE=
|
MESON_RECONFIGURE=
|
||||||
if test -d "./build/" ; then
|
if test -d "$P_MESON_BUILDDIR" ; then
|
||||||
MESON_RECONFIGURE="--reconfigure"
|
MESON_RECONFIGURE="--reconfigure"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -355,7 +358,8 @@ if [ "$P_BUILD_TYPE" == meson ] ; then
|
|||||||
env \
|
env \
|
||||||
CC="$P_CC" \
|
CC="$P_CC" \
|
||||||
CFLAGS="$P_CFLAGS" \
|
CFLAGS="$P_CFLAGS" \
|
||||||
meson \
|
meson setup\
|
||||||
|
$MESON_RECONFIGURE \
|
||||||
--buildtype=plain \
|
--buildtype=plain \
|
||||||
--prefix="$D_PREFIX" \
|
--prefix="$D_PREFIX" \
|
||||||
--libdir="$D_LIBDIR" \
|
--libdir="$D_LIBDIR" \
|
||||||
@@ -372,11 +376,6 @@ if [ "$P_BUILD_TYPE" == meson ] ; then
|
|||||||
--sharedstatedir="$D_SHAREDSTATEDIR" \
|
--sharedstatedir="$D_SHAREDSTATEDIR" \
|
||||||
--wrap-mode=nodownload \
|
--wrap-mode=nodownload \
|
||||||
--auto-features=enabled \
|
--auto-features=enabled \
|
||||||
\
|
|
||||||
build \
|
|
||||||
\
|
|
||||||
$MESON_RECONFIGURE \
|
|
||||||
\
|
|
||||||
-Db_ndebug=false \
|
-Db_ndebug=false \
|
||||||
--warnlevel 2 \
|
--warnlevel 2 \
|
||||||
$(args_enable "$P_TEST" --werror) \
|
$(args_enable "$P_TEST" --werror) \
|
||||||
@@ -429,6 +428,8 @@ if [ "$P_BUILD_TYPE" == meson ] ; then
|
|||||||
-Dnetconfig=no \
|
-Dnetconfig=no \
|
||||||
-Dconfig_dns_rc_manager_default="$P_DNS_RC_MANAGER_DEFAULT" \
|
-Dconfig_dns_rc_manager_default="$P_DNS_RC_MANAGER_DEFAULT" \
|
||||||
-Dconfig_logging_backend_default="$P_LOGGING_BACKEND_DEFAULT" \
|
-Dconfig_logging_backend_default="$P_LOGGING_BACKEND_DEFAULT" \
|
||||||
|
\
|
||||||
|
"$P_MESON_BUILDDIR" \
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
if ! test -x ./configure ; then
|
if ! test -x ./configure ; then
|
||||||
@@ -520,7 +521,7 @@ fi
|
|||||||
|
|
||||||
if ! bool "$P_NOBUILD" ; then
|
if ! bool "$P_NOBUILD" ; then
|
||||||
if [ "$P_BUILD_TYPE" == meson ] ; then
|
if [ "$P_BUILD_TYPE" == meson ] ; then
|
||||||
$SHOW_CMD ninja -C build
|
$SHOW_CMD ninja -C "$P_MESON_BUILDDIR"
|
||||||
else
|
else
|
||||||
$SHOW_CMD make -j 10
|
$SHOW_CMD make -j 10
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user