qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 09/30] meson: use prefer_static option


From: Marc-André Lureau
Subject: Re: [PATCH 09/30] meson: use prefer_static option
Date: Mon, 12 Dec 2022 12:29:45 +0400

On Fri, Dec 9, 2022 at 3:42 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> 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>

Reviewed-by: Marc-André Lureau <marcandre.lureau@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
>
>


-- 
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]