summaryrefslogtreecommitdiffstats
path: root/system/gnu-unifont/gnu-unifont.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'system/gnu-unifont/gnu-unifont.SlackBuild')
-rw-r--r--system/gnu-unifont/gnu-unifont.SlackBuild63
1 files changed, 57 insertions, 6 deletions
diff --git a/system/gnu-unifont/gnu-unifont.SlackBuild b/system/gnu-unifont/gnu-unifont.SlackBuild
index beb17fa5c7..d9bb3ace3d 100644
--- a/system/gnu-unifont/gnu-unifont.SlackBuild
+++ b/system/gnu-unifont/gnu-unifont.SlackBuild
@@ -1,10 +1,10 @@
-#!/bin/sh
+#!/bin/bash
# Slackware build script for gnu-unifont
# Copyright 2010 crocket (crockabiscuit@gmail.com)
# Copyright 2013-2015 LukenShiro, Italy
-# Copyright 2019 Tomasz Bywalec
+# Copyright 2019-2022 Tomasz Bywalec
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -24,21 +24,31 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PRGNAM=gnu-unifont
-VERSION=${VERSION:-12.1.04}
+VERSION=${VERSION:-15.0.01}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
ARCH=noarch
-CWD=$(pwd)
+# 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}
SRCNAM=unifont
DOCFILES="ChangeLog COPYING INSTALL NEWS README"
-FONTFORMATS=${FONTFORMATS:-ttf,pcf,psf}
+FONTFORMATS=${FONTFORMATS:-otf,ttf,pcf,psf,otb}
contains()
{
@@ -71,6 +81,13 @@ if contains "$FONTFORMATS" "pcf"; then
FONTSCOPIED=1
fi
+if contains "$FONTFORMATS" "otf"; then
+ mkdir -p $PKG/usr/share/fonts/OTF
+ cp -a *.otf $PKG/usr/share/fonts/OTF
+
+ FONTSCOPIED=1
+fi
+
if contains "$FONTFORMATS" "ttf"; then
mkdir -p $PKG/usr/share/fonts/TTF
cp -a *.ttf $PKG/usr/share/fonts/TTF
@@ -85,6 +102,37 @@ if contains "$FONTFORMATS" "psf"; then
FONTSCOPIED=1
fi
+if contains "$FONTFORMATS" "otb"; then
+ mkdir -p $PKG/usr/share/fonts/misc
+
+ # Find BDF and PCF fonts and convert them to OTB format.
+ # If a font exists in both formats then convert the file in BDF format,
+ # as this is the preferred input format for the 'fonttosfnt' tool.
+
+ echo *.bdf.gz | tr ' ' '\n' | sort | sed 's/\.bdf\.gz$//g' > bdf-fonts
+ echo *.pcf.gz | tr ' ' '\n' | sort | sed 's/\.pcf\.gz$//g' > pcf-fonts
+
+ comm -2 bdf-fonts pcf-fonts | tr -d '\t' | \
+ while read font_name; do
+ input_font_file="${font_name}.bdf.gz"
+ echo "Converting '$input_font_file' to OTB format."
+
+ zcat "$input_font_file" | \
+ fonttosfnt -o "$PKG/usr/share/fonts/misc/${font_name}.otb"
+ done
+
+ comm -13 bdf-fonts pcf-fonts | \
+ while read font_name; do
+ input_font_file="${font_name}.pcf.gz"
+ echo "Converting '$input_font_file' to OTB format."
+
+ fonttosfnt -o "$PKG/usr/share/fonts/misc/${font_name}.otb" \
+ "$input_font_file"
+ done
+
+ FONTSCOPIED=1
+fi
+
cd -
if [ "$FONTSCOPIED" -eq 0 ]; then
@@ -94,6 +142,9 @@ if [ "$FONTSCOPIED" -eq 0 ]; then
exit 1
fi
+# Keep the fonts names unversioned
+find -L $PKG/usr/share -type f -name "*-$VERSION*" -exec rename -- "-$VERSION" '' {} \;
+
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCFILES $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
@@ -103,4 +154,4 @@ cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE