From nobody Tue Dec 16 11:13:06 2025 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=1597080635; cv=none; d=zohomail.com; s=zohoarc; b=DFQb+Albg2hG9aW62DLPDeLMM7xPxStlXOjPlcRUZAYVX1Em4qGUpV2W7/VZDpsXVDXKXwnwDBAdhkLbYfo5VMD5aawFBouxCvTsTN7ZlvkKQEYgns9BvFUyFrVt7Ao3l3/InXqsfbJxbTXxjFJ+NtL3IKFWDMsl3GE2NQd598Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597080635; 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=Fbtc3wi63iSDR/DRBtbuLdvl9oB7/ret4wblyCKVl0A=; b=TqLtQRTwiUqFudjL45jWcvlNzoVwebPx2/yKTz2+CXML9+lJqYqp2yRlYR/SczCZ1Zrhw1kxtNNx9HPeeG8ux57qnnioCn+cOYqDbZLBVRtls4m4aOFCKH/Dy2NCw9rshNIL9RHu1eQk18JtI9Phk3CHTZuKVFqWzsmEqharlRk= 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 1597080635681188.36963560946845; Mon, 10 Aug 2020 10:30:35 -0700 (PDT) Received: from localhost ([::1]:49936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5Bd4-0006n4-AT for importer@patchew.org; Mon, 10 Aug 2020 13:30:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5BJf-0007sE-LZ for qemu-devel@nongnu.org; Mon, 10 Aug 2020 13:10:31 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:20364 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 1k5BJc-0002sM-JN for qemu-devel@nongnu.org; Mon, 10 Aug 2020 13:10:31 -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-207-W8hyK0FtNSur3s5S4pjSGA-1; Mon, 10 Aug 2020 13:10:25 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CCC0F8005B0 for ; Mon, 10 Aug 2020 17:10:24 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA26B5F1EA; Mon, 10 Aug 2020 17:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597079427; 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=Fbtc3wi63iSDR/DRBtbuLdvl9oB7/ret4wblyCKVl0A=; b=YRCeHyGz/D+HlyHzZa+wLWu8rGPMvvFNYMIZilwdtK7kUQtmFn0pOtI+EJiu7vz59jig8A IuzJkSiB/yzZQD6M//+tjtowzbf5K1zLXBavoQQ9k8ES66xjFB0BPIB9rbPKQDWA/af8/A E2v3guyfmNcjsefJnJ2Y4XAhCUdXE80= X-MC-Unique: W8hyK0FtNSur3s5S4pjSGA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 045/147] meson: generate qemu-version.h Date: Mon, 10 Aug 2020 19:07:23 +0200 Message-Id: <1597079345-42801-46-git-send-email-pbonzini@redhat.com> In-Reply-To: <1597079345-42801-1-git-send-email-pbonzini@redhat.com> References: <1597079345-42801-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 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=207.211.31.81; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/10 04:13:00 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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 --- Makefile | 27 +-------------------------- meson.build | 14 ++++++++++++-- scripts/qemu-version.sh | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 28 deletions(-) create mode 100755 scripts/qemu-version.sh diff --git a/Makefile b/Makefile index d5e43a0..f995b23 100644 --- a/Makefile +++ b/Makefile @@ -105,21 +105,7 @@ include $(SRC_PATH)/rules.mak # lor is defined in rules.mak CONFIG_BLOCK :=3D $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)) =20 -# Create QEMU_PKGVERSION and FULL_VERSION strings -# If PKGVERSION is set, use that; otherwise get version and -dirty status = from git -QEMU_PKGVERSION :=3D $(if $(PKGVERSION),$(PKGVERSION),$(shell \ - cd $(SRC_PATH); \ - if test -e .git; then \ - git describe --match 'v*' 2>/dev/null | tr -d '\n'; \ - if ! git diff-index --quiet HEAD &>/dev/null; then \ - echo "-dirty"; \ - fi; \ - fi)) - -# Either "version (pkgversion)", or just "version" if pkgversion not set -FULL_VERSION :=3D $(if $(QEMU_PKGVERSION),$(VERSION) ($(QEMU_PKGVERSION)),= $(VERSION)) - -generated-files-y =3D qemu-version.h config-host.h qemu-options.def +generated-files-y =3D config-host.h qemu-options.def =20 generated-files-y +=3D module_block.h =20 @@ -259,17 +245,6 @@ include $(SRC_PATH)/tests/Makefile.include =20 all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-= all modules =20 -qemu-version.h: FORCE - $(call quiet-command, \ - (printf '#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \ - printf '#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \ - ) > $@.tmp) - $(call quiet-command, if ! cmp -s $@ $@.tmp; then \ - mv $@.tmp $@; \ - else \ - rm $@.tmp; \ - fi) - config-host.h: config-host.h-timestamp config-host.h-timestamp: config-host.mak qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool diff --git a/meson.build b/meson.build index 4ea7fbb..549d81c 100644 --- a/meson.build +++ b/meson.build @@ -137,6 +137,7 @@ have_block =3D have_system or have_tools =20 # Generators =20 +genh =3D [] qapi_gen =3D find_program('scripts/qapi-gen.py') qapi_gen_depends =3D [ meson.source_root() / 'scripts/qapi/__init__.py', meson.source_root() / 'scripts/qapi/commands.py', @@ -162,6 +163,17 @@ tracetool =3D [ '--backend=3D' + config_host['TRACE_BACKENDS'] ] =20 +qemu_version_cmd =3D [find_program('scripts/qemu-version.sh'), + meson.current_source_dir(), + config_host['PKGVERSION'], config_host['VERSION']] +qemu_version =3D custom_target('qemu-version.h', + output: 'qemu-version.h', + command: qemu_version_cmd, + capture: true, + build_by_default: true, + build_always_stale: true) +genh +=3D qemu_version + # Collect sourcesets. =20 util_ss =3D ss.source_set() @@ -262,8 +274,6 @@ trace_events_subdirs +=3D [ 'util', ] =20 -genh =3D [] - subdir('qapi') subdir('qobject') subdir('stubs') diff --git a/scripts/qemu-version.sh b/scripts/qemu-version.sh new file mode 100755 index 0000000..4847385 --- /dev/null +++ b/scripts/qemu-version.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +set -eu + +dir=3D"$1" +pkgversion=3D"$2" +version=3D"$3" + +if [ -z "$pkgversion"]; then + cd "$dir" + if [ -e .git ]; then + pkgversion=3D$(git describe --match 'v*' --dirty | echo "") + fi +fi + +if [ -n "$pkgversion" ]; then + fullversion=3D"$version ($pkgversion)" +else + fullversion=3D"$version" +fi + +cat <