par2cmdline-tbb.SlackBuild 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. # Slackware build script for par2cmdline tbb
  3. # Written by powtrix (@gmail.com)
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=par2cmdline-tbb
  6. VERSION=${VERSION:-0.4_20150503}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. PKGTYPE=${PKGTYPE:-tgz}
  10. DIRNAME=$(echo $PRGNAM | tr -d "\-tbb")
  11. DIRVERSION=$(echo $VERSION | awk -F_ '{print $1}')
  12. SRCVERSION=$(echo $VERSION | sed s,_,-tbb-,)
  13. if [ -z "$ARCH" ]; then
  14. case "$( uname -m )" in
  15. i?86) ARCH=i686 ;; # i486 fails to build, it isn't multithread
  16. arm*) ARCH=arm ;;
  17. *) ARCH=$( uname -m ) ;;
  18. esac
  19. fi
  20. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  21. # the name of the created package would be, and then exit. This information
  22. # could be useful to other scripts.
  23. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  24. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  25. exit 0
  26. fi
  27. TMP=${TMP:-/tmp/SBo}
  28. PKG=$TMP/package-$PRGNAM
  29. OUTPUT=${OUTPUT:-/tmp}
  30. if [ "$ARCH" = "i586" ]; then
  31. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "i686" ]; then
  34. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "x86_64" ]; then
  37. SLKCFLAGS="-O2 -fPIC"
  38. LIBDIRSUFFIX="64"
  39. else
  40. SLKCFLAGS="-O2"
  41. LIBDIRSUFFIX=""
  42. fi
  43. set -e
  44. rm -rf $PKG
  45. mkdir -p $TMP $PKG $OUTPUT
  46. cd $TMP
  47. rm -rf $DIRNAME-$DIRVERSION
  48. tar xvf $CWD/$DIRNAME-$SRCVERSION.tar.gz
  49. cd $TMP/$DIRNAME-$DIRVERSION
  50. chown -R root:root .
  51. find -L . \
  52. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  53. -exec chmod 755 {} \; -o \
  54. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  55. -exec chmod 644 {} \;
  56. # This header has been removed with glibc 2.32, so point at the kernel's one
  57. sed -i "s|sys/sysctl\.h|linux/sysctl.h|" reedsolomon.cpp
  58. LDFLAGS="-lrt" \
  59. CFLAGS="$SLKCFLAGS" \
  60. CXXFLAGS="$SLKCFLAGS" \
  61. ./configure \
  62. --prefix=/usr \
  63. --libdir=/usr/lib${LIBDIRSUFFIX} \
  64. --sysconfdir=/etc \
  65. --localstatedir=/var \
  66. --mandir=/usr/man \
  67. --docdir=/usr/doc/$PRGNAM-$VERSION \
  68. --build=$ARCH-slackware-linux
  69. make
  70. sed -i 's/ln -f/ln -sf/g' Makefile # make symbolic links instead of hard links
  71. make install DESTDIR=$PKG
  72. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  73. cp -a \
  74. AUTHORS COPYING ChangeLog INSTALL PORTING README{,_FIRST.txt} ROADMAP \
  75. $PKG/usr/doc/$PRGNAM-$VERSION
  76. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  77. mkdir -p $PKG/install
  78. cat $CWD/slack-desc > $PKG/install/slack-desc
  79. cd $PKG
  80. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE