[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 018/150] build-sys: add meson submodule
From: |
Paolo Bonzini |
Subject: |
[PATCH 018/150] build-sys: add meson submodule |
Date: |
Mon, 17 Aug 2020 16:35:11 +0200 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
.gitmodules | 3 ++
configure | 73 ++++++++++++++++++++++++++++++++++-----
meson | 1 +
scripts/archive-source.sh | 3 +-
4 files changed, 71 insertions(+), 9 deletions(-)
create mode 160000 meson
diff --git a/.gitmodules b/.gitmodules
index 9c0501a4d4..ce979398a8 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -58,3 +58,6 @@
[submodule "roms/qboot"]
path = roms/qboot
url = https://github.com/bonzini/qboot
+[submodule "meson"]
+ path = meson
+ url = https://github.com/mesonbuild/meson/
diff --git a/configure b/configure
index 994e9844aa..45111a619d 100755
--- a/configure
+++ b/configure
@@ -174,6 +174,25 @@ path_of() {
return 1
}
+version_ge () {
+ local_ver1=`echo $1 | tr . ' '`
+ local_ver2=`echo $2 | tr . ' '`
+ while true; do
+ set x $local_ver1
+ local_first=${2-0}
+ # shift 2 does nothing if there are less than 2 arguments
+ shift; shift
+ local_ver1=$*
+ set x $local_ver2
+ # the second argument finished, the first must be greater or equal
+ test $# = 1 && return 0
+ test $local_first -lt $2 && return 1
+ test $local_first -gt $2 && return 0
+ shift; shift
+ local_ver2=$*
+ done
+}
+
have_backend () {
echo "$trace_backends" | grep "$1" >/dev/null
}
@@ -506,7 +525,7 @@ fuzzing="no"
rng_none="no"
secret_keyring=""
libdaxctl=""
-meson=meson
+meson=""
supported_cpu="no"
supported_os="no"
@@ -916,6 +935,7 @@ fi
# python 2.x, but some distros have it as python 3.x, so
# we check that too
python=
+explicit_python=no
for binary in "${PYTHON-python3}" python
do
if has "$binary"
@@ -999,7 +1019,7 @@ for opt do
;;
--install=*) install="$optarg"
;;
- --python=*) python="$optarg"
+ --python=*) python="$optarg" ; explicit_python=yes
;;
--sphinx-build=*) sphinx_build="$optarg"
;;
@@ -1978,15 +1998,52 @@ python_version=$($python -c 'import sys;
print("%d.%d.%d" % (sys.version_info[0]
# Suppress writing compiled files
python="$python -B"
-if ! has "$meson"
-then
- error_exit "Meson not found. Use --meson=/path/to/meson"
+if test -z "$meson"; then
+ if test "$explicit_python" = no && has meson && version_ge "$(meson
--version)" 0.55.0; then
+ meson=meson
+ elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
+ meson=git
+ elif test -e "${source_path}/meson/meson.py" ; then
+ meson=internal
+ else
+ if test "$explicit_python" = yes; then
+ error_exit "--python requires using QEMU's embedded Meson
distribution, but it was not found."
+ else
+ error_exit "Meson not found. Use --meson=/path/to/meson"
+ fi
+ fi
+else
+ # Meson uses its own Python interpreter to invoke other Python scripts,
+ # but the user wants to use the one they specified with --python.
+ #
+ # We do not want to override the distro Python interpreter (and sometimes
+ # cannot: for example in Homebrew /usr/bin/meson is a bash script), so
+ # just require --meson=git|internal together with --python.
+ if test "$explicit_python" = yes; then
+ case "$meson" in
+ git | internal) ;;
+ *) error_exit "--python requires using QEMU's embedded Meson
distribution." ;;
+ esac
+ fi
fi
-meson=$(command -v $meson)
-if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then
- error_exit "Python setuptools not found"
+if test "$meson" = git; then
+ git_submodules="${git_submodules} meson"
fi
+if test "$git_update" = yes; then
+ (cd "${source_path}" && GIT="$git" "./scripts/git-submodule.sh" update
"$git_submodules")
+fi
+
+case "$meson" in
+ git | internal)
+ if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then
+ error_exit "Python setuptools not found"
+ fi
+ meson="$python ${source_path}/meson/meson.py"
+ ;;
+ *) meson=$(command -v meson) ;;
+esac
+
# Check that the C compiler works. Doing this here before testing
# the host CPU ensures that we had a valid CC to autodetect the
diff --git a/meson b/meson
new file mode 160000
index 0000000000..d0c68dc115
--- /dev/null
+++ b/meson
@@ -0,0 +1 @@
+Subproject commit d0c68dc11507a47b9b85de508e023d9590d60565
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index fb5d6b3918..c6169db69f 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -26,7 +26,8 @@ sub_file="${sub_tdir}/submodule.tar"
# independent of what the developer currently has initialized
# in their checkout, because the build environment is completely
# different to the host OS.
-submodules="dtc slirp ui/keycodemapdb tests/fp/berkeley-softfloat-3
tests/fp/berkeley-testfloat-3"
+submodules="dtc slirp meson ui/keycodemapdb"
+submodules="$submodules tests/fp/berkeley-softfloat-3
tests/fp/berkeley-testfloat-3"
sub_deinit=""
function cleanup() {
--
2.26.2
- [PATCH 009/150] tests/docker: add test script for static linux-user builds, (continued)
- [PATCH 009/150] tests/docker: add test script for static linux-user builds, Paolo Bonzini, 2020/08/17
- [PATCH 011/150] configure: do not include $(...) variables in config-host.mak, Paolo Bonzini, 2020/08/17
- [PATCH 010/150] nsis: use "make DESTDIR=" instead of "make prefix=", Paolo Bonzini, 2020/08/17
- [PATCH 012/150] configure: expand path variables for meson configure, Paolo Bonzini, 2020/08/17
- [PATCH 013/150] configure: prepare CFLAGS/CXXFLAGS/LDFLAGS for Meson, Paolo Bonzini, 2020/08/17
- [PATCH 014/150] tests/vm: include setuptools, Paolo Bonzini, 2020/08/17
- [PATCH 016/150] configure: generate Meson cross file, Paolo Bonzini, 2020/08/17
- [PATCH 017/150] build-sys hack: link with whole .fa archives, Paolo Bonzini, 2020/08/17
- [PATCH 015/150] configure: integrate Meson in the build system, Paolo Bonzini, 2020/08/17
- [PATCH 020/150] meson: enable pie, Paolo Bonzini, 2020/08/17
- [PATCH 018/150] build-sys: add meson submodule,
Paolo Bonzini <=
- [PATCH 022/150] meson: add sparse support, Paolo Bonzini, 2020/08/17
- [PATCH 019/150] meson: move summary to meson.build, Paolo Bonzini, 2020/08/17
- [PATCH 021/150] meson: use coverage option, Paolo Bonzini, 2020/08/17
- [PATCH 023/150] meson: add testsuite Makefile generator, Paolo Bonzini, 2020/08/17
- [PATCH 025/150] meson: add remaining generated tcg trace helpers, Paolo Bonzini, 2020/08/17
- [PATCH 027/150] contrib/libvhost-user: convert to Meson, Paolo Bonzini, 2020/08/17
- [PATCH 028/150] tools/virtiofsd: convert to Meson, Paolo Bonzini, 2020/08/17
- [PATCH 024/150] libqemuutil, qapi, trace: convert to meson, Paolo Bonzini, 2020/08/17
- [PATCH 026/150] meson: add version.o, Paolo Bonzini, 2020/08/17
- [PATCH 029/150] contrib/vhost-user-blk: convert to Meson, Paolo Bonzini, 2020/08/17