arpack.SlackBuild 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/bin/sh
  2. # Slackware build script for arpack
  3. # Written by Pablo Santamaria (pablosantamaria@gmail.com)
  4. PRGNAM=arpack
  5. VERSION=${VERSION:-2.1}
  6. BUILD=${BUILD:-1}
  7. TAG=${TAG:-_SBo}
  8. if [ -z "$ARCH" ]; then
  9. case "$( uname -m )" in
  10. i?86) ARCH=i486 ;;
  11. arm*) ARCH=arm ;;
  12. *) ARCH=$( uname -m ) ;;
  13. esac
  14. fi
  15. CWD=$(pwd)
  16. TMP=${TMP:-/tmp/SBo}
  17. PKG=$TMP/package-$PRGNAM
  18. OUTPUT=${OUTPUT:-/tmp}
  19. if [ "$ARCH" = "i486" ]; then
  20. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  21. LIBDIRSUFFIX=""
  22. elif [ "$ARCH" = "i686" ]; then
  23. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  24. LIBDIRSUFFIX=""
  25. elif [ "$ARCH" = "x86_64" ]; then
  26. SLKCFLAGS="-O2 -fPIC"
  27. LIBDIRSUFFIX="64"
  28. else
  29. SLKCFLAGS="-O2"
  30. LIBDIRSUFFIX=""
  31. fi
  32. MAJOR=$(echo $VERSION | cut -d. -f1)
  33. set -e
  34. rm -rf $PKG
  35. mkdir -p $TMP $PKG $OUTPUT
  36. cd $TMP
  37. rm -rf ARPACK
  38. tar xvf $CWD/${PRGNAM}96.tar.gz
  39. tar xvf $CWD/patch.tar.gz
  40. patch -p0 < $CWD/arpack-2.1-redhat.patch
  41. patch -p0 < $CWD/arpack-etime.patch
  42. patch -p0 < $CWD/arpack-second-bug.patch
  43. cd ARPACK
  44. chown -R root:root .
  45. find -L . \
  46. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  47. -exec chmod 755 {} \; -o \
  48. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  49. -exec chmod 644 {} \;
  50. mkdir static shared
  51. cd shared
  52. for dir in ../SRC ../UTIL; do
  53. make -f $dir/Makefile VPATH=$dir srcdir=$dir \
  54. FC=gfortran FFLAGS="-std=legacy $SLKCFLAGS -fPIC" \
  55. single double complex complex16
  56. done
  57. gcc -shared -lblas -llapack -Wl,-soname,libarpack.so.$MAJOR -o libarpack.so.$VERSION *.o
  58. cd ..
  59. cd static
  60. for dir in ../SRC ../UTIL; do
  61. make -f $dir/Makefile VPATH=$dir srcdir=$dir \
  62. FC=gfortran FFLAGS="-std=legacy $SLKCFLAGS" \
  63. single double complex complex16
  64. done
  65. ar rv libarpack.a *.o
  66. ranlib libarpack.a
  67. cd ..
  68. mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}
  69. install -p -m644 static/libarpack.a $PKG/usr/lib${LIBDIRSUFFIX}
  70. install -p -m755 shared/libarpack.so.$VERSION $PKG/usr/lib${LIBDIRSUFFIX}
  71. ( cd $PKG/usr/lib${LIBDIRSUFFIX}
  72. ln -s libarpack.so.$VERSION libarpack.so.$MAJOR
  73. ln -s libarpack.so.$MAJOR libarpack.so )
  74. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  75. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  76. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  77. cp -a DOCUMENTS/* $PKG/usr/doc/$PRGNAM-$VERSION
  78. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  79. mkdir -p $PKG/install
  80. cat $CWD/slack-desc > $PKG/install/slack-desc
  81. cd $PKG
  82. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}