psftools.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #!/bin/bash
  2. # Slackware build script for psftools
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20210219 bkw: updated for v1.1.1
  6. # 20201208 bkw: updated for v1.0.14
  7. # 20191129 bkw: updated for v1.0.13
  8. # 20180112 bkw:
  9. # - BUILD=2
  10. # - install the fonts that ship with the source, for use with the console.
  11. # 20170712 bkw:
  12. # - updated for v1.0.10
  13. # - expand the README since it was a bit too terse
  14. cd $(dirname $0) ; CWD=$(pwd)
  15. PRGNAM=psftools
  16. VERSION=${VERSION:-1.1.1}
  17. BUILD=${BUILD:-1}
  18. TAG=${TAG:-_SBo}
  19. PKGTYPE=${PKGTYPE:-tgz}
  20. if [ -z "$ARCH" ]; then
  21. case "$( uname -m )" in
  22. i?86) ARCH=i586 ;;
  23. arm*) ARCH=arm ;;
  24. *) ARCH=$( uname -m ) ;;
  25. esac
  26. fi
  27. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  28. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  29. exit 0
  30. fi
  31. TMP=${TMP:-/tmp/SBo}
  32. PKG=$TMP/package-$PRGNAM
  33. OUTPUT=${OUTPUT:-/tmp}
  34. if [ "$ARCH" = "i586" ]; then
  35. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  36. LIBDIRSUFFIX=""
  37. elif [ "$ARCH" = "i686" ]; then
  38. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  39. LIBDIRSUFFIX=""
  40. elif [ "$ARCH" = "x86_64" ]; then
  41. SLKCFLAGS="-O2 -fPIC"
  42. LIBDIRSUFFIX="64"
  43. else
  44. SLKCFLAGS="-O2"
  45. LIBDIRSUFFIX=""
  46. fi
  47. set -e
  48. rm -rf $PKG
  49. mkdir -p $TMP $PKG $OUTPUT
  50. cd $TMP
  51. rm -rf $PRGNAM-$VERSION
  52. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  53. cd $PRGNAM-$VERSION
  54. chown -R root:root .
  55. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  56. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  57. # --docdir not supported
  58. CFLAGS="$SLKCFLAGS" \
  59. CXXFLAGS="$SLKCFLAGS" \
  60. ./configure \
  61. --prefix=/usr \
  62. --libdir=/usr/lib${LIBDIRSUFFIX} \
  63. --sysconfdir=/etc \
  64. --localstatedir=/var \
  65. --mandir=/usr/man \
  66. --disable-static \
  67. --enable-shared \
  68. --build=$ARCH-slackware-linux
  69. make
  70. make install-strip DESTDIR=$PKG
  71. rm -f $PKG/usr/lib$LIBDIRSUFFIX/*.la
  72. # 20180112 bkw: install the example fonts that ship with the source.
  73. psfdir=$PKG/usr/share/kbd/consolefonts
  74. mkdir -p $psfdir
  75. # I thought to also convert to X fonts, but the results are unusable
  76. # because the fonts generated by psf2bdf need to be "tidied up" according
  77. # to the man page... and I don't know (or care enough to find out right
  78. # now) how to do this in a shell script. X font code left in place,
  79. # commented out, for reference:
  80. ## pcfdir=$PKG/usr/share/fonts/misc
  81. ## mkdir -p $pcfdir
  82. cd Fonts
  83. for fonttxt in *.txt; do
  84. font="$( echo $fonttxt | sed 's,\.txt$,,' )"
  85. # console font:
  86. ../tools/txt2psf $fonttxt > $font.psfu
  87. gzip -9c $font.psfu > $psfdir/$font.psfu.gz
  88. ## # X font:
  89. ## ../tools/psf2bdf --fontname=$font --iso10646 $font.psfu > $font.bdf
  90. ## bdftopcf $font.bdf | gzip -9c > $pcfdir/$font.pcf.gz
  91. done
  92. cd -
  93. find $PKG/usr/man -type f -exec gzip -9 {} \;
  94. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  95. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  96. cp -a AUTHORS COPYING ChangeLog README NEWS TODO doc/*.txt \
  97. $PKG/usr/doc/$PRGNAM-$VERSION
  98. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  99. mkdir -p $PKG/install
  100. cat $CWD/slack-desc > $PKG/install/slack-desc
  101. # X fonts would need this:
  102. ## cat $CWD/doinst.sh > $PKG/install/doinst.sh
  103. # Contents of doinst.sh would be:
  104. ## # Update the X font indexes:
  105. ## if [ -x /usr/bin/mkfontdir -a -x /usr/bin/mkfontscale ]; then
  106. ## ( cd usr/share/fonts/misc
  107. ## /usr/bin/mkfontscale .
  108. ## /usr/bin/mkfontdir .
  109. ## )
  110. ## fi
  111. ## if [ -x /usr/bin/fc-cache ]; then
  112. ## /usr/bin/fc-cache -f
  113. ## fi
  114. cd $PKG
  115. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE