From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH 09/30] meson: use prefer_static option
Date: Fri, 9 Dec 2022 12:23:48 +0100 [thread overview]
Message-ID: <20221209112409.184703-10-pbonzini@redhat.com> (raw)
In-Reply-To: <20221209112409.184703-1-pbonzini@redhat.com>
The option is new in Meson 0.63 and removes the need to pass "static:
true" to all dependency and find_library invocation. Actually cleaning
up the invocations is left for a separate patch.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 4 +---
docs/devel/build-system.rst | 3 +--
meson.build | 11 ++++-------
qga/meson.build | 2 +-
4 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/configure b/configure
index 411dfe977958..6efc2055ce09 100755
--- a/configure
+++ b/configure
@@ -2315,9 +2315,6 @@ fi
if test "$solaris" = "yes" ; then
echo "CONFIG_SOLARIS=y" >> $config_host_mak
fi
-if test "$static" = "yes" ; then
- echo "CONFIG_STATIC=y" >> $config_host_mak
-fi
echo "SRC_PATH=$source_path" >> $config_host_mak
echo "TARGET_DIRS=$target_list" >> $config_host_mak
if test "$modules" = "yes"; then
@@ -2540,6 +2537,7 @@ if test "$skip_meson" = no; then
# Built-in options
test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
test "$default_feature" = no && meson_option_add -Dauto_features=disabled
+ test "$static" = yes && meson_option_add -Dprefer_static=true
test "$pie" = no && meson_option_add -Db_pie=false
test "$werror" = yes && meson_option_add -Dwerror=true
diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst
index 189472174340..9db18aff159e 100644
--- a/docs/devel/build-system.rst
+++ b/docs/devel/build-system.rst
@@ -311,8 +311,7 @@ dependency will be used::
sdl_image = not_found
if not get_option('sdl_image').auto() or have_system
sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
- method: 'pkg-config',
- static: enable_static)
+ method: 'pkg-config')
endif
This avoids warnings on static builds of user-mode emulators, for example.
diff --git a/meson.build b/meson.build
index 19b023985325..dced840bfbee 100644
--- a/meson.build
+++ b/meson.build
@@ -18,10 +18,7 @@ sh = find_program('sh')
cc = meson.get_compiler('c')
config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
enable_modules = 'CONFIG_MODULES' in config_host
-enable_static = 'CONFIG_STATIC' in config_host
-
-# Allow both shared and static libraries unless --enable-static
-static_kwargs = enable_static ? {'static': true} : {}
+static_kwargs = {}
# Temporary directory used for files created while
# configure runs. Since it is in the build directory
@@ -183,7 +180,7 @@ qemu_cflags = config_host['QEMU_CFLAGS'].split()
qemu_objcflags = config_host['QEMU_OBJCFLAGS'].split()
qemu_ldflags = config_host['QEMU_LDFLAGS'].split()
-if enable_static
+if get_option('prefer_static')
qemu_ldflags += get_option('b_pie') ? '-static-pie' : '-static'
endif
@@ -830,7 +827,7 @@ if targetos == 'linux' and have_tools and get_option('mpath').allowed()
kwargs: static_kwargs)
if libmpathpersist.found()
mpathlibs += libmpathpersist
- if enable_static
+ if get_option('prefer_static')
mpathlibs += cc.find_library('devmapper',
required: get_option('mpath'),
kwargs: static_kwargs)
@@ -1214,7 +1211,7 @@ if not gnutls_crypto.found()
# Debian has removed -lgpg-error from libgcrypt-config
# as it "spreads unnecessary dependencies" which in
# turn breaks static builds...
- if gcrypt.found() and enable_static
+ if gcrypt.found() and get_option('prefer_static')
gcrypt = declare_dependency(dependencies: [
gcrypt,
cc.find_library('gpg-error', required: true, kwargs: static_kwargs)])
diff --git a/qga/meson.build b/qga/meson.build
index 3cfb9166e5d8..ec67326b25f3 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -22,7 +22,7 @@ have_qga_vss = get_option('qga_vss') \
Then run configure with: --extra-cxxflags="-isystem /path/to/vss/inc/win2003"''') \
.require(midl.found() or widl.found(),
error_message: 'VSS support requires midl or widl') \
- .require(not enable_static,
+ .require(not get_option('prefer_static'),
error_message: 'VSS support requires dynamic linking with GLib') \
.allowed()
--
2.38.1
next prev parent reply other threads:[~2022-12-09 11:26 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 11:23 [PATCH for-8.0 00/30] Meson changes for QEMU 8.0 Paolo Bonzini
2022-12-09 11:23 ` [PATCH 01/30] configure: remove useless write_c_skeleton Paolo Bonzini
2022-12-09 11:38 ` Peter Maydell
2022-12-16 14:33 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 02/30] configure: remove dead function Paolo Bonzini
2022-12-09 11:36 ` Peter Maydell
2022-12-16 14:33 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 03/30] configure: remove useless test Paolo Bonzini
2022-12-09 11:34 ` Peter Maydell
2022-12-09 16:35 ` Paolo Bonzini
2022-12-16 14:35 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 04/30] configure: preserve qemu-ga variables Paolo Bonzini
2022-12-12 7:52 ` Marc-André Lureau
2022-12-16 14:39 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 05/30] configure: remove backwards-compatibility and obsolete options Paolo Bonzini
2022-12-12 7:57 ` Marc-André Lureau
2022-12-16 14:40 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 06/30] meson: tweak hardening options for Windows Paolo Bonzini
2022-12-12 8:18 ` Marc-André Lureau
2022-12-12 8:52 ` Paolo Bonzini
2022-12-16 14:42 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 07/30] meson: support meson 0.64 -Doptimization=plain Paolo Bonzini
2022-12-12 8:21 ` Marc-André Lureau
2022-12-16 14:53 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 08/30] meson: require 0.63.0 Paolo Bonzini
2022-12-09 13:25 ` Thomas Huth
2022-12-09 11:23 ` Paolo Bonzini [this message]
2022-12-12 8:29 ` [PATCH 09/30] meson: use prefer_static option Marc-André Lureau
2022-12-16 14:58 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 10/30] meson: remove static_kwargs Paolo Bonzini
2022-12-12 8:32 ` Marc-André Lureau
2022-12-16 14:59 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 11/30] meson: cleanup dummy-cpus.c rules Paolo Bonzini
2022-12-12 8:39 ` Marc-André Lureau
2022-12-16 14:59 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 12/30] modinfo: lookup compile_commands.json by object Paolo Bonzini
2022-12-12 8:47 ` Marc-André Lureau
2022-12-09 11:23 ` [PATCH 13/30] configure: remove backwards-compatibility code Paolo Bonzini
2022-12-12 8:55 ` Marc-André Lureau
2022-12-09 11:23 ` [PATCH 14/30] configure: test all warnings Paolo Bonzini
2022-12-09 12:45 ` Philippe Mathieu-Daudé
2022-12-16 15:01 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 15/30] meson: cleanup compiler detection Paolo Bonzini
2022-12-12 9:04 ` Marc-André Lureau
2022-12-16 15:03 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 16/30] build: move glib detection and workarounds to meson Paolo Bonzini
2022-12-09 12:50 ` Philippe Mathieu-Daudé
2022-12-09 11:23 ` [PATCH 17/30] configure: remove pkg-config functions Paolo Bonzini
2022-12-12 9:05 ` Marc-André Lureau
2022-12-16 15:07 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 18/30] configure, meson: move --enable-modules to Meson Paolo Bonzini
2022-12-12 9:07 ` Marc-André Lureau
2022-12-16 15:09 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 19/30] configure, meson: move --enable-debug-info " Paolo Bonzini
2022-12-09 12:55 ` Philippe Mathieu-Daudé
2022-12-09 13:54 ` Paolo Bonzini
2022-12-09 14:21 ` Philippe Mathieu-Daudé
2022-12-09 16:21 ` Paolo Bonzini
2022-12-16 15:09 ` Daniel P. Berrangé
2022-12-09 11:23 ` [PATCH 20/30] meson: prepare move of QEMU_CFLAGS to meson Paolo Bonzini
2022-12-12 12:02 ` Marc-André Lureau
2022-12-16 15:11 ` Daniel P. Berrangé
2022-12-09 11:24 ` [PATCH 21/30] build: move sanitizer tests " Paolo Bonzini
2022-12-12 12:16 ` Marc-André Lureau
2022-12-12 17:31 ` Paolo Bonzini
2022-12-12 20:37 ` Paolo Bonzini
2022-12-09 11:24 ` [PATCH 22/30] build: move SafeStack " Paolo Bonzini
2022-12-09 12:57 ` Philippe Mathieu-Daudé
2022-12-09 11:24 ` [PATCH 23/30] build: move coroutine backend selection " Paolo Bonzini
2022-12-12 12:18 ` Marc-André Lureau
2022-12-09 11:24 ` [PATCH 24/30] build: move stack protector flag " Paolo Bonzini
2022-12-12 12:22 ` Marc-André Lureau
2022-12-09 11:24 ` [PATCH 25/30] build: move warning " Paolo Bonzini
2022-12-12 12:58 ` Marc-André Lureau
2022-12-09 11:24 ` [PATCH 26/30] build: move remaining compiler flag tests " Paolo Bonzini
2022-12-12 13:54 ` Marc-André Lureau
2022-12-09 11:24 ` [PATCH 27/30] build: move compiler version check " Paolo Bonzini
2022-12-09 11:52 ` Peter Maydell
2022-12-09 14:09 ` Paolo Bonzini
2022-12-09 14:19 ` Peter Maydell
2022-12-09 16:21 ` Paolo Bonzini
2022-12-09 11:24 ` [PATCH 28/30] docs: update build system docs Paolo Bonzini
2022-12-12 14:00 ` Marc-André Lureau
2022-12-09 11:24 ` [PATCH 29/30] configure: do not rerun the tests with -Werror Paolo Bonzini
2022-12-12 14:00 ` Marc-André Lureau
2022-12-09 11:24 ` [PATCH 30/30] meson: always log qemu-iotests verbosely Paolo Bonzini
2022-12-12 14:02 ` Marc-André Lureau
2022-12-12 16:48 ` Paolo Bonzini
2022-12-12 16:55 ` Peter Maydell
2022-12-12 21:36 ` Paolo Bonzini
2022-12-16 15:35 ` [PATCH for-8.0 00/30] Meson changes for QEMU 8.0 Daniel P. Berrangé
2022-12-17 12:54 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221209112409.184703-10-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).