package/pkg-meson: support building both libraries

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
8637884057:

../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: 8637884057
 - http://autobuild.buildroot.org/results/6d484857ff1674bf81986505827e54f3f1b9aaec

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Fabrice Fontaine 2024-07-22 15:17:50 +02:00 committed by Thomas Petazzoni
parent ec052de2fb
commit f40757781f

View File

@ -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 \