From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Stefan Hajnoczi" <stefanha@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH] configure: add support for psuedo-"in source tree" builds
Date: Thu, 20 Aug 2020 17:55:44 +0100 [thread overview]
Message-ID: <20200820165543.215372-1-berrange@redhat.com> (raw)
Meson requires the build dir to be separate from the source tree. Many
people are used to just running "./configure && make" though and the
meson conversion breaks that.
This introduces some backcompat support to make it appear as if an
"in source tree" build is being done, but with the the results in the
"build/" directory. This allows "./configure && make" to work as it
did historically, albeit with the output binaries staying under build/.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
This is a simple integration of Eric's proposal from
https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg07290.html
with a bit of configure magic. It is enough to enable
./configure
make
make check
I've not tested it beyond that. Note it blows away the "build/"
dir each time ./configure is run so it is pristine each time.
We could optionally symlink binaries from build/ into $PWD
if poeople think that is important, eg by changing GNUmakefile
to have:
recurse: all
for bin in `find build -maxdepth 1 -type f -executable | grep -v -E '(ninjatool|config.status)'`; \
do \
ln -f -s $$bin . ; \
done
and some cleanup logic to purge the symlinks for "make clean"
This goes on top of Paolo's most recent meson port v175 posting,
or whatever number it is upto now :-)
.gitignore | 2 ++
configure | 40 ++++++++++++++++++++++++++++++++--------
2 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/.gitignore b/.gitignore
index 92311284ef..4ccb9ed975 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+/GNUmakefile
+/build/
/.doctrees
/config-devices.*
/config-all-devices.*
diff --git a/configure b/configure
index cc5f58f31a..a5c88ad1ac 100755
--- a/configure
+++ b/configure
@@ -11,6 +11,38 @@ unset CLICOLOR_FORCE GREP_OPTIONS
# Don't allow CCACHE, if present, to use cached results of compile tests!
export CCACHE_RECACHE=yes
+source_path=$(cd "$(dirname -- "$0")"; pwd)
+
+if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
+then
+ error_exit "main directory cannot contain spaces nor colons"
+fi
+
+if test "$PWD" == "$source_path"
+then
+ echo "Using './build' as the directory for build output"
+ rm -rf build
+ mkdir -p build
+ cat > GNUmakefile <<EOF
+
+ifeq (\$(MAKECMDGOALS),)
+recurse: all
+endif
+
+.NOTPARALLEL: %
+%: force
+ @echo 'changing dir to build for \$(MAKE) "\$(MAKECMDGOALS)"...'
+ @\$(MAKE) -C build -f Makefile \$(MAKECMDGOALS)
+ if test "\$(MAKECMDGOALS)" = "distclean" ; then rm -rf build ; fi
+force: ;
+.PHONY: force
+GNUmakefile: ;
+
+EOF
+ cd build
+ exec $source_path/configure "$@"
+fi
+
# Temporary directory used for files created while
# configure runs. Since it is in the build directory
# we can safely blow away any previous version of it
@@ -297,14 +329,6 @@ ld_has() {
$ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
}
-# make source path absolute
-source_path=$(cd "$(dirname -- "$0")"; pwd)
-
-if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
-then
- error_exit "main directory cannot contain spaces nor colons"
-fi
-
# default parameters
cpu=""
iasl="iasl"
--
2.26.2
next reply other threads:[~2020-08-20 16:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 16:55 Daniel P. Berrangé [this message]
2020-08-20 17:10 ` [PATCH] configure: add support for psuedo-"in source tree" builds Peter Maydell
2020-08-20 17:12 ` Daniel P. Berrangé
2020-08-20 17:14 ` Peter Maydell
2020-08-20 17:18 ` Philippe Mathieu-Daudé
2020-08-20 17:42 ` Eric Blake
2020-08-20 17:54 ` Philippe Mathieu-Daudé
2020-08-20 18:26 ` Paolo Bonzini
2020-08-21 9:15 ` Daniel P. Berrangé
2020-08-21 9:58 ` Kevin Wolf
2020-08-21 10:14 ` Daniel P. Berrangé
2020-08-21 10:24 ` Kevin Wolf
2020-08-21 10:28 ` Paolo Bonzini
2020-08-20 18:15 ` Peter Maydell
2020-08-21 9:19 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200820165543.215372-1-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).