po4a.SlackBuild 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/bash
  2. # Slackware build script for po4a
  3. # Originally written by Didier Spaier Paris, France
  4. # Now maintained by B. Watson (urchlay@slackware.uk)
  5. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  6. # 20220110 bkw:
  7. # - new maintainer.
  8. # - relicense as WTFPL with permission from Didier.
  9. # - update for v0.65.
  10. # - force a UTF-8 locale instead of making it a hoop for the user
  11. # to notice and jump through.
  12. # - move some of the details from README to a separate README_SBo.txt.
  13. # - ARCH=noarch.
  14. # - run the tests if TESTS=yes, as user nobody so they actually work.
  15. export LANG=en_US.UTF-8
  16. export LC_ALL=en_US.UTF-8
  17. cd $(dirname $0) ; CWD=$(pwd)
  18. PRGNAM=po4a
  19. VERSION=${VERSION:-0.65}
  20. BUILD=${BUILD:-1}
  21. TAG=${TAG:-_SBo}
  22. PKGTYPE=${PKGTYPE:-tgz}
  23. # There is no compiled code here.
  24. ARCH=noarch
  25. SRCNAM="$(printf $PRGNAM | cut -d- -f2-)"
  26. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  27. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  28. exit 0
  29. fi
  30. TMP=${TMP:-/tmp/SBo}
  31. PKG=$TMP/package-$PRGNAM
  32. OUTPUT=${OUTPUT:-/tmp}
  33. set -e
  34. rm -rf $PKG
  35. mkdir -p $TMP $PKG $OUTPUT
  36. cd $TMP
  37. rm -rf $SRCNAM-$VERSION
  38. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  39. cd $SRCNAM-$VERSION
  40. chown -R root:root .
  41. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  42. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  43. perl Build.PL \
  44. prefix=/usr \
  45. installdirs=vendor \
  46. destdir=$PKG
  47. ./Build
  48. # 20220110 bkw: Tests fail if run as root. Also they're time-consuming.
  49. # Run them only if requested, and do it as "nobody".
  50. if [ "${TESTS:-no}" = "yes" ]; then
  51. chown -R nobody:nogroup t
  52. su nobody -s /bin/sh -c "./Build test"
  53. fi
  54. ./Build install \
  55. --install_path bindoc=/usr/man/man1 \
  56. --install_path libdoc=/usr/man/man3
  57. find $PKG -name perllocal.pod -o -name ".packlist" -o -name "*.bs" | \
  58. xargs rm -f || true
  59. find $PKG -depth -type d -empty -delete || true
  60. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  61. mkdir -p $PKGDOC
  62. cp -a COPYING NEWS README* TODO changelog $PKGDOC
  63. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  64. mkdir -p $PKG/install
  65. cat $CWD/slack-desc > $PKG/install/slack-desc
  66. cd $PKG
  67. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE