beav.SlackBuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/bin/bash
  2. # Slackware build script for beav
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # This is a seriously old piece of software. The timestamps inside
  6. # the tarball all read 'Nov 30 1994' so it's almost 24 years old (old
  7. # enough to buy beer, even in the US). I'm adding it to SBo mainly for
  8. # old-timers to use, people who are used to using beav on other distros
  9. # or OSes.
  10. # At this point, the original maintainer and homepage for beav are long
  11. # gone, so I'm considering the Debian page for it as the 'official'
  12. # source. VERSION matches the Debian patchlevel, e.g. 1.40-18 => 1.40_18.
  13. # Also included a compile fix patch based on one from AUR, plus my own
  14. # patch to add the arrow keys to the default keybindings.
  15. # Entertaining piece of trivia for you: the Debian maintainer of beav
  16. # is none other than Sam Hocevar, who also invented the WTFPL license
  17. # that's used for this script and most of my other SBo builds. Hi, Sam!
  18. cd $(dirname $0) ; CWD=$(pwd)
  19. PRGNAM=beav
  20. VERSION=${VERSION:-1.40_18}
  21. BUILD=${BUILD:-1}
  22. TAG=${TAG:-_SBo}
  23. PKGTYPE=${PKGTYPE:-tgz}
  24. if [ -z "$ARCH" ]; then
  25. case "$( uname -m )" in
  26. i?86) ARCH=i586 ;;
  27. arm*) ARCH=arm ;;
  28. *) ARCH=$( uname -m ) ;;
  29. esac
  30. fi
  31. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  32. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  33. exit 0
  34. fi
  35. TMP=${TMP:-/tmp/SBo}
  36. PKG=$TMP/package-$PRGNAM
  37. OUTPUT=${OUTPUT:-/tmp}
  38. if [ "$ARCH" = "i586" ]; then
  39. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  40. LIBDIRSUFFIX=""
  41. elif [ "$ARCH" = "i686" ]; then
  42. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  43. LIBDIRSUFFIX=""
  44. elif [ "$ARCH" = "x86_64" ]; then
  45. SLKCFLAGS="-O2 -fPIC"
  46. LIBDIRSUFFIX="64"
  47. else
  48. SLKCFLAGS="-O2"
  49. LIBDIRSUFFIX=""
  50. fi
  51. set -e
  52. MAINVER="$( echo $VERSION | cut -d_ -f1 )"
  53. TARVER="$( echo $MAINVER | sed 's/\.//g' )"
  54. PATCHVER="$( echo $VERSION | cut -d_ -f2 )"
  55. rm -rf $PKG
  56. mkdir -p $TMP $PKG $OUTPUT
  57. cd $TMP
  58. rm -rf $PRGNAM-$TARVER
  59. tar xvf $CWD/${PRGNAM}_$MAINVER.orig.tar.gz
  60. cd $PRGNAM-$TARVER
  61. chown -R root:root .
  62. chmod 644 *
  63. # apply Debian's patches
  64. zcat $CWD/${PRGNAM}_$MAINVER-$PATCHVER.diff.gz | patch -p1
  65. # compile fix patch is basically this from AUR:
  66. # https://aur.archlinux.org/cgit/aur.git/tree/beav_on_archlinux.patch?h=beav
  67. # but with SLKCFLAGS support in the Makefile, and redone as a -p1 patch.
  68. patch -p1 < $CWD/compilefixes.diff
  69. # Arrow key support:
  70. # FFS, arrow keys have been standard on damn near all keyboards for
  71. # 40+ years now, even creaky old dinosaurs like me use them. beav only
  72. # supports them if you go thru the laborious process of defining them
  73. # in your .beavrc.
  74. # This patch adds them to the default keybind list (without affecting
  75. # the original ^B ^F ^N ^P bindings, so they still work).
  76. # Bindings tested & working with:
  77. # linux console, xterm, rxvt, urxvt, xfce4-terminal, konsole.
  78. # Might not work on some oddball terminal, but in that case, the user
  79. # can define their weird arrow key combos in .beavrc as usual. Patch was
  80. # sent to the Debian maintainer (Sam Hocevar) on 20180807.
  81. patch -p1 < $CWD/arrow_keys.diff
  82. # fix Debianized doc dir reference
  83. sed -i \
  84. 's:/usr/share/doc[^ ]*:/usr/doc/'$PRGNAM-$VERSION/$PRGNAM$TARVER.txt: \
  85. $PRGNAM.1
  86. # can't use CFLAGS for this...
  87. make SLKCFLAGS="$SLKCFLAGS"
  88. install -D -s -m0755 -oroot -groot $PRGNAM $PKG/usr/bin/$PRGNAM
  89. mkdir -p $PKG/usr/man/man1
  90. gzip -9c $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  91. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  92. cp -a read.me $PRGNAM$TARVER.txt debian/changelog $PKG/usr/doc/$PRGNAM-$VERSION
  93. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  94. mkdir -p $PKG/install
  95. cat $CWD/slack-desc > $PKG/install/slack-desc
  96. cd $PKG
  97. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE