blob: 983118cd6197ae315b3730ad5f9c7cd010037508 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "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"
10DEPENDS_class-native = ""
11
Brad Bishop6e60e8b2018-02-01 10:27:11 -050012CVE_PRODUCT = "international_components_for_unicode"
13
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014S = "${WORKDIR}/icu/source"
15SPDX_S = "${WORKDIR}/icu"
16STAGING_ICU_DIR_NATIVE = "${STAGING_DATADIR_NATIVE}/${BPN}/${PV}"
17
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018BINCONFIG = "${bindir}/icu-config"
19
Brad Bishop316dfdd2018-06-25 12:45:53 -040020ICU_MAJOR_VER = "${@d.getVar('PV').split('.')[0]}"
21
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022inherit autotools pkgconfig binconfig
23
24# ICU needs the native build directory as an argument to its --with-cross-build option when
25# cross-compiling. Taken the situation that different builds may share a common sstate-cache
26# into consideration, the native build directory needs to be staged.
27EXTRA_OECONF = "--with-cross-build=${STAGING_ICU_DIR_NATIVE}"
28EXTRA_OECONF_class-native = ""
29EXTRA_OECONF_class-nativesdk = "--with-cross-build=${STAGING_ICU_DIR_NATIVE}"
30
Brad Bishop316dfdd2018-06-25 12:45:53 -040031EXTRA_OECONF_append_class-target = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' --with-data-packaging=archive', '', d)}"
32TARGET_CXXFLAGS_append = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' -DICU_DATA_DIR=\\""${datadir}/${BPN}/${PV}\\""', '', d)}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050033
34# strtod_l() is not supported by musl; also xlocale.h is missing
35# It is not possible to disable its use via configure switches or env vars
36# so monkey patching is needed.
37do_configure_prepend_libc-musl () {
38 sed -i -e 's,DU_HAVE_STRTOD_L=1,DU_HAVE_STRTOD_L=0,' ${S}/configure.ac
39}
40
Brad Bishop316dfdd2018-06-25 12:45:53 -040041do_compile_prepend_class-target () {
42 # Make sure certain build host references do not end up being compiled
43 # in the image. This only affects libicutu and icu-dbg
44 sed \
45 -e 's,DU_BUILD=,DU_BUILD_unused=,g' \
46 -e '/^CPPFLAGS.*/ s,--sysroot=${STAGING_DIR_TARGET},,g' \
47 -i ${B}/tools/toolutil/Makefile
48}
49
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050PREPROCESS_RELOCATE_DIRS = "${datadir}/${BPN}/${PV}"
51do_install_append_class-native() {
52 mkdir -p ${D}/${STAGING_ICU_DIR_NATIVE}/config
53 cp -r ${B}/config/icucross.mk ${D}/${STAGING_ICU_DIR_NATIVE}/config
54 cp -r ${B}/config/icucross.inc ${D}/${STAGING_ICU_DIR_NATIVE}/config
55 cp -r ${B}/lib ${D}/${STAGING_ICU_DIR_NATIVE}
56 cp -r ${B}/bin ${D}/${STAGING_ICU_DIR_NATIVE}
57 cp -r ${B}/tools ${D}/${STAGING_ICU_DIR_NATIVE}
58}
59
Brad Bishop316dfdd2018-06-25 12:45:53 -040060do_install_append_class-target() {
61 # The native pkgdata can not generate the correct data file.
62 # Use icupkg to re-generate it.
63 if [ "${SITEINFO_ENDIANNESS}" = "be" ] ; then
64 rm -f ${D}/${datadir}/${BPN}/${PV}/icudt${ICU_MAJOR_VER}b.dat
65 icupkg -tb ${S}/data/in/icudt${ICU_MAJOR_VER}l.dat ${D}/${datadir}/${BPN}/${PV}/icudt${ICU_MAJOR_VER}b.dat
66 fi
67
68 # Remove build host references...
69 sed -i \
70 -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
71 -e 's|${DEBUG_PREFIX_MAP}||g' \
72 -e 's:${HOSTTOOLS_DIR}/::g' \
73 ${D}/${bindir}/icu-config ${D}/${libdir}/${BPN}/${PV}/Makefile.inc \
74 ${D}/${libdir}/${BPN}/${PV}/pkgdata.inc
75}
76
Brad Bishop6e60e8b2018-02-01 10:27:11 -050077PACKAGES =+ "libicudata libicuuc libicui18n libicutu libicuio"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078
79FILES_${PN}-dev += "${libdir}/${BPN}/"
80
81FILES_libicudata = "${libdir}/libicudata.so.*"
82FILES_libicuuc = "${libdir}/libicuuc.so.*"
83FILES_libicui18n = "${libdir}/libicui18n.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050084FILES_libicutu = "${libdir}/libicutu.so.*"
85FILES_libicuio = "${libdir}/libicuio.so.*"
86
87BBCLASSEXTEND = "native nativesdk"