mawk.SlackBuild 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/bin/bash
  2. # Slackware build script for mawk
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20200302 bkw: Update for v1.3.4_20200120.
  6. # 20200111 bkw: Update for v1.3.4_20200106.
  7. # 20191129 bkw: Update for v1.3.4_20190203.
  8. # 20180902 bkw: Add BUILTIN_REGEX option.
  9. cd $(dirname $0) ; CWD=$(pwd)
  10. PRGNAM=mawk
  11. VERSION=${VERSION:-1.3.4_20200120}
  12. BUILD=${BUILD:-1}
  13. TAG=${TAG:-_SBo}
  14. PKGTYPE=${PKGTYPE:-tgz}
  15. if [ -z "$ARCH" ]; then
  16. case "$( uname -m )" in
  17. i?86) ARCH=i586 ;;
  18. arm*) ARCH=arm ;;
  19. *) ARCH=$( uname -m ) ;;
  20. esac
  21. fi
  22. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  23. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  24. exit 0
  25. fi
  26. TMP=${TMP:-/tmp/SBo}
  27. PKG=$TMP/package-$PRGNAM
  28. OUTPUT=${OUTPUT:-/tmp}
  29. if [ "$ARCH" = "i586" ]; then
  30. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  31. LIBDIRSUFFIX=""
  32. elif [ "$ARCH" = "i686" ]; then
  33. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "x86_64" ]; then
  36. SLKCFLAGS="-O2 -fPIC"
  37. LIBDIRSUFFIX="64"
  38. else
  39. SLKCFLAGS="-O2"
  40. LIBDIRSUFFIX=""
  41. fi
  42. set -e
  43. # This does nothing for 1.3.4, but allows e.g. VERSION=1.3.4_20171017 in
  44. # the environment.
  45. SRCVER="$( echo $VERSION | sed 's,_,-,' )"
  46. rm -rf $PKG
  47. mkdir -p $TMP $PKG $OUTPUT
  48. cd $TMP
  49. rm -rf $PRGNAM-$SRCVER
  50. tar xvf $CWD/$PRGNAM-$SRCVER.tgz
  51. cd $PRGNAM-$SRCVER
  52. chown -R root:root .
  53. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  54. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  55. if [ "${BUILTIN_REGEX:-yes}" = "yes" ]; then
  56. REGEX_OPT="--with-builtin-regex"
  57. REGEX_DESC="mawk's built-in"
  58. else
  59. REGEX_OPT="--without-builtin-regex"
  60. REGEX_DESC="glibc's"
  61. fi
  62. CFLAGS="$SLKCFLAGS" \
  63. CXXFLAGS="$SLKCFLAGS" \
  64. ./configure \
  65. $REGEX_OPT \
  66. --prefix=/usr \
  67. --libdir=/usr/lib${LIBDIRSUFFIX} \
  68. --sysconfdir=/etc \
  69. --localstatedir=/var \
  70. --mandir=/usr/man \
  71. --build=$ARCH-slackware-linux
  72. make
  73. make install DESTDIR=$PKG
  74. strip $PKG/usr/bin/$PRGNAM
  75. gzip -9 $PKG/usr/man/man1/$PRGNAM.1
  76. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  77. cp -a ACKNOWLEDGMENT CHANGES COPYING MANIFEST README \
  78. $PKG/usr/doc/$PRGNAM-$VERSION
  79. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  80. mkdir -p $PKG/install
  81. sed "s,@REGEX_DESC@,$REGEX_DESC," $CWD/slack-desc > $PKG/install/slack-desc
  82. cd $PKG
  83. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE