meson, configure: move --with-pkgversion, CONFIG_STAMP to meson
The hash is now generated with a Python script. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
622d64fffe
commit
b0b4323e32
23
configure
vendored
23
configure
vendored
@ -306,7 +306,6 @@ qemu_suffix="qemu"
|
||||
softmmu="yes"
|
||||
linux_user=""
|
||||
bsd_user=""
|
||||
pkgversion=""
|
||||
pie=""
|
||||
coroutine=""
|
||||
plugins="$default_feature"
|
||||
@ -897,8 +896,6 @@ for opt do
|
||||
;;
|
||||
--enable-fdt=*) fdt="$optarg"
|
||||
;;
|
||||
--with-pkgversion=*) pkgversion="$optarg"
|
||||
;;
|
||||
--with-coroutine=*) coroutine="$optarg"
|
||||
;;
|
||||
--disable-vhost-net) vhost_net="no"
|
||||
@ -1136,7 +1133,6 @@ Advanced options (experts only):
|
||||
--firmwarepath=PATH search PATH for firmware files
|
||||
--efi-aarch64=PATH PATH of efi file to use for aarch64 VMs.
|
||||
--with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
|
||||
--with-pkgversion=VERS use specified string as sub-version of the package
|
||||
--without-default-features default all --enable-* options to "disabled"
|
||||
--without-default-devices do not include any device that is not needed to
|
||||
start the emulator (only use if you are including
|
||||
@ -1723,21 +1719,6 @@ if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# SHA command probe for modules
|
||||
if test "$modules" = yes; then
|
||||
shacmd_probe="sha1sum sha1 shasum"
|
||||
for c in $shacmd_probe; do
|
||||
if has $c; then
|
||||
shacmd="$c"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$shacmd" = ""; then
|
||||
error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# fdt probe
|
||||
|
||||
@ -2174,13 +2155,9 @@ if test "$static" = "yes" ; then
|
||||
echo "CONFIG_STATIC=y" >> $config_host_mak
|
||||
fi
|
||||
qemu_version=$(head $source_path/VERSION)
|
||||
echo "PKGVERSION=$pkgversion" >>$config_host_mak
|
||||
echo "SRC_PATH=$source_path" >> $config_host_mak
|
||||
echo "TARGET_DIRS=$target_list" >> $config_host_mak
|
||||
if test "$modules" = "yes"; then
|
||||
# $shacmd can generate a hash started with digit, which the compiler doesn't
|
||||
# like as an symbol. So prefix it with an underscore
|
||||
echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
|
||||
echo "CONFIG_MODULES=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
|
@ -35,7 +35,7 @@ if sphinx_build.found()
|
||||
endif
|
||||
|
||||
if build_docs
|
||||
SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]
|
||||
SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + get_option('pkgversion')]
|
||||
|
||||
man_pages = {
|
||||
'qemu-ga.8': (have_ga ? 'man8' : ''),
|
||||
|
10
meson.build
10
meson.build
@ -1628,6 +1628,14 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') /
|
||||
config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
|
||||
config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
|
||||
|
||||
if config_host.has_key('CONFIG_MODULES')
|
||||
config_host_data.set('CONFIG_STAMP', run_command(
|
||||
meson.current_source_dir() / 'scripts/qemu-stamp.py',
|
||||
meson.project_version(), get_option('pkgversion'), '--',
|
||||
meson.current_source_dir() / 'configure',
|
||||
capture: true, check: true).stdout().strip())
|
||||
endif
|
||||
|
||||
have_slirp_smbd = get_option('slirp_smbd') \
|
||||
.require(targetos != 'windows', error_message: 'Host smbd not supported on this platform.') \
|
||||
.allowed()
|
||||
@ -2799,7 +2807,7 @@ tracetool_depends = files(
|
||||
|
||||
qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
|
||||
meson.current_source_dir(),
|
||||
config_host['PKGVERSION'], meson.project_version()]
|
||||
get_option('pkgversion'), meson.project_version()]
|
||||
qemu_version = custom_target('qemu-version.h',
|
||||
output: 'qemu-version.h',
|
||||
command: qemu_version_cmd,
|
||||
|
@ -8,6 +8,8 @@ option('docdir', type : 'string', value : 'doc',
|
||||
description: 'Base directory for documentation installation (can be empty)')
|
||||
option('qemu_firmwarepath', type : 'string', value : '',
|
||||
description: 'search PATH for firmware files')
|
||||
option('pkgversion', type : 'string', value : '',
|
||||
description: 'use specified string as sub-version of the package')
|
||||
option('smbd', type : 'string', value : '',
|
||||
description: 'Path to smbd for slirp networking')
|
||||
option('sphinx_build', type : 'string', value : '',
|
||||
|
@ -36,6 +36,7 @@ SKIP_OPTIONS = {
|
||||
|
||||
OPTION_NAMES = {
|
||||
"malloc": "enable-malloc",
|
||||
"pkgversion": "with-pkgversion",
|
||||
"trace_backends": "enable-trace-backends",
|
||||
"trace_file": "with-trace-file",
|
||||
}
|
||||
|
@ -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 ;;
|
||||
|
24
scripts/qemu-stamp.py
Normal file
24
scripts/qemu-stamp.py
Normal file
@ -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())
|
Loading…
Reference in New Issue
Block a user