# Description: Unicode Character Database
# URL: https://www.unicode.org/
# Maintainer: Tim Biermann, tbier at posteo dot de

name=unicode-character-database
version=15.0.0
release=1
source=(https://www.unicode.org/Public/zipped/$version/UCD.zip
  https://www.unicode.org/Public/zipped/$version/Unihan.zip)
renames=(UCD-$version.zip Unihan-$version.zip)

build() {
  cp $PKGMK_SOURCE_DIR/UCD-$version.zip .
  cp $PKGMK_SOURCE_DIR/Unihan-$version.zip .
  for _f in UCD Unihan; do
    install -Dm644 $_f-$version.zip $PKG/usr/share/unicode/$_f.zip
    bsdtar -C $PKG/usr/share/unicode -x --no-same-owner --no-same-permissions -f $_f-$version.zip
  done

  ln -s . "$PKG/usr/share/unicode/ucd"
  for _f in $name unicode-data unidata; do
    ln -s unicode "$PKG/usr/share/$_f"
  done
}
