[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 049/150] meson: generate qemu-version.h
From: |
Paolo Bonzini |
Subject: |
[PATCH 049/150] meson: generate qemu-version.h |
Date: |
Fri, 14 Aug 2020 05:11:45 -0400 |
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>
---
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 5fbf5e4bbd..9abf7be598 100644
--- a/Makefile
+++ b/Makefile
@@ -112,21 +112,7 @@ include $(SRC_PATH)/rules.mak
# lor is defined in rules.mak
CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
-# Create QEMU_PKGVERSION and FULL_VERSION strings
-# If PKGVERSION is set, use that; otherwise get version and -dirty status from
git
-QEMU_PKGVERSION := $(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 := $(if $(QEMU_PKGVERSION),$(VERSION)
($(QEMU_PKGVERSION)),$(VERSION))
-
-generated-files-y = qemu-version.h config-host.h qemu-options.def
+generated-files-y = config-host.h qemu-options.def
generated-files-y += module_block.h
@@ -266,17 +252,6 @@ include $(SRC_PATH)/tests/Makefile.include
all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all
modules
-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 01ac61c51f..56b3dd2979 100644
--- a/meson.build
+++ b/meson.build
@@ -154,6 +154,7 @@ have_block = have_system or have_tools
# Generators
+genh = []
qapi_gen = find_program('scripts/qapi-gen.py')
qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
meson.source_root() / 'scripts/qapi/commands.py',
@@ -179,6 +180,17 @@ tracetool = [
'--backend=' + config_host['TRACE_BACKENDS']
]
+qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
+ meson.current_source_dir(),
+ config_host['PKGVERSION'], config_host['VERSION']]
+qemu_version = custom_target('qemu-version.h',
+ output: 'qemu-version.h',
+ command: qemu_version_cmd,
+ capture: true,
+ build_by_default: true,
+ build_always_stale: true)
+genh += qemu_version
+
# Collect sourcesets.
util_ss = ss.source_set()
@@ -279,8 +291,6 @@ trace_events_subdirs += [
'util',
]
-genh = []
-
subdir('qapi')
subdir('qobject')
subdir('stubs')
diff --git a/scripts/qemu-version.sh b/scripts/qemu-version.sh
new file mode 100755
index 0000000000..4847385e42
--- /dev/null
+++ b/scripts/qemu-version.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -eu
+
+dir="$1"
+pkgversion="$2"
+version="$3"
+
+if [ -z "$pkgversion"]; then
+ cd "$dir"
+ if [ -e .git ]; then
+ pkgversion=$(git describe --match 'v*' --dirty | echo "")
+ fi
+fi
+
+if [ -n "$pkgversion" ]; then
+ fullversion="$version ($pkgversion)"
+else
+ fullversion="$version"
+fi
+
+cat <<EOF
+#define QEMU_PKGVERSION "$pkgversion"
+#define QEMU_FULL_VERSION "$fullversion"
+EOF
--
2.26.2
- [PATCH 038/150] meson: add macos dependencies, (continued)
- [PATCH 038/150] meson: add macos dependencies, Paolo Bonzini, 2020/08/14
- [PATCH 033/150] contrib/rdmacm-mux: convert to Meson, Paolo Bonzini, 2020/08/14
- [PATCH 034/150] contrib/vhost-user-input: convert to meson, Paolo Bonzini, 2020/08/14
- [PATCH 036/150] contrib/ivshmem: convert to meson, Paolo Bonzini, 2020/08/14
- [PATCH 039/150] meson: add solaris and Haiku libraries, Paolo Bonzini, 2020/08/14
- [PATCH 043/150] meson: convert dummy Windows qga/qemu-ga target, Paolo Bonzini, 2020/08/14
- [PATCH 048/150] meson: keymap-gen, Paolo Bonzini, 2020/08/14
- [PATCH 046/150] meson: add qemu-edid, Paolo Bonzini, 2020/08/14
- [PATCH 044/150] meson: add qemu-bridge-helper, Paolo Bonzini, 2020/08/14
- [PATCH 047/150] meson: add virtfs-proxy-helper, Paolo Bonzini, 2020/08/14
- [PATCH 049/150] meson: generate qemu-version.h,
Paolo Bonzini <=
- [PATCH 035/150] contrib/vhost-user-gpu: convert to meson, Paolo Bonzini, 2020/08/14
- [PATCH 042/150] meson: add msi generation, Paolo Bonzini, 2020/08/14
- [PATCH 040/150] meson: convert qemu-ga, Paolo Bonzini, 2020/08/14
- [PATCH 050/150] meson: generate shader headers, Paolo Bonzini, 2020/08/14
- [PATCH 052/150] meson: handle edk2 bios and descriptors, Paolo Bonzini, 2020/08/14
- [PATCH 045/150] meson: add qemu-keymap, Paolo Bonzini, 2020/08/14
- [PATCH 053/150] meson: convert check-decodetree, Paolo Bonzini, 2020/08/14
- [PATCH 054/150] meson: convert tests/fp and check-softfloat, Paolo Bonzini, 2020/08/14
- [PATCH 059/150] meson: convert io directory to Meson, Paolo Bonzini, 2020/08/14
- [PATCH 057/150] meson: convert authz directory to Meson, Paolo Bonzini, 2020/08/14