aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-07-15 17:10:19 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-08-21 06:30:14 -0400
commit2c273f32d3489a54010c70b4065222ff4dda3f49 (patch)
treeb7a6db93e402a8acd9baddf0e180fa83123cdb10 /scripts
parent2d78b56e7abe327fc411d4c96ce0b3cffc0d9282 (diff)
meson: generate qemu-version.h
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/qemu-version.sh25
1 files changed, 25 insertions, 0 deletions
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