Skip to content

Instantly share code, notes, and snippets.

@rawlingsj
Created September 26, 2022 17:04
Show Gist options
  • Save rawlingsj/3b35e29164424c6c1c8c5dc9574d8a46 to your computer and use it in GitHub Desktop.
Save rawlingsj/3b35e29164424c6c1c8c5dc9574d8a46 to your computer and use it in GitHub Desktop.
# Contributor: Sergey Lukin <[email protected]>
# Contributor: Jakub Jirutka <[email protected]>
# Maintainer: Natanael Copa <[email protected]>
pkgname=icu
pkgver=71.1
pkgrel=4
pkgdesc="International Components for Unicode library"
url="https://icu.unicode.org/"
arch="all"
license="MIT ICU Unicode-TOU"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="python3 py3-yaml"
checkdepends="diffutils"
install="$pkgname-data-en.post-install"
subpackages="
$pkgname-static
$pkgname-dev
$pkgname-doc
$pkgname-libs
$pkgname-data-en:_data_en:noarch
$pkgname-data-full:_data_full:noarch
"
source="https://github.com/unicode-org/icu/releases/download/release-${pkgver}/icu4c-${pkgver}-src.tgz
https://github.com/unicode-org/icu/releases/download/release-${pkgver}/icu4c-${pkgver}-data.zip
https://github.com/unicode-org/icu/releases/download/release-${pkgver}/icu4c-${pkgver}-data-bin-b.zip
https://github.com/unicode-org/icu/releases/download/release-${pkgver}/icu4c-${pkgver}-data-bin-l.zip
001-fix-heap-buffer-overflow.patch
skip-flawed-tests.patch
data-filter-en.yml
"
builddir="$srcdir/icu/source"
# secfixes:
# 66.1-r0:
# - CVE-2020-21913
# 65.1-r1:
# - CVE-2020-10531
# 57.1-r1:
# - CVE-2016-6293
# 58.1-r1:
# - CVE-2016-7415
# 58.2-r2:
# - CVE-2017-7867
# - CVE-2017-7868
case "$CARCH" in
s390x) _icudtfile=icudt${pkgver%%.*}b.dat;;
*) _icudtfile=icudt${pkgver%%.*}l.dat;;
esac
prepare() {
default_prepare
rm -rf data
mv "$srcdir"/data .
}
build() {
_yaml2json "$srcdir"/data-filter-en.yml > data-filter-en.json
export ICU_DATA_FILTER_FILE="./data-filter-en.json"
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--with-data-packaging=archive \
--disable-samples \
--enable-static \
--mandir=/usr/share/man
make
}
check() {
# Tests need full data.
mv data/out/$_icudtfile data/out/$_icudtfile.en
cp -a "$srcdir"/$_icudtfile data/out/
CINTLTST_OPTS='-w' make check
mv data/out/$_icudtfile.en data/out/$_icudtfile
}
package() {
make -j1 DESTDIR="$pkgdir" install
chmod +x "$pkgdir"/usr/bin/icu-config
install -Dm644 "$srcdir"/icu/license.html -t "$pkgdir"/usr/share/licenses/icu/
}
dev() {
default_dev
amove usr/lib/icu
amove usr/lib/libicutest.so.*
amove usr/share/icu/*/LICENSE
amove usr/share/icu/*/config
amove usr/share/icu/*/install-sh
amove usr/share/icu/*/mkinstalldirs
}
libs() {
pkgdesc="$pkgdesc (libraries)"
depends="$pkgname-data=$pkgver-r$pkgrel"
replaces="icu"
# Data stub required by the Common and I18n libraries.
amove usr/lib/libicudata.so.[0-9]*
# A library that contains many locale based internationalization (i18n) functions.
amove usr/lib/libicui18n.so.[0-9]*
# An optional library that provides a stdio like API with Unicode support.
amove usr/lib/libicuio.so.[0-9]*
# Base library required by all other ICU libraries.
amove usr/lib/libicuuc.so.[0-9]*
# An internal library that contains internal APIs that are only used by ICU’s tools.
# Keep in the base package.
#amove usr/lib/libicutu.so.[0-9]*
}
_data_en() {
pkgdesc="Stripped down ICU data with only en_US/GB locale and no legacy charset converters"
provides="$pkgname-data=$pkgver-r$pkgrel"
provider_priority=100 # highest (other provider is icu-data-full)
replaces="$pkgname-data<71.1-r1"
amove usr/share/icu/$pkgver/$_icudtfile
}
_data_full() {
pkgdesc="Full ICU data"
provides="$pkgname-data=$pkgver-r$pkgrel"
provider_priority=10 # lowest (other provider is icu-data-en)
replaces="$pkgname-data<71.1-r1"
install -D -m644 "$srcdir"/$_icudtfile -t "$subpkgdir"/usr/share/icu/$pkgver/
}
_yaml2json() {
python3 -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout)' <"$1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment