[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 028/132] meson: generate qemu-version.h
From: |
Paolo Bonzini |
Subject: |
[PATCH 028/132] meson: generate qemu-version.h |
Date: |
Thu, 12 Dec 2019 13:51:12 +0100 |
From: Marc-André Lureau <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
Makefile | 27 +--------------------------
meson.build | 10 ++++++++++
scripts/qemu-version.sh | 25 +++++++++++++++++++++++++
3 files changed, 36 insertions(+), 26 deletions(-)
create mode 100755 scripts/qemu-version.sh
diff --git a/Makefile b/Makefile
index d4ebbbf..5d0be7b 100644
--- a/Makefile
+++ b/Makefile
@@ -96,21 +96,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
@@ -233,17 +219,6 @@ include $(SRC_PATH)/tests/Makefile.include
all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all
modules $(vhost-user-json-y)
-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 8a4a90b..6d4bf27 100644
--- a/meson.build
+++ b/meson.build
@@ -18,6 +18,16 @@
add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
add_project_arguments(config_host['QEMU_INCLUDES'].split(),
language: ['c', 'cpp'])
+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',
+ output: 'qemu-version.h',
+ command: qemu_version_cmd,
+ capture: true,
+ build_by_default: true,
+ build_always_stale: true)
+
configure_file(input: files('scripts/ninjatool.py'),
output: 'ninjatool',
configuration: config_host)
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="$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
--
1.8.3.1
- [PATCH 021/132] meson: convert vss-win32, (continued)
- [PATCH 021/132] meson: convert vss-win32, Paolo Bonzini, 2019/12/12
- [PATCH 020/132] meson: convert qemu-ga, Paolo Bonzini, 2019/12/12
- [PATCH 022/132] meson: add msi generation, Paolo Bonzini, 2019/12/12
- [PATCH 023/132] meson: add qemu-bridge-helper, Paolo Bonzini, 2019/12/12
- [PATCH 024/132] meson: add qemu-keymap, Paolo Bonzini, 2019/12/12
- [PATCH 025/132] meson: add qemu-edid, Paolo Bonzini, 2019/12/12
- [PATCH 009/132] libqemuutil: convert to meson, Paolo Bonzini, 2019/12/12
- [PATCH 027/132] meson: keymap-gen, Paolo Bonzini, 2019/12/12
- [PATCH 029/132] meson: generate shader headers, Paolo Bonzini, 2019/12/12
- [PATCH 026/132] meson: add virtfs-proxy-helper, Paolo Bonzini, 2019/12/12
- [PATCH 028/132] meson: generate qemu-version.h,
Paolo Bonzini <=
- [PATCH 030/132] meson: generate hxtool files, Paolo Bonzini, 2019/12/12
- [PATCH 031/132] meson: configure 50-qemu-gpu.json, Paolo Bonzini, 2019/12/12
- [PATCH 032/132] meson: uncompress edk2 bios, Paolo Bonzini, 2019/12/12
- [PATCH 033/132] build-sys hack: link with whole .fa archives, Paolo Bonzini, 2019/12/12
- [PATCH 035/132] meson: convert authz directory to Meson, Paolo Bonzini, 2019/12/12
- [PATCH 034/132] meson: convert qom directory to Meson, Paolo Bonzini, 2019/12/12
- [PATCH 036/132] meson: convert crypto directory to Meson, Paolo Bonzini, 2019/12/12
- [PATCH 037/132] meson: convert io directory to Meson, Paolo Bonzini, 2019/12/12
- [PATCH 039/132] meson: add macos dependencies, Paolo Bonzini, 2019/12/12
- [PATCH 038/132] meson: infrastructure for building emulators, Paolo Bonzini, 2019/12/12