commit 666927388ea4326932aae84b09c35f9f45f4d466 Author: xhaa123 Date: Mon Apr 15 22:53:16 2024 +0800 mkfontscale 1.2.3-1 diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..bdff0c8 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,44 @@ +# This is an example PKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Maintainer: Future Linux Team +pkgname=mkfontscale +pkgver=1.2.3 +pkgrel=1 +pkgdesc="Create an index of scalable font files for X" +arch=('x86_64') +url="https://gitlab.freedesktop.org/xorg/app/mkfontscale" +license=('MIT-open-group' 'X11' 'MIT' 'HPND-sell-variant') +groups=('xorg-apps' 'xorg') +depends=('freetype2' 'libfontenc' 'zlib' 'glibc') +makedepends=('util-macros' 'xorgproto') +install=${pkgname}.install +source=(https://www.x.org/pub/individual/app/${pkgname}-${pkgver}.tar.xz + mkfontscale.hook + mkfontscale.script) +sha256sums=(2921cdc344f1acee04bcd6ea1e29565c1308263006e134a9ee38cf9c9d6fe75e + 7e713ad3a2976706c63081204fe29c3bf3414ae5b4dd1de6bd9cb56ce58398be + 82340327e9820e0713c734b77a8c3033a8b88d19d72e0a23b4123c2b79c3bcb7) + +build() { + cd ${pkgname}-${pkgver} + + ${CONFIGURE} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --disable-static + + make +} + +package() { + cd ${pkgname}-${pkgver} + + make DESTDIR=${pkgdir} install + + install -Dm644 ${srcdir}/mkfontscale.hook ${pkgdir}/usr/share/libalpm/hooks/mkfontscale.hook + install -Dm755 ${srcdir}/mkfontscale.script ${pkgdir}/usr/share/libalpm/scripts/mkfontscale + +} diff --git a/mkfontscale.hook b/mkfontscale.hook new file mode 100644 index 0000000..26ce4b4 --- /dev/null +++ b/mkfontscale.hook @@ -0,0 +1,13 @@ +[Trigger] +Type = Path +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/mkfontscale +NeedsTargets diff --git a/mkfontscale.install b/mkfontscale.install new file mode 100644 index 0000000..33a9832 --- /dev/null +++ b/mkfontscale.install @@ -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/mkfontscale + echo " done." + fi +} diff --git a/mkfontscale.script b/mkfontscale.script new file mode 100644 index 0000000..9c9f98d --- /dev/null +++ b/mkfontscale.script @@ -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