diff mbox series

[1/1] package/pkg-meson: support building both libraries

Message ID 20240722131750.519333-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series [1/1] package/pkg-meson: support building both libraries | expand

Commit Message

Fabrice Fontaine July 22, 2024, 1:17 p.m. UTC
meson supports building both libraries (i.e. static and shared).
This will avoid the following build failure with flashrom and
BR2_SHARED_STATIC_LIBS raised since bump to version 1.4.0-rc2 in commit
8637884057ddc3c1aeb9f0dd285fc6fcf378c26b:

../output-1/build/flashrom-1.4.0-rc2/meson.build:18:2: ERROR: Problem encountered:
    Cannot build cli_classic with shared libflashrom. Use \'-Dclassic_cli=disabled\' to disable the cli,
    or use \'--default-library=both\' to also build the classic_cli

Fixes: 8637884057ddc3c1aeb9f0dd285fc6fcf378c26b
 - http://autobuild.buildroot.org/results/6d484857ff1674bf81986505827e54f3f1b9aaec

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/pkg-meson.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni July 22, 2024, 4:23 p.m. UTC | #1
On Mon, 22 Jul 2024 15:17:50 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> meson supports building both libraries (i.e. static and shared).
> This will avoid the following build failure with flashrom and
> BR2_SHARED_STATIC_LIBS raised since bump to version 1.4.0-rc2 in commit
> 8637884057ddc3c1aeb9f0dd285fc6fcf378c26b:
> 
> ../output-1/build/flashrom-1.4.0-rc2/meson.build:18:2: ERROR: Problem encountered:
>     Cannot build cli_classic with shared libflashrom. Use \'-Dclassic_cli=disabled\' to disable the cli,
>     or use \'--default-library=both\' to also build the classic_cli
> 
> Fixes: 8637884057ddc3c1aeb9f0dd285fc6fcf378c26b
>  - http://autobuild.buildroot.org/results/6d484857ff1674bf81986505827e54f3f1b9aaec
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  package/pkg-meson.mk | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

Applied to master, thanks. I'm guessing this could cause a bit of
breakage, but let's see how much :-)

Thomas
diff mbox series

Patch

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index 65cabf23ba..bc805b799c 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -82,6 +82,14 @@  else
 PKG_MESON_TARGET_FC = /bin/false
 endif
 
+ifeq ($(BR2_STATIC_LIBS),y)
+PKG_MESON_DEFAULT_LIBRARY=static
+else ifeq ($(BR2_SHARED_LIBS),y)
+PKG_MESON_DEFAULT_LIBRARY=shared
+else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
+PKG_MESON_DEFAULT_LIBRARY=both
+endif
+
 # Generates sed patterns for patching the cross-compilation.conf template,
 # since Flags might contain commas the arguments are passed indirectly by
 # variable name (stripped to deal with whitespaces).
@@ -152,7 +160,7 @@  define $(2)_CONFIGURE_CMDS
 	$$(MESON) setup \
 		--prefix=/usr \
 		--libdir=lib \
-		--default-library=$(if $(BR2_STATIC_LIBS),static,shared) \
+		--default-library=$(PKG_MESON_DEFAULT_LIBRARY) \
 		--buildtype=$(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release) \
 		--cross-file=$$($$(PKG)_SRCDIR)/build/cross-compilation.conf \
 		-Db_pie=false \