pyfits.SlackBuild 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. # Slackware build script for PyFITS.
  3. # Written by Nicky Chorley <nick.chorley@gmail.com>, but heavily
  4. # based on the NumPy SlackBuild by Aleksandar Samardzic.
  5. cd $(dirname $0) ; CWD=$(pwd)
  6. PRGNAM=pyfits
  7. VERSION=${VERSION:-3.1.2}
  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=i486 ;;
  14. arm*) ARCH=arm ;;
  15. *) ARCH=$( uname -m ) ;;
  16. esac
  17. fi
  18. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  19. # the name of the created package would be, and then exit. This information
  20. # could be useful to other scripts.
  21. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  22. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  23. exit 0
  24. fi
  25. TMP=${TMP:-/tmp/SBo}
  26. PKG=${PKG:-$TMP/package-$PRGNAM}
  27. OUTPUT=${OUTPUT:-/tmp}
  28. set -e
  29. rm -rf $PKG
  30. mkdir -p $TMP $PKG $OUTPUT
  31. cd $TMP
  32. rm -rf $PRGNAM-$VERSION
  33. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  34. cd $PRGNAM-$VERSION
  35. chown -R root:root .
  36. find -L . \
  37. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  38. -exec chmod 755 {} \; -o \
  39. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  40. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  41. python setup.py install --root $PKG
  42. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  43. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  44. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  45. cp -a CHANGES.txt LICENSE.txt README.txt\
  46. $PKG/usr/doc/$PRGNAM-$VERSION
  47. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  48. find $PKG/usr/doc -type f -exec chmod 0644 {} \;
  49. mkdir -p $PKG/install
  50. cat $CWD/slack-desc > $PKG/install/slack-desc
  51. cd $PKG
  52. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE