Re: [RFA/gdb-9-branch] Abort configure immediately if building GDB in tree

Sergio Durigan Junior
2020-01-31T21:40:07Z

On Friday, January 31 2020, I wrote:

> On Friday, January 31 2020, Eli Zaretskii wrote:
>
>>> From: Sergio Durigan Junior <sergiodj@redhat.com>
>>> Cc: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org, Tom Tromey <tom@tromey.com>
>>> Date: Thu, 30 Jan 2020 16:06:18 -0500
>>>
>>> $ ./src-release.sh -x gdb
>>> ==> Cleaning sources.
>>> ==> Making gdb-9.0.90.20200130/
>>> ==> configure --target=i386-pc-linux-gnu --disable-binutils
>>> --disable-gas --disable-gold --disable-gprof --disable-ld
>>> --enable-gdb --enable-libctf --enable-libdecnumber --enable-readline
>>> --enable-sim
>>> configure: error: GDB must be configured and built in a directory separate from its sources.
>>> ...
>>>
>>> I'm wondering what to do here. I think I found a hacky and ugly
>>> solution here, but I'm trying to see if there's a better approach.
>>
>> A special command-line switch to 'configure', to be used by
>> src-release.sh?
>
> A quick attempt here didn't really work. The script is able to finish
> the build and create a tarball, but for some reason the gdb directory is
> not configured/built.

OK, I think I have something that works. When 'configure' is invoked
with '--enable-src-release-build', a tarball is generated and, as far as
I have checked, contains the correct snapshot.

WDYT?

--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

diff --git a/ChangeLog b/ChangeLog
index 0bfe989885..de13206e2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-31 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * configure.ac: Don't abort the build if trying to build GDB in tree
+ _and_ invoking with '--enable-src-release-build'.
+ * configure: Regenerate.
+ * src-release.sh (do_proto_toplev): Invoke 'configure' using
+ '--enable-src-release-build'.
+
2020-01-17 Joel Brobecker <brobecker@adacore.com>

* configure.ac: Abort the build with an error if trying to build
diff --git a/configure b/configure
index 7168a4e90e..276f33fee3 100755
--- a/configure
+++ b/configure
@@ -2279,7 +2279,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu

-if test x"${enable_gdb}" != x"no"; then
+if test x"${enable_gdb}" != x"no" -a x"${enable_src_release_build}" != x"yes"; then
# For this branch, we do not support building GDB in-tree.
# Try to detect whether we are in this situation or not by
# searching for a couple of known files in the source directory.
diff --git a/configure.ac b/configure.ac
index e5ca1eaa57..cd0867dd76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,7 +33,7 @@ m4_include([config/isl.m4])
AC_INIT(move-if-change)
AC_DISABLE_OPTION_CHECKING

-if test x"${enable_gdb}" != x"no"; then
+if test x"${enable_gdb}" != x"no" -a x"${enable_src_release_build}" != x"yes"; then
# For this branch, we do not support building GDB in-tree.
# Try to detect whether we are in this situation or not by
# searching for a couple of known files in the source directory.
diff --git a/src-release.sh b/src-release.sh
index 275f0f24b5..68e824c749 100755
--- a/src-release.sh
+++ b/src-release.sh
@@ -99,8 +99,8 @@ do_proto_toplev()
*) disables="$disables --disable-$dir" ;;
esac
done
- echo "==> configure --target=i386-pc-linux-gnu $disables $enables"
- ./configure --target=i386-pc-linux-gnu $disables $enables
+ echo "==> configure --target=i386-pc-linux-gnu --enable-src-release-build=yes $disables $enables"
+ ./configure --target=i386-pc-linux-gnu --enable-src-release-build=yes $disables $enables
$MAKE configure-host configure-target \
ALL_GCC="" ALL_GCC_C="" ALL_GCC_CXX="" \
CC_FOR_TARGET="$CC" CXX_FOR_TARGET="$CXX"