aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/meson-buildoptions.py1
-rw-r--r--scripts/meson-buildoptions.sh3
-rw-r--r--scripts/qemu-stamp.py24
3 files changed, 28 insertions, 0 deletions
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 3e540e8bb3..0f9603a7f6 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -36,6 +36,7 @@ SKIP_OPTIONS = {
OPTION_NAMES = {
"malloc": "enable-malloc",
+ "pkgversion": "with-pkgversion",
"trace_backends": "enable-trace-backends",
"trace_file": "with-trace-file",
}
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index d5cba2638a..3a86dd7271 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -44,6 +44,8 @@ meson_options_help() {
printf "%s\n" ' --sphinx-build=VALUE Use specified sphinx-build for building document'
printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string'
printf "%s\n" ' [NORMAL]'
+ printf "%s\n" ' --with-pkgversion=VALUE use specified string as sub-version of the'
+ printf "%s\n" ' package'
printf "%s\n" ' --with-trace-file=VALUE Trace file prefix for simple backend [trace]'
printf "%s\n" ''
printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
@@ -309,6 +311,7 @@ _meson_option_parse() {
--disable-pa) printf "%s" -Dpa=disabled ;;
--enable-parallels) printf "%s" -Dparallels=enabled ;;
--disable-parallels) printf "%s" -Dparallels=disabled ;;
+ --with-pkgversion=*) quote_sh "-Dpkgversion=$2" ;;
--enable-png) printf "%s" -Dpng=enabled ;;
--disable-png) printf "%s" -Dpng=disabled ;;
--enable-profiler) printf "%s" -Dprofiler=true ;;
diff --git a/scripts/qemu-stamp.py b/scripts/qemu-stamp.py
new file mode 100644
index 0000000000..7beeeb07ed
--- /dev/null
+++ b/scripts/qemu-stamp.py
@@ -0,0 +1,24 @@
+#! /usr/bin/env python3
+
+# Usage: scripts/qemu-stamp.py STRING1 STRING2... -- FILE1 FILE2...
+import hashlib
+import os
+import sys
+
+sha = hashlib.sha1()
+is_file = False
+for arg in sys.argv[1:]:
+ if arg == '--':
+ is_file = True
+ continue
+ if is_file:
+ with open(arg, 'rb') as f:
+ for chunk in iter(lambda: f.read(65536), b''):
+ sha.update(chunk)
+ else:
+ sha.update(os.fsencode(arg))
+ sha.update(b'\n')
+
+# The hash can start with a digit, which the compiler doesn't
+# like as an symbol. So prefix it with an underscore
+print("_" + sha.hexdigest())