blob: 8352bf2a5b4b81b0c44a4012eb9afc806d59e99d [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "International Component for Unicode libraries"
2DESCRIPTION = "The International Component for Unicode (ICU) is a mature, \
3portable set of C/C++ and Java libraries for Unicode support, software \
4internationalization (I18N) and globalization (G11N), giving applications the \
5same results on all platforms."
6HOMEPAGE = "http://site.icu-project.org/"
7
8LICENSE = "ICU"
Patrick Williamse760df82023-05-26 11:10:49 -05009DEPENDS = "icu-native autoconf-archive-native"
Andrew Geissler517393d2023-01-13 08:55:19 -060010
11CVE_PRODUCT = "international_components_for_unicode"
12
13S = "${WORKDIR}/icu/source"
14SPDX_S = "${WORKDIR}/icu"
15STAGING_ICU_DIR_NATIVE = "${STAGING_DATADIR_NATIVE}/${BPN}/${PV}"
16
17ICU_MAJOR_VER = "${@d.getVar('PV').split('-')[0]}"
18
19inherit autotools pkgconfig github-releases
20
21# ICU needs the native build directory as an argument to its --with-cross-build option when
22# cross-compiling. Taken the situation that different builds may share a common sstate-cache
23# into consideration, the native build directory needs to be staged.
24EXTRA_OECONF = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config"
25EXTRA_OECONF:class-native = "--disable-icu-config"
26EXTRA_OECONF:class-nativesdk = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config"
27
28EXTRA_OECONF:append:class-target = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' --with-data-packaging=archive', '', d)}"
29TARGET_CXXFLAGS:append = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' -DICU_DATA_DIR=\\""${datadir}/${BPN}/${PV}\\""', '', d)}"
30
31ASNEEDED = ""
32
33do_compile:prepend:class-target () {
34 # Make sure certain build host references do not end up being compiled
35 # in the image. This only affects libicutu and icu-dbg
36 sed \
37 -e 's,DU_BUILD=,DU_BUILD_unused=,g' \
38 -e '/^CPPFLAGS.*/ s,--sysroot=${STAGING_DIR_TARGET},,g' \
39 -i ${B}/tools/toolutil/Makefile
40}
41
42PREPROCESS_RELOCATE_DIRS = "${datadir}/${BPN}/${PV}"
43do_install:append:class-native() {
44 mkdir -p ${D}/${STAGING_ICU_DIR_NATIVE}/config
45 cp -r ${B}/config/icucross.mk ${D}/${STAGING_ICU_DIR_NATIVE}/config
46 cp -r ${B}/config/icucross.inc ${D}/${STAGING_ICU_DIR_NATIVE}/config
47 cp -r ${B}/lib ${D}/${STAGING_ICU_DIR_NATIVE}
48 cp -r ${B}/bin ${D}/${STAGING_ICU_DIR_NATIVE}
49 cp -r ${B}/tools ${D}/${STAGING_ICU_DIR_NATIVE}
50}
51
52do_install:append:class-target() {
53 # The native pkgdata can not generate the correct data file.
54 # Use icupkg to re-generate it.
55 if [ "${SITEINFO_ENDIANNESS}" = "be" ] ; then
56 rm -f ${D}/${datadir}/${BPN}/${@icu_install_folder(d)}/icudt${ICU_MAJOR_VER}b.dat
57 icupkg -tb ${S}/data/in/icudt${ICU_MAJOR_VER}l.dat ${D}/${datadir}/${BPN}/${@icu_install_folder(d)}/icudt${ICU_MAJOR_VER}b.dat
58 fi
59
60 # Remove build host references...
61 sed -i \
62 -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
63 -e 's|${DEBUG_PREFIX_MAP}||g' \
64 -e 's:${HOSTTOOLS_DIR}/::g' \
65 ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/Makefile.inc \
66 ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/pkgdata.inc
67}
68
69PACKAGES =+ "libicudata libicuuc libicui18n libicutu libicuio"
70
71FILES:${PN}-dev += "${libdir}/${BPN}/"
72
73FILES:libicudata = "${libdir}/libicudata.so.*"
74FILES:libicuuc = "${libdir}/libicuuc.so.*"
75FILES:libicui18n = "${libdir}/libicui18n.so.*"
76FILES:libicutu = "${libdir}/libicutu.so.*"
77FILES:libicuio = "${libdir}/libicuio.so.*"
78
79BBCLASSEXTEND = "native nativesdk"
80
Patrick Williamsda295312023-12-05 16:48:56 -060081LIC_FILES_CHKSUM = "file://../LICENSE;md5=08dc3852df8fffa807301902ad899ff8"
Andrew Geissler517393d2023-01-13 08:55:19 -060082
83def icu_download_version(d):
84 pvsplit = d.getVar('PV').split('-')
85 return pvsplit[0] + "_" + pvsplit[1]
86
87def icu_download_folder(d):
88 pvsplit = d.getVar('PV').split('-')
89 return pvsplit[0] + "-" + pvsplit[1]
90
91def icu_install_folder(d):
92 pvsplit = d.getVar('PV').split('-')
93 return pvsplit[0] + "." + pvsplit[1]
94
95ICU_PV = "${@icu_download_version(d)}"
96ICU_FOLDER = "${@icu_download_folder(d)}"
97
98# http://errors.yoctoproject.org/Errors/Details/20486/
99ARM_INSTRUCTION_SET:armv4 = "arm"
100ARM_INSTRUCTION_SET:armv5 = "arm"
101
102BASE_SRC_URI = "${GITHUB_BASE_URI}/download/release-${ICU_FOLDER}/icu4c-${ICU_PV}-src.tgz"
103DATA_SRC_URI = "${GITHUB_BASE_URI}/download/release-${ICU_FOLDER}/icu4c-${ICU_PV}-data.zip"
104SRC_URI = "${BASE_SRC_URI};name=code \
105 ${DATA_SRC_URI};name=data \
106 file://filter.json \
107 file://fix-install-manx.patch \
108 file://0001-icu-Added-armeb-support.patch \
109 "
110
111SRC_URI:append:class-target = "\
112 file://0001-Disable-LDFLAGSICUDT-for-Linux.patch \
113 "
Patrick Williams44b3caf2024-04-12 16:51:14 -0500114SRC_URI[code.sha256sum] = "68db082212a96d6f53e35d60f47d38b962e9f9d207a74cfac78029ae8ff5e08c"
115SRC_URI[data.sha256sum] = "c28c3ca5f4ba3384781797138a294ca360988d4322674ad4d51e52f5d9b0a2b6"
Andrew Geissler517393d2023-01-13 08:55:19 -0600116
117UPSTREAM_CHECK_REGEX = "releases/tag/release-(?P<pver>(?!.+rc).+)"
118GITHUB_BASE_URI = "https://github.com/unicode-org/icu/releases"
119
120EXTRA_OECONF:append:libc-musl = " ac_cv_func_strtod_l=no"
121
122PACKAGECONFIG ?= ""
123PACKAGECONFIG[make-icudata] = ",,,"
124
125do_make_icudata:class-target () {
126 ${@bb.utils.contains('PACKAGECONFIG', 'make-icudata', '', 'exit 0', d)}
127 cd ${S}
128 rm -rf data
129 cp -a ${WORKDIR}/data .
130 AR='${BUILD_AR}' \
131 CC='${BUILD_CC}' \
132 CPP='${BUILD_CPP}' \
133 CXX='${BUILD_CXX}' \
134 RANLIB='${BUILD_RANLIB}' \
135 CFLAGS='${BUILD_CFLAGS}' \
136 CPPFLAGS='${BUILD_CPPFLAGS}' \
137 CXXFLAGS='${BUILD_CXXFLAGS}' \
138 LDFLAGS='${BUILD_LDFLAGS}' \
139 ICU_DATA_FILTER_FILE=${WORKDIR}/filter.json \
140 ./runConfigureICU Linux --with-data-packaging=archive
141 oe_runmake
142 install -Dm644 ${S}/data/out/icudt${ICU_MAJOR_VER}l.dat ${S}/data/in/icudt${ICU_MAJOR_VER}l.dat
143}
144
145do_make_icudata() {
146 :
147}
148
149addtask make_icudata before do_configure after do_patch do_prepare_recipe_sysroot