labplot2.SlackBuild 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. # Slackware build script for LabPlot
  3. # Based on the Slackware 14.1 SlackBuild and AUR PKGBUILD for labplot
  4. # Written by Fellype do Nascimento <fellype(at)gmail.com>
  5. #last modification of this build script: 2014/12/12
  6. NAME=labplot
  7. PRGNAM=labplot2
  8. VERSION=${VERSION:-2.0.1}
  9. BUILD=${BUILD:-1}
  10. TAG=${TAG:-_SBo}
  11. if [ -z "$ARCH" ]; then
  12. case "$( uname -m )" in
  13. i?86) ARCH=i686 ;;
  14. arm*) ARCH=arm ;;
  15. *) ARCH=$( uname -m ) ;;
  16. esac
  17. fi
  18. CWD=$(pwd)
  19. TMP=${TMP:-/tmp/SBo}
  20. PKG=$TMP/package-$PRGNAM
  21. OUTPUT=${OUTPUT:-/tmp}
  22. if [ "$ARCH" = "i486" ]; then
  23. SLKCFLAGS="-O2 -march=i486 -mtune=i686"; SLKLDFLAGS=""; LIBDIRSUFFIX=""; CHOST=i486
  24. elif [ "$ARCH" = "i686" ]; then
  25. SLKCFLAGS="-O2 -march=i686 -mtune=i686"; SLKLDFLAGS=""; LIBDIRSUFFIX=""; CHOST=i486
  26. elif [ "$ARCH" = "x86_64" ]; then
  27. SLKCFLAGS="-O2 -fPIC"; SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64"
  28. fi
  29. set -e
  30. rm -rf $PKG
  31. mkdir -p $TMP $PKG $OUTPUT
  32. cd $TMP
  33. rm -rf $NAME-$VERSION
  34. tar xvf $CWD/$NAME-$VERSION.tar.bz2
  35. cd $NAME-$VERSION
  36. chown -R root:root .
  37. find -L . \
  38. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  39. -o -perm 511 \) -exec chmod 755 {} \; -o \
  40. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  41. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  42. ./compile
  43. ( cd build/
  44. cmake ./ -DCMAKE_INSTALL_PREFIX=/usr
  45. cmake ./ -DCMAKE_BUILD_TYPE=Release
  46. make install DESTDIR=$PKG
  47. )
  48. ( cd $PKG
  49. find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  50. find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  51. find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs strip -g 2> /dev/null || true
  52. )
  53. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  54. cp -a AUTHORS ChangeLog COPYING INSTALL README $PKG/usr/doc/$PRGNAM-$VERSION
  55. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  56. mkdir -p $PKG/install
  57. cat $CWD/slack-desc > $PKG/install/slack-desc
  58. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  59. cd $PKG
  60. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}