# $Id$
# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=ttf-dejavu
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.37
pkgrel=4
pkgdesc="Font family based on the Bitstream Vera Fonts with a wider range of characters (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://dejavu-fonts.github.io/"
msys2_references=(
  'purl: pkg:github/dejavu-fonts/dejavu-fonts'
)
license=('custom')
depends=("${MINGW_PACKAGE_PREFIX}-fontconfig")
# 'xorg-fonts-encodings' 'xorg-mkfontscale' 'xorg-mkfontdir')
source=(https://downloads.sourceforge.net/project/dejavu/dejavu/${pkgver}/dejavu-fonts-ttf-${pkgver}.tar.bz2
        remove-generic-name-assignment-and-aliasing.patch)
sha256sums=('fa9ca4d13871dd122f61258a80d01751d603b4d3ee14095d65453b4e846e17d7'
            '21d85a4f6ea7856074a4eb5c5fce6a10e764d11ff4336e92c4f009815efebb0c')

prepare() {
  cd dejavu-fonts-ttf-$pkgver
  patch -Np1 -i ../remove-generic-name-assignment-and-aliasing.patch
}

package() {
  install -dm755 "${pkgdir}"${MINGW_PREFIX}/etc/fonts/conf.avail
  install -dm755 "${pkgdir}"${MINGW_PREFIX}/etc/fonts/conf.d
  install -dm755 "${pkgdir}"${MINGW_PREFIX}/share/fonts/TTF

  cd "${srcdir}"/dejavu-fonts-ttf-${pkgver}
  install -m644 ttf/*.ttf "${pkgdir}"${MINGW_PREFIX}/share/fonts/TTF/
  install -m644 fontconfig/*.conf "${pkgdir}"${MINGW_PREFIX}/etc/fonts/conf.avail/

  pushd "${pkgdir}"${MINGW_PREFIX}/etc/fonts/conf.avail
  for config in *; do
    ln -sf ../conf.avail/${config} ../conf.d/${config}
  done
  popd

  install -Dm644 LICENSE "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}
