slackbuilds/system/ttf-ancient-fonts/ttf-ancient-fonts.SlackBuild

100 lines
3.3 KiB
Bash

#!/bin/bash
# Slackware build script for ttf-ancient-fonts
# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# Notes to self (or anyone else who cares):
# The tarball includes both hinted and unhinted versions of the fonts. The
# Debian package installs <font>.ttf and <font>_hint.ttf for all the
# fonts. However, if I do this, it's impossible to select the _hint
# versions in any application (because the TTF names conflict). Since
# it's possible to disable hinting in fontconfig or specific apps,
# I'm only going to include the _hint versions here by default. User
# can override with HINTS=no. The .otf fonts only come in one variety,
# so they're always installed as-is.
# There are newer versions of these fonts at https://dn-works.com/ufas/
# but they're under what I consider a ludicrously restrictive license,
# so I'm not going to touch them with a 10 foot pole. The symbola-font-ttf
# package is the restrictive version, so I've made it possible to include
# the older (free-to-use) Symbola here, though it's not the default.
# There's no documentation in the tarball, so I borrow it from Debian.
# There's no license info in the tarball, and neither the original site
# nor web.archive.org still has has the "un-Debianized" zip files that
# presumably included the licenses, so I'm including Debian's copyright
# file that asserts these fonts are "free for any use".
# 20230308 bkw: BUILD=2, add douninst.sh.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=ttf-ancient-fonts
VERSION=${VERSION:-2.60}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
ARCH=noarch
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
HINTS="${HINTS:-yes}"
# If the user requested unhinted fonts, don't even bother to extract
# the hinted versions.
[ "$HINTS" != "yes" ] && UN=un && TAROPT="--exclude=*_hint.ttf"
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION.orig
tar xvf $CWD/${PRGNAM}_$VERSION.orig.tar.xz $TAROPT
cd $PRGNAM-$VERSION.orig
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
HAS_SYMBOLA=yes
[ "${SYMBOLA:-no}" = "no" ] && rm -f Symbola* && HAS_SYMBOLA=no
# If we're doing hinted fonts, get rid of the unhinted ones. I can't think
# of a sane way to avoid extracting them in the first place...
[ "$HINTS" = "yes" ] && /bin/ls *.ttf | grep -v _hint | xargs rm -f
for i in TTF OTF; do
mkdir -p $PKG/usr/share/fonts/$i
install -m0644 *.$( echo $i | tr A-Z a-z) $PKG/usr/share/fonts/$i
done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
for i in README.debian copyright.debian; do
cat $CWD/$i > $PKG/usr/doc/$PRGNAM-$VERSION/$i
done
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
sed "s,@UN@,$UN," $CWD/slack-desc > $PKG/install/slack-desc
if [ "$HAS_SYMBOLA" = "yes" ]; then
sed -i \
'17s/$/ This package includes the Symbola font, and will conflict with symbola-font-ttf/' \
$PKG/install/slack-desc
fi
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cp $PKG/install/doinst.sh $PKG/install/douninst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE