Skip to contentSkip to conversation

meson: accept either shared or static libraries if --disable-static

PATCH In review Paolo Bonzini 2 participants 2 messages Jan 26, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: accept either shared or static libraries if --disable-static

Meson's "static" argument to cc.find_library is a tri-state. By default Meson *prefers* a shared library, which basically means using -l to look for it; instead, "static: false" *requires* a shared library. Of course, "static: true" requires a static library, which is all good for --enable-static builds.

For --disable-static, "static: false" is rarely desirable; it does not match what the configure script used to do and the test is more complex (and harder to debug if it fails, which was reported by Peter Lieven for librbd).

---
 docs/devel/build-system.rst |  2 +-
 meson.build                 | 79 +++++++++++++++++++------------------
 2 files changed, 42 insertions(+), 39 deletions(-)
docs/devel/build-system.rst +1 -1
index 31f4dced2a..69ce3087e3 100644
@@ -100,7 +100,7 @@ In meson.build::
   # Detect dependency
   sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
                          method: 'pkg-config',
-                         static: enable_static)
+                         kwargs: static_kwargs)
 
   # Create config-host.h (if applicable)
   config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
meson.build +41 -38

293 lines not on this page · raw message

Signature · 1 line
2.29.2
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Paolo Bonzini

Meson's "static" argument to cc.find_library is a tri-state. By default Meson *prefers* a shared library, which basically means using -l to look for it; instead, "static: false" *requires* a shared library. Of course, "static: true" requires a static library, which is all good for --enable-static builds.

For --disable-static, "static: false" is rarely desirable; it does not match what the configure script used to do and the test is more complex (and harder to debug if it fails, which was reported by Peter Lieven for librbd).

Quoted 7 lines
---
 docs/devel/build-system.rst |  2 +-
 meson.build                 | 79 +++++++++++++++++++------------------
 2 files changed, 42 insertions(+), 39 deletions(-)