# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=xorg-fonts-encodings
pkgver=1.1.0
pkgrel=1
pkgdesc="X.org font encoding files"
arch=(any)
url="https://gitlab.freedesktop.org/xorg/font/encodings"
license=('LicenseRef-xorg-fonts-encodings')
makedepends=('xorg-mkfontscale' 'xorg-util-macros' 'xorg-font-util' 'meson')
groups=('xorg-fonts' 'xorg')
options=(!makeflags)
source=(https://xorg.freedesktop.org//releases/individual/font/encodings-${pkgver}.tar.xz{,.sig})
sha512sums=('ae912e120847954f5756193cc8860f50ada6c79bb3ba44f7f0cd1913b13aeed7885e140282cb47989a93fae0a0e8cedebe9a2420f65b1936b40192dc7d208427'
            'SKIP')

build() {
  arch-meson encodings-$pkgver build

  # Print config
  meson configure build

  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"

  install -Dm644 encodings-$pkgver/COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"

  # regenerate encodngs file not to include non-compressed versions
  cd "$pkgdir"/usr/share/fonts/encodings/large
  mkfontscale -b -s -l -n -r -p /usr/share/fonts/encodings/large -e . .
  cd "$pkgdir"/usr/share/fonts/encodings/
  mkfontscale -b -s -l -n -r -p /usr/share/fonts/encodings -e . -e large .
}
