bdfresize.SlackBuild 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/bin/bash
  2. # Slackware build script for bdfresize
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20210910 bkw: BUILD=2
  6. # - fix FONTBOUNDINGBIX typo.
  7. # - add check_factor_args.diff.
  8. cd $(dirname $0) ; CWD=$(pwd)
  9. PRGNAM=bdfresize
  10. VERSION=${VERSION:-1.5}
  11. BUILD=${BUILD:-2}
  12. TAG=${TAG:-_SBo}
  13. PKGTYPE=${PKGTYPE:-tgz}
  14. if [ -z "$ARCH" ]; then
  15. case "$( uname -m )" in
  16. i?86) ARCH=i586 ;;
  17. arm*) ARCH=arm ;;
  18. *) ARCH=$( uname -m ) ;;
  19. esac
  20. fi
  21. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  22. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  23. exit 0
  24. fi
  25. TMP=${TMP:-/tmp/SBo}
  26. PKG=$TMP/package-$PRGNAM
  27. OUTPUT=${OUTPUT:-/tmp}
  28. if [ "$ARCH" = "i586" ]; then
  29. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "i686" ]; then
  32. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "x86_64" ]; then
  35. SLKCFLAGS="-O2 -fPIC"
  36. LIBDIRSUFFIX="64"
  37. else
  38. SLKCFLAGS="-O2"
  39. LIBDIRSUFFIX=""
  40. fi
  41. set -e
  42. rm -rf $PKG
  43. mkdir -p $TMP $PKG $OUTPUT
  44. cd $TMP
  45. rm -rf $PRGNAM-$VERSION
  46. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  47. cd $PRGNAM-$VERSION
  48. chown -R root:root .
  49. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  50. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  51. # 20210910 bkw: this one-liner patch came from Debian
  52. patch -p1 < $CWD/compilefix.diff
  53. # 20210910 bkw: fix typo in docs
  54. sed -i 's,FONTBOUNDINGBIX,FONTBOUNDINGBOX,g' README $PRGNAM.1
  55. # 20210910 bkw: if someone tries to use a decimal as a factor,
  56. # e.g. 1.5, bdfresize silently ignores the .5 and treats the argument
  57. # as just 1. This patch adds a check to make sure the factors consist
  58. # only of digits and 0 or 1 slashes. Patch is by the SlackBuild
  59. # author, who keeps trying to say "-f 1.5" despite all sanity...
  60. patch -p1 < $CWD/check_factor_args.diff
  61. CFLAGS="$SLKCFLAGS" \
  62. CXXFLAGS="$SLKCFLAGS" \
  63. ./configure \
  64. --prefix=/usr \
  65. --libdir=/usr/lib${LIBDIRSUFFIX} \
  66. --sysconfdir=/etc \
  67. --localstatedir=/var \
  68. --mandir=/usr/man \
  69. --build=$ARCH-slackware-linux
  70. make
  71. make install-strip DESTDIR=$PKG
  72. gzip $PKG/usr/man/man1/$PRGNAM.1
  73. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  74. cp -a AUTHORS C* NEWS README $PKG/usr/doc/$PRGNAM-$VERSION
  75. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  76. mkdir -p $PKG/install
  77. cat $CWD/slack-desc > $PKG/install/slack-desc
  78. cd $PKG
  79. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE