From nobody Tue Feb 10 01:34:52 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597396887; cv=none; d=zohomail.com; s=zohoarc; b=jmhRfCP7ZCO+FQyPMlSY8fIFBb4W7y28zOxoar/Ddu4Ny3HeYAxLH3PHSJpTh6qK9R1PI3kd5r/1fXor5qNpQXpLcjjZxpKeaMnkweDdmc2A0cqDvzJLVu9lXXdTP7kACb4vn3Ra38OY0pzYmP7iTUrtX3caB6kH55nNoBiJCYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597396887; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=A0PyUK3LwFNOLZuQB716DGk+9XTGNcESv8Tm8i3AYDo=; b=PvWv+B4tSEuG+/uvbkr6Rn5uf1E1PJdoS1tmhz5YjkqSTleoqlW0Kfrbva/Ewz2YeVfjRO1pWjnxJXAgSnpP0b0iKXAOSQd5nzFgyLWpWgy8F4rpB9iJlK96lmKJG2V+sCuhqvW0d6IuqVpkJo+9TRvPVhxuV1lubGsQCOZcs+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597396887676891.8529691450616; Fri, 14 Aug 2020 02:21:27 -0700 (PDT) Received: from localhost ([::1]:59824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Vtu-0000y3-CK for importer@patchew.org; Fri, 14 Aug 2020 05:21:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Vma-00059J-Gy for qemu-devel@nongnu.org; Fri, 14 Aug 2020 05:13:52 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:58042 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6VmT-0002qb-Oh for qemu-devel@nongnu.org; Fri, 14 Aug 2020 05:13:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-Dres8EbvNnii7IYakqcC_A-1; Fri, 14 Aug 2020 05:13:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 78A701015DBC for ; Fri, 14 Aug 2020 09:13:41 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A1E2709D2; Fri, 14 Aug 2020 09:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597396425; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A0PyUK3LwFNOLZuQB716DGk+9XTGNcESv8Tm8i3AYDo=; b=AG9PL+5Y/puCBPwdAJj9fUr+gj2DfodWxhIHW2xr3/8gy++5/oRuX0QzIZCeVYBn9jQkIM YQlGd5Ogrs8FbfumJ7vgSBPW3vzcBoouiSdY76yuB4eir5wVzvfi9G8zaz+GGco2nv7Em5 DlJ13u1srM9ccXfRsQ84dgXCa6F85dM= X-MC-Unique: Dres8EbvNnii7IYakqcC_A-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 019/150] build-sys: add meson submodule Date: Fri, 14 Aug 2020 05:11:15 -0400 Message-Id: <20200814091326.16173-20-pbonzini@redhat.com> In-Reply-To: <20200814091326.16173-1-pbonzini@redhat.com> References: <20200814091326.16173-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/14 01:57:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- .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 =3D roms/qboot url =3D https://github.com/bonzini/qboot +[submodule "meson"] + path =3D meson + url =3D https://github.com/mesonbuild/meson/ diff --git a/configure b/configure index c9f36153dd..bbbb213d8d 100755 --- a/configure +++ b/configure @@ -174,6 +174,25 @@ path_of() { return 1 } =20 +version_ge () { + local_ver1=3D`echo $1 | tr . ' '` + local_ver2=3D`echo $2 | tr . ' '` + while true; do + set x $local_ver1 + local_first=3D${2-0} + # shift 2 does nothing if there are less than 2 arguments + shift; shift + local_ver1=3D$* + set x $local_ver2 + # the second argument finished, the first must be greater or equal + test $# =3D 1 && return 0 + test $local_first -lt $2 && return 1 + test $local_first -gt $2 && return 0 + shift; shift + local_ver2=3D$* + done +} + have_backend () { echo "$trace_backends" | grep "$1" >/dev/null } @@ -506,7 +525,7 @@ fuzzing=3D"no" rng_none=3D"no" secret_keyring=3D"" libdaxctl=3D"" -meson=3Dmeson +meson=3D"" =20 supported_cpu=3D"no" supported_os=3D"no" @@ -916,6 +935,7 @@ fi # python 2.x, but some distros have it as python 3.x, so # we check that too python=3D +explicit_python=3Dno for binary in "${PYTHON-python3}" python do if has "$binary" @@ -999,7 +1019,7 @@ for opt do ;; --install=3D*) install=3D"$optarg" ;; - --python=3D*) python=3D"$optarg" + --python=3D*) python=3D"$optarg" ; explicit_python=3Dyes ;; --sphinx-build=3D*) sphinx_build=3D"$optarg" ;; @@ -1978,15 +1998,52 @@ python_version=3D$($python -c 'import sys; print("%= d.%d.%d" % (sys.version_info[0] # Suppress writing compiled files python=3D"$python -B" =20 -if ! has "$meson" -then - error_exit "Meson not found. Use --meson=3D/path/to/meson" +if test -z "$meson"; then + if test "$explicit_python" =3D no && has meson && version_ge "$(meson = --version)" 0.55.0; then + meson=3Dmeson + elif test -e "${source_path}/.git" && test $git_update =3D 'yes' ; then + meson=3Dgit + elif test -e "${source_path}/meson/meson.py" ; then + meson=3Dinternal + else + if test "$explicit_python" =3D yes; then + error_exit "--python requires using QEMU's embedded Meson dist= ribution, but it was not found." + else + error_exit "Meson not found. Use --meson=3D/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 someti= mes + # cannot: for example in Homebrew /usr/bin/meson is a bash script), so + # just require --meson=3Dgit|internal together with --python. + if test "$explicit_python" =3D yes; then + case "$meson" in + git | internal) ;; + *) error_exit "--python requires using QEMU's embedded Meson d= istribution." ;; + esac + fi fi -meson=3D$(command -v $meson) =20 -if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then - error_exit "Python setuptools not found" +if test "$meson" =3D git; then + git_submodules=3D"${git_submodules} meson" fi +if test "$git_update" =3D yes; then + (cd "${source_path}" && GIT=3D"$git" "./scripts/git-submodule.sh" upda= te "$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=3D"$python ${source_path}/meson/meson.py" + ;; + *) meson=3D$(command -v meson) ;; +esac + =20 # 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=3D"${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=3D"dtc slirp ui/keycodemapdb tests/fp/berkeley-softfloat-3 test= s/fp/berkeley-testfloat-3" +submodules=3D"dtc slirp meson ui/keycodemapdb" +submodules=3D"$submodules tests/fp/berkeley-softfloat-3 tests/fp/berkeley-= testfloat-3" sub_deinit=3D"" =20 function cleanup() { --=20 2.26.2