Files
horizon-packages/srcpkgs/libicu78/template
T

145 lines
4.2 KiB
Bash

# Template file for 'libicu78'
pkgname=libicu78
version=78.1
revision=1
build_wrksrc=source
build_style=gnu-configure
# use archive data instead of .so data for correct cross-compiling
configure_args="--with-data-packaging=archive --enable-static"
hostmakedepends="pkg-config"
checkdepends="diffutils python3"
short_desc="International Components for Unicode v${version%%.*}"
maintainer="Orphaned <orphan@voidlinux.org>"
license="ICU"
homepage="https://home.unicode.org/"
distfiles="https://github.com/unicode-org/icu/releases/download/release-${version//./-}/icu4c-${version//./_}-src.tgz"
distfiles="https://github.com/unicode-org/icu/releases/download/release-${version}/icu4c-${version}-sources.tgz"
checksum=6217f58ca39b23127605cfc6c7e0d3475fe4b0d63157011383d716cb41617886
CFLAGS="-fPIC -D_LARGE_FILE_SOURCE=1 -D_FILE_OFFSET_BITS=64"
CXXFLAGS="-fPIC -D_LARGE_FILE_SOURCE=1 -D_FILE_OFFSET_BITS=64"
# 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"
if [ "$XBPS_TARGET_LIBC" = musl ]; then
configure_args+=" ac_cv_func_strtod_l=no"
fi
subpackages="libicu78-devel icu-devel icu"
post_patch() {
if [ "$XBPS_TARGET_WORDSIZE" -lt 64 ]; then
vsed -i -e '/2147483643/s/;/>>2;/' test/intltest/ustrtest.cpp
fi
}
pre_configure() {
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
)
configure_args+=" --with-cross-build=${wrksrc}/host-icu"
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%rc*}\\\""
export CXXFLAGS="${CFLAGS} -DICU_DATA_DIR=\\\"/usr/share/icu/${version%rc*}\\\""
# makefile dependency bug: this directory needs to be created manually
mkdir -p ${wrksrc}/source/data/out/tmp
}
_rm_tools() {
# Remove files of icu-tools
for _file in ${DESTDIR}/usr/bin/* \
${DESTDIR}/usr/share/man/man1/*; do
case "${_file}" in
*icu-config*) ;;
*) rm -f ${_file} ;;
esac
done
rm -rf ${DESTDIR}/usr/share/man/man8
}
post_install() {
vlicense $wrksrc/LICENSE
if [ "${subpackages% icu}" = "${subpackages}" ]; then
_rm_tools
fi
# for little endian just use the file that's there
if [ "$XBPS_TARGET_ENDIAN" != "be" ]; then
return
fi
rm -f ${DESTDIR}/usr/share/icu/${version%rc*}/${_icu_dat}l.dat
# 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
vinstall ${wrksrc}/${_icu_data}/${_icu_dat}b.dat \
0644 usr/share/icu/${version%rc*}
}
libicu78-devel_package() {
depends="${sourcepkg}>=${version}_${revision}"
replaces="icu-devel>=0"
provides="icu-devel-${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/icu
vmove "usr/lib/*.a"
vmove usr/lib/pkgconfig
vmove usr/share/icu/${version%rc*}/config
vmove "usr/share/icu/${version%rc*}/*install*"
vmove usr/bin/icu-config
vmove "usr/share/man/man1/icu-config*"
vmove "usr/lib/*.so"
}
}
icu-devel_package() {
depends="${sourcepkg}-devel"
short_desc="${short_desc%v*}- development files"
metapackage=yes
}
icu_package() {
short_desc="${short_desc%v*}- utilities"
pkg_install() {
vmove usr/bin
vmove usr/share/man/man1
vmove usr/share/man/man8
}
}