Skip to contentSkip to conversation

boost: make Boost.Locale ICU backend optional

PATCH Superseded Shinu Chandran 3 participants 5 messages Jul 28 – Aug 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 boost: make Boost.Locale ICU backend optional

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 icu PACKAGECONFIG option and keep it enabled by default so existing builds retain the same feature set and runtime linkage. When 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.

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

---
 meta/recipes-support/boost/boost.inc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
meta/recipes-support/boost/boost.inc +5 -3
index 7a343e54f6..9ad23b279c 100644
@@ -49,8 +49,10 @@ BOOST_LIBS = "\
 	"
 
 # optional libraries
-PACKAGECONFIG ??= "locale python"
-PACKAGECONFIG[locale] = ",,icu"
+PACKAGECONFIG ??= "locale python icu"
+BOOST_LOCALE_ICU_DEP = "${@bb.utils.contains('PACKAGECONFIG', 'locale', 'icu', '', d)}"
+PACKAGECONFIG[locale] = ",,"
+PACKAGECONFIG[icu] = ",,${BOOST_LOCALE_ICU_DEP}"
 PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
 PACKAGECONFIG[mpi] = ",,mpich"
 PACKAGECONFIG[python] = ",,python3"
@@ -148,7 +150,7 @@ BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}"
 BJAM_OPTS    = '${BOOST_PARALLEL_MAKE} -d+2 -q \
 		${BJAM_TOOLS} \
 		-sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
-		-sICU_PATH=${STAGING_EXECPREFIXDIR} \
+		${@bb.utils.contains('PACKAGECONFIG', 'locale icu', '-sICU_PATH=${STAGING_EXECPREFIXDIR}', 'boost.locale.icu=off', d)} \
 		--build-dir=${B} \
 		--disable-icu \
 		${BJAM_EXTRA}'
Signature · 1 line
2.35.6
#1 lore raw
Quoted 11 lines · Shinu Chandran via lists.openembedded.org
 # optional libraries
meta/recipes-support/boost/boost.inc +4 -2
-PACKAGECONFIG ??= "locale python"
-PACKAGECONFIG[locale] = ",,icu"
+PACKAGECONFIG ??= "locale python icu"
+BOOST_LOCALE_ICU_DEP = "${@bb.utils.contains('PACKAGECONFIG', 'locale', 'icu', '', d)}"
+PACKAGECONFIG[locale] = ",,"
+PACKAGECONFIG[icu] = ",,${BOOST_LOCALE_ICU_DEP}"
 PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
 PACKAGECONFIG[mpi] = ",,mpich"
 PACKAGECONFIG[python] = ",,python3"

meta/recipes-support/boost/boost.inc BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}" · line 155

Quoted 7 lines
meta/recipes-support/boost/boost.inc +1 -1
@@ -148,7 +150,7 @@ BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}"
 BJAM_OPTS    = '${BOOST_PARALLEL_MAKE} -d+2 -q \
                ${BJAM_TOOLS} \
                -sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
-               -sICU_PATH=${STAGING_EXECPREFIXDIR} \
+               ${@bb.utils.contains('PACKAGECONFIG', 'locale icu', '-sICU_PATH=${STAGING_EXECPREFIXDIR}', 'boost.locale.icu=off', d)} \
                --build-dir=${B} \
                --disable-icu \

As we're passing --disable-icu, what does that do? How is it related to the icu PACKAGECONFIG? Should we perhaps name things more clearer, e.g. the newly introduced option should be 'locale-icu' and not just 'icu'?

Also, I think boost.locale.icu=on should be passed when it is enabled, to explicitly avoid possible floating configurations, e.g. when upstream quietly changes the default.

Alex

#2 lore raw

PATCH v2 1/1 boost: make Boost.Locale ICU backend optional

In reply to Shinu Chandran

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.

---
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(-)
meta/recipes-support/boost/boost.inc +8 -3
index 7a343e54f6..7033da181b 100644
@@ -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}'
Signature · 1 line
2.35.6
#3 lore raw

meta/recipes-support/boost/boost.inc BOOST_LIBS = "\ · line 55

Quoted 3 lines · Shinu Chandran via lists.openembedded.org
meta/recipes-support/boost/boost.inc +3 -0
+BOOST_LOCALE_ICU_DEP = "${@bb.utils.contains('PACKAGECONFIG', 'locale', 'icu', '', d)}"
+PACKAGECONFIG[locale] = ",,"
+PACKAGECONFIG[locale-icu] = ",,${BOOST_LOCALE_ICU_DEP}"

The use of BOOST_LOCALE_ICU_DEP is overcomplicating things: if the distro turns on locale-icu but not locale then locale not enabling is entirely user error. Just set the dependency directly.

meta/recipes-support/boost/boost.inc BJAM_TOOLS = "--ignore-site-config \ · line 151

Quoted 9 lines

PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich" PACKAGECONFIG[mpi] = ",,mpich" PACKAGECONFIG[python] = ",,python3"

meta/recipes-support/boost/boost.inc +0 -0
@@ -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')}"

meta/recipes-support/boost/boost.inc +2 -0
+# --disable-icu below controls Boost.Regex ICU support. Boost.Locale ICU is
+# handled independently with boost.locale.icu.

So there’s an option to enable/disable the use of ICU in boost.locale, which you’re exposing.

There’s also an option to enable/disable the use of ICU in boost.regex, which is not exposed.

What’s the rationale behind enabling it in some parts of boost but not others? It seems like there should be an “icu” option which flips the toggles on all parts of boost that have an optional dependency on ICU.

Quoted 1 line

+BOOST_LOCALE_ICU_OPTS = "${@bb.utils.contains('PACKAGECONFIG', 'locale locale-icu', 'boost.locale.icu=on -sICU_PATH=${STAGING_EXECPREFIXDIR}', 'boost.locale.icu=off', d)}"

Instead of doing this, inline the argument into the PACKAGECONFIG[] statements and pass ${PACKAGECONFIG_CONFARGS} to BJAM_OPTS. This variable is generated at build time and contains the relevant enable/disable statements based on the selected configuration.

Ross

#4 lore raw

PATCH v3 1/1 boost: make ICU support configurable

In reply to Shinu Chandran

Boost.Locale and Boost.Regex both have optional ICU support, but the recipe depended on icu via PACKAGECONFIG[locale] while still passing --disable-icu to b2. That made the dependency relationship confusing and kept the Boost.Regex ICU toggle separate from the Boost.Locale one.

Add an explicit icu PACKAGECONFIG, enabled by default, and use PACKAGECONFIG_CONFARGS to pass the generated b2 arguments. When icu is removed from PACKAGECONFIG the recipe drops the icu dependency and passes boost.locale.icu=off --disable-icu; when enabled it passes boost.locale.icu=on with ICU_PATH.

This lets distros remove the ICU dependency consistently without disabling the Boost.Locale library itself.

---
Changes in v3:
- Replace locale-icu with a single icu PACKAGECONFIG covering ICU use in Boost.
- Drop BOOST_LOCALE_ICU_DEP and use a direct icu dependency.
- Move Boost.Build enable/disable arguments into PACKAGECONFIG[icu].
- Pass ${PACKAGECONFIG_CONFARGS} through BJAM_OPTS.
- Validate both default and PACKAGECONFIG:remove:pn-boost = "icu" builds.

Changes in v2:
- Rename the PACKAGECONFIG option from icu to locale-icu.
- Pass boost.locale.icu=on explicitly when enabled.

 meta/recipes-support/boost/boost.inc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
meta/recipes-support/boost/boost.inc +4 -4
index 7a343e54f6..bff5120e18 100644
@@ -49,8 +49,9 @@ BOOST_LIBS = "\
 	"
 
 # optional libraries
-PACKAGECONFIG ??= "locale python"
-PACKAGECONFIG[locale] = ",,icu"
+PACKAGECONFIG ??= "locale python icu"
+PACKAGECONFIG[locale] = ",,"
+PACKAGECONFIG[icu] = "boost.locale.icu=on -sICU_PATH=${STAGING_EXECPREFIXDIR},boost.locale.icu=off --disable-icu,icu"
 PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
 PACKAGECONFIG[mpi] = ",,mpich"
 PACKAGECONFIG[python] = ",,python3"
@@ -148,9 +149,8 @@ BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}"
 BJAM_OPTS    = '${BOOST_PARALLEL_MAKE} -d+2 -q \
 		${BJAM_TOOLS} \
 		-sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
-		-sICU_PATH=${STAGING_EXECPREFIXDIR} \
+		${PACKAGECONFIG_CONFARGS} \
 		--build-dir=${B} \
-		--disable-icu \
 		${BJAM_EXTRA}'
 
 # Native compilation of bzip2 isn't working
Signature · 1 line
2.35.6