mktoc.SlackBuild 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. # Slackware build script for mktoc
  3. # Written by Luis Henrique <email removed>
  4. # Now maintained by B. Watson <yalhcru@gmail.com>
  5. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  6. # 20211126 bkw: add README note about floating point samples.
  7. # 20180111 bkw:
  8. # - take over maintenance
  9. # - BUILD=2
  10. # - i486 => i586
  11. # - don't include the install instructions in the package
  12. # - get rid of some useless boilerplate
  13. # - fix upstream typo/illiteracy: you LOSE information, you don't LOOSE it!
  14. # (sorry, this is a pet peeve, I can't not fix it)
  15. # - add man page, basically upstream's README
  16. cd $(dirname $0) ; CWD=$(pwd)
  17. PRGNAM=mktoc
  18. VERSION=${VERSION:-1.3}
  19. BUILD=${BUILD:-2}
  20. TAG=${TAG:-_SBo}
  21. PKGTYPE=${PKGTYPE:-tgz}
  22. if [ -z "$ARCH" ]; then
  23. case "$( uname -m )" in
  24. i?86) ARCH=i586 ;;
  25. arm*) ARCH=arm ;;
  26. *) ARCH=$( uname -m ) ;;
  27. esac
  28. fi
  29. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  30. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  31. exit 0
  32. fi
  33. TMP=${TMP:-/tmp/SBo}
  34. PKG=$TMP/package-$PRGNAM
  35. OUTPUT=${OUTPUT:-/tmp}
  36. # 20180111 bkw: No CFLAGS here, this is pure Python code. Would be noarch,
  37. # except for the lib vs lib64 thing.
  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.gz
  44. cd $PRGNAM-$VERSION
  45. chown -R root:root .
  46. find . -type d -print0 | xargs -0 chmod 755
  47. find . -type f -print0 | xargs -0 chmod 644
  48. # You know, I never saw the "loose" for "lose" typo until the internet
  49. # age. Does that mean computers make people illiterate?
  50. patch -p1 < $CWD/lose_not_loose.diff
  51. python setup.py install --root=$PKG
  52. mkdir -p $PKG/usr/man/man1
  53. gzip -9c $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  54. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  55. cp -a CHANGELOG.rst LICENSE PKG-INFO README $PKG/usr/doc/$PRGNAM-$VERSION
  56. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  57. mkdir -p $PKG/install
  58. cat $CWD/slack-desc > $PKG/install/slack-desc
  59. cd $PKG
  60. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE