qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] libvhost-user: add a link-static option


From: Paolo Bonzini
Subject: Re: [PATCH] libvhost-user: add a link-static option
Date: Mon, 14 Dec 2020 17:22:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0

On 12/12/20 10:08, marcandre.lureau@redhat.com wrote:
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Fix linking vhost-user binaries with with ./configure -static.

Fixes: 0df750e9d3a5fea5e1 ("libvhost-user: make it a meson subproject")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
  configure                                   | 1 +
  subprojects/libvhost-user/meson.build       | 3 ++-
  subprojects/libvhost-user/meson_options.txt | 5 +++++
  3 files changed, 8 insertions(+), 1 deletion(-)
  create mode 100644 subprojects/libvhost-user/meson_options.txt

diff --git a/configure b/configure
index 18c26e0389..465f7bb150 100755
--- a/configure
+++ b/configure
@@ -7014,6 +7014,7 @@ NINJA=$ninja $meson setup \
          -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
          -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
          -Dvhost_user_blk_server=$vhost_user_blk_server \
+        -Dlibvhost-user:link-static=$(if test "$static" = yes; then echo true; 
else echo false; fi) \
          $cross_arg \
          "$PWD" "$source_path"
diff --git a/subprojects/libvhost-user/meson.build b/subprojects/libvhost-user/meson.build
index c5d85c11d7..5a9cc8675e 100644
--- a/subprojects/libvhost-user/meson.build
+++ b/subprojects/libvhost-user/meson.build
@@ -2,7 +2,8 @@ project('libvhost-user', 'c',
          license: 'GPL-2.0-or-later',
          default_options: ['c_std=gnu99'])
-glib = dependency('glib-2.0')
+link_static = get_option('link-static')
+glib = dependency('glib-2.0', static: link_static)
  inc = include_directories('../../include', '../../linux-headers')
vhost_user = static_library('vhost-user',
diff --git a/subprojects/libvhost-user/meson_options.txt 
b/subprojects/libvhost-user/meson_options.txt
new file mode 100644
index 0000000000..03fe088e36
--- /dev/null
+++ b/subprojects/libvhost-user/meson_options.txt
@@ -0,0 +1,5 @@
+option('link-static',
+  type: 'boolean',
+  value: false,
+)
+

No, this is wrong. We need to use the results of the configure test uniformly until we can move it to meson.build.

Ask yourself if you'd like to have this option in a standalone project, the answer most likely is no... Can you use override_dependency from the toplevel meson.build instead? It's usually meant for sub->superproject, but we can use it in this case as well I think.

Paolo




reply via email to

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