xref: /OK3568_Linux_fs/buildroot/package/icu/icu.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# icu
4#
5################################################################################
6
7# Git tags (and therefore versions on release-monitoring.org) use the
8# XX-Y format, but the tarballs are named XX_Y and the containing
9# directories XX.Y.
10ICU_VERSION = 70-1
11ICU_SOURCE = icu4c-$(subst -,_,$(ICU_VERSION))-src.tgz
12ICU_SITE = \
13	https://github.com/unicode-org/icu/releases/download/release-$(ICU_VERSION)
14ICU_LICENSE = ICU License
15ICU_LICENSE_FILES = LICENSE
16ICU_CPE_ID_VENDOR = icu-project
17ICU_CPE_ID_PRODUCT = international_components_for_unicode
18ICU_CPE_ID_VERSION = $(subst -,.,$(ICU_VERSION))
19
20# 0005-ICU-21587-Fix-memory-bug-w-baseName.patch
21ICU_IGNORE_CVES += CVE-2021-30535
22
23ICU_DEPENDENCIES = host-icu
24ICU_INSTALL_STAGING = YES
25ICU_CONFIG_SCRIPTS = icu-config
26ICU_CONF_OPTS = \
27	--with-cross-build=$(HOST_ICU_DIR)/source \
28	--disable-samples \
29	--disable-tests
30
31# When available, icu prefers to use C++11 atomics, which rely on the
32# __atomic builtins. On certain architectures, this requires linking
33# with libatomic starting from gcc 4.8.
34ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
35ICU_CONF_ENV += LIBS="-latomic"
36endif
37
38# strtod_l() is not supported by musl; also xlocale.h is missing
39ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
40ICU_CONF_ENV += ac_cv_func_strtod_l=no
41endif
42
43HOST_ICU_CONF_OPTS = \
44	--disable-samples \
45	--disable-tests \
46	--disable-extras \
47	--disable-icuio \
48	--disable-layout
49ICU_SUBDIR = source
50HOST_ICU_SUBDIR = source
51
52# ICU build scripting adds paths to LD_LIBRARY_PATH using
53#   LD_LIBRARY_PATH="custom-path:${LD_LIBRARY_PATH}"
54# which, if LD_LIBRARY_PATH was empty, causes the last search directory
55# to be the working directory, causing the build to try to load target
56# libraries, possibly crashing the build due to ABI mismatches.
57# Workaround by ensuring LD_LIBRARY_PATH is never empty.
58# https://unicode-org.atlassian.net/browse/ICU-21417
59ifeq ($(LD_LIBRARY_PATH),)
60ICU_MAKE_ENV += LD_LIBRARY_PATH=/dev/null
61endif
62
63ICU_CUSTOM_DATA_PATH = $(call qstrip,$(BR2_PACKAGE_ICU_CUSTOM_DATA_PATH))
64
65ifneq ($(ICU_CUSTOM_DATA_PATH),)
66define ICU_COPY_CUSTOM_DATA
67	cp $(ICU_CUSTOM_DATA_PATH) $(@D)/source/data/in/
68endef
69ICU_POST_PATCH_HOOKS += ICU_COPY_CUSTOM_DATA
70endif
71
72define ICU_REMOVE_DEV_FILES
73	rm -f $(addprefix $(TARGET_DIR)/usr/bin/,derb genbrk gencfu gencnval gendict genrb icuinfo makeconv uconv)
74	rm -f $(addprefix $(TARGET_DIR)/usr/sbin/,genccode gencmn gennorm2 gensprep icupkg)
75	rm -rf $(TARGET_DIR)/usr/share/icu
76endef
77ICU_POST_INSTALL_TARGET_HOOKS += ICU_REMOVE_DEV_FILES
78
79$(eval $(autotools-package))
80$(eval $(host-autotools-package))
81