#!/bin/bash

# Slackware build script for quivira-font

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

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

# Original URL:
# http://www.quivira-font.com/files/Quivira.otf
# Not used in .info file because it'll get overwritten with the next version,
# whenever they release it.
# Since I have to host the file myself, I went ahead and renamed it so it
# has the version number in the filename.

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

PRGNAM=quivira-font
VERSION=${VERSION:-4.1}
BUILD=${BUILD:-1}
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

# Simplest package creation procedure ever:
rm -rf $PKG
mkdir -p $OUTPUT
install -D -m0644 $CWD/$PRGNAM-$VERSION.otf $PKG/usr/share/fonts/OTF/Quivira.otf

# No docs, include our own README, mostly cribbed from the homepage,
# with an extra bit about using this with urxvt (since that's what I
# actually use it for).
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cat $CWD/README > $PKGDOC/README
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
# *not* a typo, the douninst.sh is the same as doinst.sh:
cat $CWD/doinst.sh > $PKG/install/douninst.sh

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