Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1 | SUMMARY = "International Component for Unicode libraries" |
| 2 | DESCRIPTION = "The International Component for Unicode (ICU) is a mature, \ |
| 3 | portable set of C/C++ and Java libraries for Unicode support, software \ |
| 4 | internationalization (I18N) and globalization (G11N), giving applications the \ |
| 5 | same results on all platforms." |
| 6 | HOMEPAGE = "http://site.icu-project.org/" |
| 7 | |
| 8 | LICENSE = "ICU" |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 9 | DEPENDS = "icu-native autoconf-archive-native" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 10 | |
| 11 | CVE_PRODUCT = "international_components_for_unicode" |
| 12 | |
| 13 | S = "${WORKDIR}/icu/source" |
| 14 | SPDX_S = "${WORKDIR}/icu" |
| 15 | STAGING_ICU_DIR_NATIVE = "${STAGING_DATADIR_NATIVE}/${BPN}/${PV}" |
| 16 | |
| 17 | ICU_MAJOR_VER = "${@d.getVar('PV').split('-')[0]}" |
| 18 | |
| 19 | inherit 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. |
| 24 | EXTRA_OECONF = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config" |
| 25 | EXTRA_OECONF:class-native = "--disable-icu-config" |
| 26 | EXTRA_OECONF:class-nativesdk = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config" |
| 27 | |
| 28 | EXTRA_OECONF:append:class-target = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' --with-data-packaging=archive', '', d)}" |
| 29 | TARGET_CXXFLAGS:append = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' -DICU_DATA_DIR=\\""${datadir}/${BPN}/${PV}\\""', '', d)}" |
| 30 | |
| 31 | ASNEEDED = "" |
| 32 | |
| 33 | do_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 | |
| 42 | PREPROCESS_RELOCATE_DIRS = "${datadir}/${BPN}/${PV}" |
| 43 | do_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 | |
| 52 | do_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 | |
| 69 | PACKAGES =+ "libicudata libicuuc libicui18n libicutu libicuio" |
| 70 | |
| 71 | FILES:${PN}-dev += "${libdir}/${BPN}/" |
| 72 | |
| 73 | FILES:libicudata = "${libdir}/libicudata.so.*" |
| 74 | FILES:libicuuc = "${libdir}/libicuuc.so.*" |
| 75 | FILES:libicui18n = "${libdir}/libicui18n.so.*" |
| 76 | FILES:libicutu = "${libdir}/libicutu.so.*" |
| 77 | FILES:libicuio = "${libdir}/libicuio.so.*" |
| 78 | |
| 79 | BBCLASSEXTEND = "native nativesdk" |
| 80 | |
Patrick Williams | da29531 | 2023-12-05 16:48:56 -0600 | [diff] [blame] | 81 | LIC_FILES_CHKSUM = "file://../LICENSE;md5=08dc3852df8fffa807301902ad899ff8" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 82 | |
| 83 | def icu_download_version(d): |
| 84 | pvsplit = d.getVar('PV').split('-') |
| 85 | return pvsplit[0] + "_" + pvsplit[1] |
| 86 | |
| 87 | def icu_download_folder(d): |
| 88 | pvsplit = d.getVar('PV').split('-') |
| 89 | return pvsplit[0] + "-" + pvsplit[1] |
| 90 | |
| 91 | def icu_install_folder(d): |
| 92 | pvsplit = d.getVar('PV').split('-') |
| 93 | return pvsplit[0] + "." + pvsplit[1] |
| 94 | |
| 95 | ICU_PV = "${@icu_download_version(d)}" |
| 96 | ICU_FOLDER = "${@icu_download_folder(d)}" |
| 97 | |
| 98 | # http://errors.yoctoproject.org/Errors/Details/20486/ |
| 99 | ARM_INSTRUCTION_SET:armv4 = "arm" |
| 100 | ARM_INSTRUCTION_SET:armv5 = "arm" |
| 101 | |
| 102 | BASE_SRC_URI = "${GITHUB_BASE_URI}/download/release-${ICU_FOLDER}/icu4c-${ICU_PV}-src.tgz" |
| 103 | DATA_SRC_URI = "${GITHUB_BASE_URI}/download/release-${ICU_FOLDER}/icu4c-${ICU_PV}-data.zip" |
| 104 | SRC_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 | |
| 111 | SRC_URI:append:class-target = "\ |
| 112 | file://0001-Disable-LDFLAGSICUDT-for-Linux.patch \ |
| 113 | " |
Patrick Williams | da29531 | 2023-12-05 16:48:56 -0600 | [diff] [blame] | 114 | SRC_URI[code.sha256sum] = "86ce8e60681972e60e4dcb2490c697463fcec60dd400a5f9bffba26d0b52b8d0" |
| 115 | SRC_URI[data.sha256sum] = "67d5ab39c5187e1dd0fed60a3fe52794dce9784b4c045cb85e19f5d317fd783f" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 116 | |
| 117 | UPSTREAM_CHECK_REGEX = "releases/tag/release-(?P<pver>(?!.+rc).+)" |
| 118 | GITHUB_BASE_URI = "https://github.com/unicode-org/icu/releases" |
| 119 | |
| 120 | EXTRA_OECONF:append:libc-musl = " ac_cv_func_strtod_l=no" |
| 121 | |
| 122 | PACKAGECONFIG ?= "" |
| 123 | PACKAGECONFIG[make-icudata] = ",,," |
| 124 | |
| 125 | do_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 | |
| 145 | do_make_icudata() { |
| 146 | : |
| 147 | } |
| 148 | |
| 149 | addtask make_icudata before do_configure after do_patch do_prepare_recipe_sysroot |