xorg:mkfontdir: port to hook

This commit is contained in:
Chaoting Liu 2018-08-02 09:53:03 +02:00
parent ff2651fe0c
commit e5a7ce0178
4 changed files with 39 additions and 2 deletions

View File

@ -3,7 +3,7 @@
pkgname=xorg-mkfontdir pkgname=xorg-mkfontdir
pkgver=1.0.7 pkgver=1.0.7
pkgrel=1 pkgrel=2
pkgdesc="Create an index of X font files in a directory" pkgdesc="Create an index of X font files in a directory"
arch=(any) arch=(any)
url="http://xorg.freedesktop.org/" url="http://xorg.freedesktop.org/"
@ -11,7 +11,10 @@ license=('custom')
depends=('sh' 'xorg-mkfontscale') depends=('sh' 'xorg-mkfontscale')
makedepends=('xorg-util-macros') makedepends=('xorg-util-macros')
groups=('xorg' 'xorg-apps') groups=('xorg' 'xorg-apps')
source=(http://xorg.freedesktop.org/archive/individual/app/mkfontdir-${pkgver}.tar.bz2) install=xorg-mkfontdir.install
source=(http://xorg.freedesktop.org/archive/individual/app/mkfontdir-${pkgver}.tar.bz2
xorg-mkfontdir.hook
xorg-mkfontdir.script)
sha1sums=('3c06dad8a5fbf7362b51fb7d6b1ab805eba40336') sha1sums=('3c06dad8a5fbf7362b51fb7d6b1ab805eba40336')
build() { build() {
@ -25,4 +28,8 @@ package() {
make DESTDIR="${pkgdir}" install make DESTDIR="${pkgdir}" install
install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}" install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/" install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
# pacman hook
install -Dm644 ../xorg-mkfontdir.hook "${pkgdir}/usr/share/libalpm/hooks/xorg-mkfontdir.hook"
install -D ../xorg-mkfontdir.script "${pkgdir}/usr/share/libalpm/scripts/xorg-mkfontdir"
} }

View File

@ -0,0 +1,13 @@
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Operation = Remove
Target = usr/share/fonts/*/
Target = !usr/share/fonts/encodings/*
[Action]
Description = Updating X fontdir indices...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/xorg-mkfontdir
NeedsTargets

View File

@ -0,0 +1,8 @@
post_install() {
if [[ -d /usr/share/fonts ]]; then
echo -n "Creating X fontdir indices..."
find /usr/share/fonts -mindepth 1 -path /usr/share/fonts/encodings -prune \
-o -type d -printf '%p/\n' | /usr/share/libalpm/scripts/xorg-mkfontdir
echo " done."
fi
}

View File

@ -0,0 +1,9 @@
#!/bin/bash
sort -r | while read -r d; do
[[ -d $d ]] || continue
mkfontscale "$d"
mkfontdir "$d"
find "$d"fonts.{scale,dir} -maxdepth 0 -size -3c -delete
rmdir --ignore-fail-on-non-empty "$d"
done