onetrueawk.SlackBuild 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/bash
  2. # Slackware build script for onetrueawk
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. cd $(dirname $0) ; CWD=$(pwd)
  6. PRGNAM=onetrueawk
  7. VERSION=${VERSION:-20220303_2402014}
  8. BUILD=${BUILD:-1}
  9. TAG=${TAG:-_SBo}
  10. PKGTYPE=${PKGTYPE:-tgz}
  11. if [ -z "$ARCH" ]; then
  12. case "$( uname -m )" in
  13. i?86) ARCH=i586 ;;
  14. arm*) ARCH=arm ;;
  15. *) ARCH=$( uname -m ) ;;
  16. esac
  17. fi
  18. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  19. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  20. exit 0
  21. fi
  22. TMP=${TMP:-/tmp/SBo}
  23. PKG=$TMP/package-$PRGNAM
  24. OUTPUT=${OUTPUT:-/tmp}
  25. if [ "$ARCH" = "i586" ]; then
  26. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  27. LIBDIRSUFFIX=""
  28. elif [ "$ARCH" = "i686" ]; then
  29. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "x86_64" ]; then
  32. SLKCFLAGS="-O2 -fPIC"
  33. LIBDIRSUFFIX="64"
  34. else
  35. SLKCFLAGS="-O2"
  36. LIBDIRSUFFIX=""
  37. fi
  38. set -e
  39. rm -rf $PKG
  40. mkdir -p $TMP $PKG $OUTPUT
  41. cd $TMP
  42. rm -rf $PRGNAM-$VERSION
  43. tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
  44. cd $PRGNAM-$VERSION
  45. chown -R root:root .
  46. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  47. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  48. make HOSTCC=${CC:-gcc} CFLAGS="$SLKCFLAGS"
  49. # no 'make install'. binary is called a.out, very retro.
  50. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  51. PKGOPT=$PKG/opt/$PRGNAM
  52. mkdir -p $PKGDOC {$PKG/usr,$PKGOPT}/{bin,man/man1}
  53. install -s -m0755 a.out $PKGOPT/bin/awk
  54. gzip -9c < awk.1 > $PKGOPT/man/man1/awk.1.gz
  55. # test suite failure doesn't exit with error status. save the log for
  56. # later perusal.
  57. [ "${MAKETEST:-no}" = "yes" ] && make test 2>&1 | tee $PKGDOC/maketest.log
  58. ln -s ../../opt/$PRGNAM/bin/awk $PKG/usr/bin/otawk
  59. ln -s ../../../opt/$PRGNAM/man/man1/awk.1.gz $PKG/usr/man/man1/otawk.1.gz
  60. cp -a ChangeLog FIXES LICENSE README.md TODO $PKGDOC
  61. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  62. mkdir -p $PKG/install
  63. cat $CWD/slack-desc > $PKG/install/slack-desc
  64. cd $PKG
  65. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE