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