diff mbox series

[v2] boost: make Boost.Locale ICU backend optional

Message ID 20260729061232.3547458-1-shinucha@cisco.com
State New
Headers show
Series [v2] boost: make Boost.Locale ICU backend optional | expand

Commit Message

Shinu Chandran July 29, 2026, 6:12 a.m. UTC
Boost.Locale currently always depends on ICU when the locale library is
enabled. That makes ICU a mandatory dependency for users that need
boost-locale but do not need the ICU backend.

Add a separate locale-icu PACKAGECONFIG option and keep it enabled by
default so existing builds retain the same feature set and runtime
linkage. When locale-icu is removed, pass boost.locale.icu=off to
Boost.Build so boost-locale can still be built using the non-ICU
backends without pulling ICU into the dependency graph.

Pass boost.locale.icu=on explicitly when the option is enabled instead
of relying on Boost's default probing behavior. Keep the existing
--disable-icu argument, which controls Boost.Regex ICU support, separate
from the Boost.Locale backend selection.

Tie the ICU dependency to the locale and locale-icu options so
configurations that disable either locale or the ICU backend do not keep
an unused ICU build dependency. This gives distros and SDK builds a
smaller dependency closure while preserving the current default behavior.

Signed-off-by: Shinu Chandran <shinucha@cisco.com>
---
Changes in v2:
- Rename the PACKAGECONFIG option from icu to locale-icu to clarify that
  it controls the Boost.Locale ICU backend only.
- Pass boost.locale.icu=on explicitly when the backend is enabled.
- Keep --disable-icu unchanged because it controls Boost.Regex ICU support.

 meta/recipes-support/boost/boost.inc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-support/boost/boost.inc b/meta/recipes-support/boost/boost.inc
index 7a343e54f6..7033da181b 100644
--- a/meta/recipes-support/boost/boost.inc
+++ b/meta/recipes-support/boost/boost.inc
@@ -49,8 +49,10 @@  BOOST_LIBS = "\
 	"
 
 # optional libraries
-PACKAGECONFIG ??= "locale python"
-PACKAGECONFIG[locale] = ",,icu"
+PACKAGECONFIG ??= "locale python locale-icu"
+BOOST_LOCALE_ICU_DEP = "${@bb.utils.contains('PACKAGECONFIG', 'locale', 'icu', '', d)}"
+PACKAGECONFIG[locale] = ",,"
+PACKAGECONFIG[locale-icu] = ",,${BOOST_LOCALE_ICU_DEP}"
 PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
 PACKAGECONFIG[mpi] = ",,mpich"
 PACKAGECONFIG[python] = ",,python3"
@@ -145,10 +147,13 @@  BJAM_TOOLS   = "--ignore-site-config \
 
 # use PARALLEL_MAKE to speed up the build
 BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}"
+# --disable-icu below controls Boost.Regex ICU support. Boost.Locale ICU is
+# handled independently with boost.locale.icu.
+BOOST_LOCALE_ICU_OPTS = "${@bb.utils.contains('PACKAGECONFIG', 'locale locale-icu', 'boost.locale.icu=on -sICU_PATH=${STAGING_EXECPREFIXDIR}', 'boost.locale.icu=off', d)}"
 BJAM_OPTS    = '${BOOST_PARALLEL_MAKE} -d+2 -q \
 		${BJAM_TOOLS} \
 		-sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
-		-sICU_PATH=${STAGING_EXECPREFIXDIR} \
+		${BOOST_LOCALE_ICU_OPTS} \
 		--build-dir=${B} \
 		--disable-icu \
 		${BJAM_EXTRA}'