Fix libicu build by having proper toolchain build

This commit is contained in:
Wildan M 2026-05-09 06:11:35 +02:00
parent 7c43688ea2
commit f66a2ab28a

View File

@ -1,52 +1,33 @@
#TODO: promote
[source]
tar = "https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-src.tgz"
blake3 = "8f51c4e4c6577b61d02921e800ddb0a2d4778addf7717eef4c5bb0e8a5582c3a"
tar = "https://github.com/unicode-org/icu/releases/download/release-78.3/icu4c-78.3-sources.tgz"
blake3 = "5657d84c78549f198f1335ec9d2f1de2b0ac2771fe081cbf00016370872c13f3"
patches = ["redox.patch"]
[build]
dependencies = [
"host:libicu"
]
template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/source/configure"
mkdir -p host
pushd host
#TODO: easier way to build for host?
HOST_ENV=(
env
--unset=AR
--unset=AS
--unset=CC
--unset=CFLAGS
--unset=CPPFLAGS
--unset=CXX
--unset=GNU_TARGET
--unset=LD
--unset=LDFLAGS
--unset=NM
--unset=OBJCOPY
--unset=OBJDUMP
--unset=PKG_CONFIG
--unset=PKG_CONFIG_ALLOW_CROSS
--unset=PKG_CONFIG_FOR_BUILD
--unset=PKG_CONFIG_LIBDIR
--unset=PKG_CONFIG_PATH
--unset=PKG_CONFIG_SYSROOT_DIR
--unset=PREFIX_RUSTFLAGS
--unset=RANLIB
--unset=READELF
--unset=STRIP
--unset=TARGET
)
"${HOST_ENV[@]}" printenv | sort
"${HOST_ENV[@]}" "${COOKBOOK_CONFIGURE}"
"${HOST_ENV[@]}" "${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}"
popd
COOKBOOK_CONFIGURE_FLAGS+=(
--with-cross-build="${COOKBOOK_BUILD}/host"
icu_cv_host_frag=mh-linux
)
if [ "$TARGET" != "$COOKBOOK_HOST_TARGET" ]; then
COOKBOOK_CONFIGURE_FLAGS+=(
--with-cross-build="${COOKBOOK_TOOLCHAIN}/usr"
)
fi
# libicu uses TARGET for something else
unset TARGET
cookbook_configure
if [ "$TARGET" != "$COOKBOOK_HOST_TARGET" ]; then
# this is not ideal, but there's no other better way
rsync -a ./ "${COOKBOOK_STAGE}/usr"
fi
"""