mppenc.SlackBuild 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/bash
  2. # Slackware build script for mppenc
  3. # Written by M.Dinslage contact: daedra1980@gmail.com
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=mppenc
  6. VERSION=${VERSION:-1.16}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. PKGTYPE=${PKGTYPE:-tgz}
  10. if [ -z "$ARCH" ]; then
  11. case "$( uname -m )" in
  12. i?86) ARCH=i486 ;;
  13. arm*) ARCH=arm ;;
  14. *) ARCH=$( uname -m ) ;;
  15. esac
  16. fi
  17. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  18. # the name of the created package would be, and then exit. This information
  19. # could be useful to other scripts.
  20. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  21. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  22. exit 0
  23. fi
  24. TMP=${TMP:-/tmp/SBo}
  25. PKG=$TMP/package-$PRGNAM
  26. OUTPUT=${OUTPUT:-/tmp}
  27. if [ "$ARCH" = "i486" ]; then
  28. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  29. LIBDIRSUFFIX=""
  30. elif [ "$ARCH" = "i686" ]; then
  31. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "x86_64" ]; then
  34. SLKCFLAGS="-O2 -fPIC"
  35. LIBDIRSUFFIX="64"
  36. SLKLDFLAGS="-L/usr/lib64"
  37. fi
  38. set -e
  39. rm -rf $PKG
  40. mkdir -p $TMP $PKG $OUTPUT
  41. rm -rf $TMP/$PRGNAM-$VERSION
  42. cd $TMP
  43. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  44. cd $PRGNAM-$VERSION
  45. chown -R root:root .
  46. find -L . \
  47. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  48. -exec chmod 755 {} \; -o \
  49. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  50. -exec chmod 644 {} \;
  51. mkdir build
  52. cd build
  53. cmake \
  54. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  55. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  56. -DCMAKE_INSTALL_PREFIX=/usr \
  57. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  58. -DMAN_INSTALL_DIR=/usr/man \
  59. -DCMAKE_BUILD_TYPE=Release ..
  60. make VERBOSE=1
  61. make install VERBOSE=1 DESTDIR=$PKG
  62. cd -
  63. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  64. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  65. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  66. cp -a INSTALL $PKG/usr/doc/$PRGNAM-$VERSION
  67. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  68. mkdir $PKG/install
  69. cat $CWD/slack-desc > $PKG/install/slack-desc
  70. cd $PKG
  71. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE