From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH 03/24] meson: use prefer_static option
Date: Thu, 11 May 2023 11:50:00 +0200 [thread overview]
Message-ID: <20230511095021.1397802-4-pbonzini@redhat.com> (raw)
In-Reply-To: <20230511095021.1397802-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.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 4 +---
docs/devel/build-system.rst | 3 +--
meson.build | 13 +++++--------
qga/meson.build | 2 +-
4 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/configure b/configure
index a656c69bf03a..2edc5070cd26 100755
--- a/configure
+++ b/configure
@@ -2409,9 +2409,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
@@ -2654,6 +2651,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 e4c21326b196..4b72ffd465d9 100644
--- a/meson.build
+++ b/meson.build
@@ -18,10 +18,7 @@ targetos = host_machine.system()
sh = find_program('sh')
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 = {}
cc = meson.get_compiler('c')
all_languages = ['c']
@@ -193,7 +190,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
@@ -841,7 +838,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)
@@ -1225,7 +1222,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)])
@@ -1657,7 +1654,7 @@ endif
# libdw
libdw = not_found
if not get_option('libdw').auto() or \
- (not enable_static and (have_system or have_user))
+ (not get_option('prefer_static') and (have_system or have_user))
libdw = dependency('libdw',
method: 'pkg-config',
kwargs: static_kwargs,
diff --git a/qga/meson.build b/qga/meson.build
index ad17dc7dca13..622b5f94a232 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.40.1
next prev parent reply other threads:[~2023-05-11 9:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-11 9:49 [PATCH 00/24] Meson changes for QEMU 8.1 Paolo Bonzini
2023-05-11 9:49 ` [PATCH 01/24] meson: regenerate meson-buildoptions.sh Paolo Bonzini
2023-05-11 9:49 ` [PATCH 02/24] meson: require 0.63.0 Paolo Bonzini
2023-05-11 9:50 ` Paolo Bonzini [this message]
2023-05-11 9:50 ` [PATCH 04/24] meson: remove static_kwargs Paolo Bonzini
2023-05-11 9:50 ` [PATCH 05/24] meson: add more version numbers to the summary Paolo Bonzini
2023-05-11 9:50 ` [PATCH 06/24] meson: drop unnecessary declare_dependency() Paolo Bonzini
2023-05-11 9:50 ` [PATCH 07/24] build: move glib detection and workarounds to meson Paolo Bonzini
2023-05-11 9:50 ` [PATCH 08/24] configure: remove pkg-config functions Paolo Bonzini
2023-05-11 9:50 ` [PATCH 09/24] configure, meson: move --enable-modules to Meson Paolo Bonzini
2023-05-11 9:50 ` [PATCH 10/24] meson: prepare move of QEMU_CFLAGS to meson Paolo Bonzini
2023-05-11 9:50 ` [PATCH 11/24] build: move sanitizer tests " Paolo Bonzini
2023-05-11 9:50 ` [PATCH 12/24] build: move SafeStack " Paolo Bonzini
2023-05-11 9:50 ` [PATCH 13/24] build: move coroutine backend selection " Paolo Bonzini
2023-05-11 9:50 ` [PATCH 14/24] build: move stack protector flag " Paolo Bonzini
2023-05-11 9:50 ` [PATCH 15/24] build: move warning " Paolo Bonzini
2023-05-11 9:50 ` [PATCH 16/24] build: move remaining compiler flag tests " Paolo Bonzini
2023-05-11 9:50 ` [PATCH 17/24] build: move compiler version check " Paolo Bonzini
2023-05-11 9:50 ` [PATCH 18/24] build: move --disable-debug-info " Paolo Bonzini
2023-07-26 6:45 ` Michael Tokarev
2023-05-11 9:50 ` [PATCH 19/24] configure: remove compiler sanity check Paolo Bonzini
2024-01-18 19:23 ` Thomas Huth
2023-05-11 9:50 ` [PATCH 20/24] configure: do not rerun the tests with -Werror Paolo Bonzini
2023-05-11 9:50 ` [PATCH 21/24] configure: remove unnecessary mkdir Paolo Bonzini
2023-05-11 9:50 ` [PATCH 22/24] configure: reorder option parsing code Paolo Bonzini
2023-05-11 9:50 ` [PATCH 23/24] configure: remove unnecessary check Paolo Bonzini
2023-05-11 9:50 ` [PATCH 24/24] docs/devel: update build system docs 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=20230511095021.1397802-4-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=marcandre.lureau@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).