# Template file for 'icu' # NOTE: Please convert this package to support progressive updates with the # next soname bump. pkgname=icu version=64.2 revision=2 wrksrc=icu build_wrksrc=source build_style=gnu-configure # use archive data instead of .so data for correct cross-compiling configure_args="--with-data-packaging=archive" hostmakedepends="pkg-config" short_desc="Robust and fully-featured Unicode libraries" maintainer="Orphaned " license="ICU" homepage="http://www.icu-project.org/" distfiles="http://download.icu-project.org/files/icu4c/${version}/icu4c-${version//./_}-src.tgz" checksum=627d5d8478e6d96fc8c90fed4851239079a561a6a8b9e48b0892f24e82d31d6c if [ "$CROSS_BUILD" ]; then configure_args+=" --with-cross-build=${XBPS_BUILDDIR}/${wrksrc}/host-icu" fi # we will be managing icudata manually, because when cross-compiling for # another endianness the output data is broken... fortunately, we can use # icupkg to convert host-endianness data to target-endianness data _icu_dat="icudt${version%.*}" _icu_data="source/data/in" pre_configure() { # strtod_l() is not supported by musl; also xlocale.h is missing # It is not possible to disable its use via configure switches or env vars # so monkey patching is needed. Idea was stollen from openembedded # https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-support/icu/icu.inc#L30 # http://git.alpinelinux.org/cgit/aports/tree/main/icu/APKBUILD?id=46736e7b8040becc9f69ad6d2c2d317a52d5485b#n34 case "${XBPS_TARGET_MACHINE}" in *-musl) sed -i -e 's,DU_HAVE_STRTOD_L=1,DU_HAVE_STRTOD_L=0,' configure ;; esac if [ "$CROSS_BUILD" ]; then # Configure and build for host. mkdir host-build ( cd host-build env CC=cc LD=ld CXX=g++ AR=ar RANLIB=ranlib \ AS=as STRIP=strip CFLAGS="-Os -fPIE" CXXFLAGS="-Os -fPIE" \ LDFLAGS="" ../configure --prefix=/ make ${makejobs} mkdir -p ${wrksrc}/host-icu/config cp config/icucross.* ${wrksrc}/host-icu/config make DESTDIR=${wrksrc}/host-icu install mv ${wrksrc}/host-icu/sbin/* ${wrksrc}/host-icu/bin make distclean ) fi # libicudata must be linked to libc, otherwise it's soft-float on ARM. # probably other stuff breaks too, so let's just do it. # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653457 sed -e 's,-nostdlib,,g' -i ${wrksrc}/source/config/mh-linux export CFLAGS="${CFLAGS} -DICU_DATA_DIR=\\\"/usr/share/icu/${version}\\\"" export CXXFLAGS="${CFLAGS} -DICU_DATA_DIR=\\\"/usr/share/icu/${version}\\\"" # makefile dependency bug: this directory needs to be created manually mkdir -p ${wrksrc}/source/data/out/tmp } post_install() { vlicense $wrksrc/LICENSE # handled separately rm -f ${DESTDIR}/usr/share/icu/${version}/${_icu_dat}${XBPS_TARGET_ENDIAN%e}.dat # for little endian just use the file that's there if [ "$XBPS_TARGET_ENDIAN" != "be" ]; then return fi # for big endian, we need to convert the file that's there with icupkg local _icupkg_path="${DESTDIR}/usr" if [ "$CROSS_BUILD" ]; then _icupkg_path="${wrksrc}/host-icu" fi rm -f ${wrksrc}/${_icu_data}/${_icu_dat}b.dat LD_LIBRARY_PATH="${_icupkg_path}/lib" ${_icupkg_path}/bin/icupkg -tb \ ${wrksrc}/${_icu_data}/${_icu_dat}l.dat \ ${wrksrc}/${_icu_data}/${_icu_dat}b.dat } icu-devel_package() { depends="libstdc++-devel icu-libs>=${version}_${revision}" short_desc+=" - development files" pkg_install() { vmove usr/include vmove usr/lib/icu vmove usr/lib/pkgconfig vmove usr/share/icu vmove usr/bin/icu-config vmove "usr/share/man/man1/icu-config*" vmove "usr/lib/*.so" } } icu-libs_package() { short_desc+=" - shared libs" pkg_install() { vmove "usr/lib/*.so.*" # install data manually vmkdir "usr/share/icu/${version}" install -Dm644 \ ${wrksrc}/${_icu_data}/${_icu_dat}${XBPS_TARGET_ENDIAN%e}.dat \ ${PKGDESTDIR}/usr/share/icu/${version} } }