qastools.SlackBuild 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/sh
  2. # Slackware build script for qastools
  3. # Written by ponce <matteo.bernardini@gmail.com>
  4. PRGNAM=qastools
  5. VERSION=${VERSION:-0.16.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. DOCS="CHANGELOG COPYING README TODO"
  33. set -e # Exit on most errors
  34. rm -rf $PKG
  35. mkdir -p $TMP $PKG $OUTPUT
  36. cd $TMP
  37. rm -rf ${PRGNAM}_${VERSION}
  38. tar xvf $CWD/${PRGNAM}_${VERSION}.tar.?z*
  39. cd ${PRGNAM}_${VERSION}
  40. chown -R root:root .
  41. find . \
  42. \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  43. -exec chmod 755 {} \; -o \
  44. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  45. -exec chmod 644 {} \;
  46. mkdir -p build
  47. cd build
  48. cmake \
  49. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  50. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  51. -DCMAKE_INSTALL_PREFIX=/usr \
  52. -DCMAKE_BUILD_TYPE=Release ..
  53. make
  54. make install DESTDIR=$PKG
  55. cd ..
  56. # move the man pages in the proper place
  57. mv $PKG/usr/share/man $PKG/usr/man
  58. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  59. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  60. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  61. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  62. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  63. mkdir -p $PKG/install
  64. cat $CWD/slack-desc > $PKG/install/slack-desc
  65. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  66. cd $PKG
  67. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}