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