par.SlackBuild 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. # Slackware build script for par
  3. # Written by slakmagik <email removed>
  4. # Released under the WTFPL
  5. # Now maintained by B. Watson <yalhcru@gmail.com>
  6. # 20200622 bkw:
  7. # - Update for v1.53 (after *19 years*)
  8. # - Correctly rm the source dir from previous runs
  9. # - Fix mode 0700 top-level source dir (it's annoying)
  10. # - i486 => i586
  11. # - various tweaks
  12. # - add default_env patch (see below)
  13. cd $(dirname $0) ; CWD=$(pwd)
  14. PRGNAM=par
  15. SRCNAM=Par
  16. VERSION=${VERSION:-1.53.0}
  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 $SRCNAM-$VERSION
  52. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  53. cd $SRCNAM-$VERSION
  54. chown -R root:root .
  55. # please don't revert this to template:
  56. chmod 755 .
  57. chmod 644 *
  58. # 20200622 bkw: the man page says to:
  59. # $ export PARINIT="rTbgqR B=.,?'_A_a_@ Q=_s>|"
  60. # before running. This one-line patch just makes that the default, if
  61. # the PARINIT variable isn't set. This sets a reasonable default so
  62. # users don't have to diddle their startup files.
  63. [ "${PRISTINE:-no}" = "no" ] && patch -p1 < $CWD/default_env.diff
  64. make -f protoMakefile CFLAGS="$SLKCFLAGS"
  65. mkdir -p $PKG/usr/bin
  66. install -m0755 -s $PRGNAM $PKG/usr/bin
  67. # rename ".doc" so nothing thinks it's a word document.
  68. mv $PRGNAM.doc $PRGNAM.txt
  69. sed -i "s/$PRGNAM\.doc/$PRGNAM.txt/g" $PRGNAM.txt $PRGNAM.1
  70. mkdir -p $PKG/usr/man/man1
  71. gzip -9c $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  72. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  73. mkdir -p $PKGDOC
  74. cp -a $PRGNAM.txt releasenotes $PKGDOC
  75. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$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