summaryrefslogtreecommitdiffstats
path: root/system/univga-font/univga-font.SlackBuild
blob: dffa83b51b51e1a1fed5064a66b9ff44f55a3a6f (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash

# Slackware build script for univga-font

# Written by B. Watson (urchlay@slackware.uk)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# VERSION taken from the datestamp of the tarball.

# 20230306 bkw: BUILD=4
# - add douninst.sh.
# - fix slack-desc formatting.
# - mention bdf2psf.pl in README.

# 20201206 bkw: BUILD=3, added OTB font since -current's pango wants it.
#               Also add PCF (disabled by default). Based on a patch from
#               Tomasz Bywalec. Update README. Have slack-desc list the
#               font types included in the package.

# 20191224 bkw: BUILD=2, xset fp rehash in doinst.sh.

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

PRGNAM=univga-font
VERSION=${VERSION:-20021031}
BUILD=${BUILD:-4}
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

TARNAME=uni-vga
FNAME=u_vga16
DIRNAME=${TARNAME/-/_}

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $DIRNAME
tar xvf $CWD/$TARNAME.tgz
cd $DIRNAME
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 {} \+

# Defaults:
PSF="${PSF:-yes}"
BDF="${BDF:-yes}"
OTB="${OTB:-yes}"
PCF="${PCF:-no}"

# modern perl needs a slight change to the bdf2psf.pl script, and modern
# psfaddtable has different options than whatever this was written for.
patch -p1 < $CWD/buildfix.diff

# The console fonts. They're very similar to the ones shipped with the kbd
# package, but not identical.
if [ "$PSF" = "yes" ]; then
  make allfonts
  mkdir -p $PKG/usr/share/kbd/consolefonts/
  for i in *.psf; do
    gzip -9c < $i > $PKG/usr/share/kbd/consolefonts/${i}u.gz
  done
  ok=yes
fi

# The X font. Use with xterm or such, very nice.
if [ "$BDF" = "yes" ]; then
  mkdir -p $PKG/usr/share/fonts/misc
  gzip -9c < $FNAME.bdf > $PKG/usr/share/fonts/misc/$FNAME.bdf.gz
  ok=yes
fi

# If you *really* want the PCF version, you can have it via PCF=yes.
# It's a trade-off: the compiled PCF is bigger than the BDF, and after
# gzipping both, it's still bigger. The BDF supposedly takes longer
# to load when first accessed, but I doubt anyone's got a slow enough
# system to notice.
if [ "$PCF" = "yes" ]; then
  mkdir -p $PKG/usr/share/fonts/misc
  bdftopcf -t $FNAME.bdf | gzip -9c > $PKG/usr/share/fonts/misc/$FNAME.pcf.gz
  ok=yes
fi

# OpenType Bitmap (OTB) fonts, compatible with recent versions of Pango.
# Necessary for -current and eventually 15.0. Support added by Tomasz Bywalec.
if [ "$OTB" = "yes" ]; then
  mkdir -p $PKG/usr/share/fonts/misc
  fonttosfnt -o "$PKG/usr/share/fonts/misc/$FNAME.otb" $FNAME.bdf
  ok=yes
fi

if [ "$ok" != "yes" ]; then
  echo "*** No fonts selected to be included in the package." 1>&2
  echo "*** At least one of the PCF BDF PSF OTB environment variables must be 'yes'." 1>&2
  exit 1
fi

# include the converter script, someone might find it useful.
mkdir -p $PKG/usr/bin
install -m0755 bdf2psf.pl $PKG/usr/bin

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a *.lsm $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# 20230306 bkw: douninst.sh makes package removal cleaner. it rebuilds
# fonts.{dir|scale} after our fonts get removed, removes the "univga"
# alias, and rebuilds the font cache.
mkdir -p $PKG/install
sed -e "s,@PCF@,$PCF," \
    -e "s,@BDF@,$BDF," \
    -e "s,@PSF@,$PSF," \
    -e "s,@OTB@,$OTB," \
 $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/douninst.sh > $PKG/install/douninst.sh

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