aboutsummaryrefslogtreecommitdiff
path: root/system/ttf-ancient-fonts/ttf-ancient-fonts.SlackBuild
blob: fe40990ca195496b1718b10c1c6dee44c0ee0a55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash

# Slackware build script for ttf-ancient-fonts

# Written by B. Watson (yalhcru@gmail.com)

# 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".

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=ttf-ancient-fonts
VERSION=${VERSION:-2.60}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
ARCH=noarch

# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
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

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE