fonts-opendyslexic.SlackBuild 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. # 20230307 bkw: BUILD=2, add douninst.sh.
  12. cd $(dirname $0) ; CWD=$(pwd)
  13. PRGNAM=fonts-opendyslexic
  14. VERSION=${VERSION:-20160623}
  15. BUILD=${BUILD:-2}
  16. TAG=${TAG:-_SBo}
  17. PKGTYPE=${PKGTYPE:-tgz}
  18. SRCDIR=open-dyslexic-$VERSION-Stable
  19. ARCH=noarch
  20. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  21. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  22. exit 0
  23. fi
  24. TMP=${TMP:-/tmp/SBo}
  25. PKG=$TMP/package-$PRGNAM
  26. OUTPUT=${OUTPUT:-/tmp}
  27. set -e
  28. rm -rf $PKG
  29. mkdir -p $TMP $PKG $OUTPUT
  30. cd $TMP
  31. rm -rf $SRCDIR
  32. tar xvf $CWD/${PRGNAM}_$VERSION.orig.tar.gz
  33. cd $SRCDIR
  34. chown -R root:root .
  35. # rotten upstream perms, do not revert to template please.
  36. find . -type d -exec chmod 755 {} \+
  37. find . -type f -exec chmod 644 {} \+
  38. # See README
  39. FORMATS="$( echo ${FORMATS:-otf} | tr A-Z a-z )"
  40. ALLFMT="otf ttf eot woff svg"
  41. [ "$FORMATS" = "all" ] && FORMATS="$ALLFMT"
  42. for i in $FORMATS; do
  43. ok=0
  44. for j in $ALLFMT; do
  45. [ "$i" = "$j" ] && ok=1
  46. done
  47. if [ "$ok" != "1" ]; then
  48. cat <<EOF
  49. ***
  50. *** Unsupported font format '$i'. Supported formats are: $ALLFMT all
  51. ***
  52. EOF
  53. exit 1
  54. fi
  55. done
  56. mkdir -p $PKG/usr/share/fonts
  57. for fmt in $FORMATS; do
  58. FMT=$( echo $fmt | tr a-z A-Z )
  59. cp -a $fmt $PKG/usr/share/fonts/$FMT
  60. [ "$FMT" = "TTF" -o "$FMT" = "OTF" ] && MKFDIRS+="$FMT "
  61. DESCFMT+=" $FMT"
  62. done
  63. # I thought about including screenshots/ in the doc dir, but they're
  64. # more like an advertisement (anyone building this package has already
  65. # "bought" the product).
  66. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  67. cp -a README* $PKG/usr/doc/$PRGNAM-$VERSION
  68. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  69. mkdir -p $PKG/install
  70. sed "s,@DESCFMT@,$DESCFMT," $CWD/slack-desc > $PKG/install/slack-desc
  71. # Only install doinst.sh if TTF and/or OTF fonts are included, because
  72. # fc-cache and X only know about these 2 types.
  73. # 20230307 bkw: the same code works to clean up after removepkg.
  74. if [ -n "$MKFDIRS" ]; then
  75. sed "s,@MKFDIRS@,$MKFDIRS," $CWD/doinst.sh > $PKG/install/doinst.sh
  76. cp $PKG/install/doinst.sh $PKG/install/douninst.sh
  77. fi
  78. cd $PKG
  79. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE