aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-08-21 11:21:16 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-08-21 06:30:06 -0400
commit0a01d76fc12a90de870074a34040cc05fbde3765 (patch)
tree98b45f36f70a99b9e143d83ccf37819818fab53c
parent1f0a1d8a51968444b10d12a2882bc3ba16b45866 (diff)
build-sys: add meson submodule
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--.gitmodules3
-rwxr-xr-xconfigure71
m---------meson0
-rwxr-xr-xscripts/archive-source.sh3
4 files changed, 69 insertions, 8 deletions
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 958a0a4201..a2c1159842 100755
--- a/configure
+++ b/configure
@@ -223,6 +223,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
}
@@ -963,6 +982,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"
@@ -1046,7 +1066,7 @@ for opt do
;;
--install=*) install="$optarg"
;;
- --python=*) python="$optarg"
+ --python=*) python="$optarg" ; explicit_python=yes
;;
--sphinx-build=*) sphinx_build="$optarg"
;;
@@ -2027,15 +2047,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
+Subproject d0c68dc11507a47b9b85de508e023d9590d6056
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() {