fonts-opendyslexic.SlackBuild 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. # Slackware build script for fonts-opendyslexic
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # Yes, I know, there are newer versions of this at github. However,
  6. # they lack the compiled OpenDyslexicMono (terminal) font, and the tools
  7. # required to compile the source would require me submitting 15 or 20
  8. # python SlackBuilds for the tools and all their deps. Not interested.
  9. # The Debian package only includes the .otf fonts. That's what I'll do
  10. # by default, but I'll support installing the other types if needed.
  11. cd $(dirname $0) ; CWD=$(pwd)
  12. PRGNAM=fonts-opendyslexic
  13. VERSION=${VERSION:-20160623}
  14. BUILD=${BUILD:-1}
  15. TAG=${TAG:-_SBo}
  16. PKGTYPE=${PKGTYPE:-tgz}
  17. SRCDIR=open-dyslexic-$VERSION-Stable
  18. ARCH=noarch
  19. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  20. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  21. exit 0
  22. fi
  23. TMP=${TMP:-/tmp/SBo}
  24. PKG=$TMP/package-$PRGNAM
  25. OUTPUT=${OUTPUT:-/tmp}
  26. set -e
  27. rm -rf $PKG
  28. mkdir -p $TMP $PKG $OUTPUT
  29. cd $TMP
  30. rm -rf $SRCDIR
  31. tar xvf $CWD/${PRGNAM}_$VERSION.orig.tar.gz
  32. cd $SRCDIR
  33. chown -R root:root .
  34. # rotten upstream perms, do not revert to template please.
  35. find . -type d -exec chmod 755 {} \+
  36. find . -type f -exec chmod 644 {} \+
  37. # See README
  38. FORMATS="$( echo ${FORMATS:-otf} | tr A-Z a-z )"
  39. ALLFMT="otf ttf eot woff svg"
  40. [ "$FORMATS" = "all" ] && FORMATS="$ALLFMT"
  41. for i in $FORMATS; do
  42. ok=0
  43. for j in $ALLFMT; do
  44. [ "$i" = "$j" ] && ok=1
  45. done
  46. if [ "$ok" != "1" ]; then
  47. cat <<EOF
  48. ***
  49. *** Unsupported font format '$i'. Supported formats are: $ALLFMT all
  50. ***
  51. EOF
  52. exit 1
  53. fi
  54. done
  55. mkdir -p $PKG/usr/share/fonts
  56. for fmt in $FORMATS; do
  57. FMT=$( echo $fmt | tr a-z A-Z )
  58. cp -a $fmt $PKG/usr/share/fonts/$FMT
  59. [ "$FMT" = "TTF" -o "$FMT" = "OTF" ] && MKFDIRS+="$FMT "
  60. DESCFMT+=" $FMT"
  61. done
  62. # I thought about including screenshots/ in the doc dir, but they're
  63. # more like an advertisement (anyone building this package has already
  64. # "bought" the product).
  65. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  66. cp -a README* $PKG/usr/doc/$PRGNAM-$VERSION
  67. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  68. mkdir -p $PKG/install
  69. sed "s,@DESCFMT@,$DESCFMT," $CWD/slack-desc > $PKG/install/slack-desc
  70. # Only install doinst.sh if TTF and/or OTF fonts are included, because
  71. # fc-cache and X only know about these 2 types.
  72. if [ -n "$MKFDIRS" ]; then
  73. sed "s,@MKFDIRS@,$MKFDIRS," $CWD/doinst.sh > $PKG/install/doinst.sh
  74. fi
  75. cd $PKG
  76. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE