NoPaste Service
DOWNLOAD
Language: Bash
Author: Matrix86
Description: GNU ddrescue-1.8 Slackbuild! Slackware 12
Date: 06/03/08 22:44
  1. #!/bin/sh
  2. # Slackware 12.0 SlackBuild
  3. # http://ftp.gnu.org/gnu/ddrescue/
  4.  
  5.  
  6.  
  7.  
  8.  
  9. CWD=`pwd`
  10. TMP=${TMP:-/tmp/tgz}
  11. PKG=$TMP/package/ddrescue
  12. NAME=ddrescue
  13. VERSION=1.8
  14. CHOST=i686
  15. ARCH=${ARCH:-noarch}
  16. BUILD=1mtx
  17.  
  18. SOURCE=http://ftp.gnu.org/gnu/ddrescue/$NAME-$VERSION.tar.bz2
  19.  
  20. if [ ! -e $NAME-$VERSION.tar.bz2 ]; then
  21. wget -c $SOURCE
  22. fi
  23.  
  24. if [ ! -d $TMP ]; then
  25.  mkdir -p $TMP
  26. fi
  27. if [ ! -d $PKG ]; then
  28.  mkdir -p $PKG
  29. fi
  30.  
  31.  
  32. if [ "$ARCH" = "i486" ]; then
  33.   SLKCFLAGS="-O2 -march=i486   -mtune=i686"
  34. elif [ "$ARCH" = "i686" ]; then
  35.   SLKCFLAGS="-O3 -march=i686 -pipe -fomit-frame-pointer"
  36. elif [ "$ARCH" = "athlon64" ]; then
  37.   SLKCFLAGS="-O2 -march=athlon64 -pipe"
  38. elif [ "$ARCH" = "athlonxp" ]; then
  39.   SLKCFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer"
  40. elif [ "$ARCH" = "x86_64" ]; then
  41.   SLKCFLAGS="-O2"
  42. elif [ "$ARCH" = "s390" ]; then
  43.   SLKCFLAGS="-O2"
  44. fi
  45.  
  46. cd $TMP
  47. tar xvjf $CWD/$NAME-$VERSION.tar.bz2
  48.  
  49. echo -e "\E[0;32m+-----------------------------+\E[0;0m"
  50. echo -e "\E[0;32m| Start SlackBuild $NAME-$VERSION |\E[0;0m"
  51. echo -e "\E[0;32m+-----------------------------+\E[0;0m"
  52.  
  53. cd $NAME-$VERSION
  54.  
  55. find . \( -perm 777 -o -perm 775 -o -perm 711 \) -exec chmod 755 {} \;
  56. find . \( -perm 700 -o -perm 555 -o -perm 511 \) -exec chmod 755 {} \;
  57. find . \( -perm 666 -o -perm 664 -o -perm 600 \) -exec chmod 644 {} \;
  58. find . \( -perm 444 -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  59.  
  60. chown -R root:root .
  61.  
  62. CHOST="${SLKCHOST}"                                     \
  63. CFLAGS="${SLKCFLAGS}"                                   \
  64. CXXFLAGS="${SLKCXXFLAGS}"                               \
  65. ./configure                                            \
  66.   --prefix=/usr                                         \
  67.   --sysconfdir=/etc                                     \
  68.   --mandir=/usr/man                                     \
  69.   --infodir=/usr/info                                   \
  70.   --program-prefix=""                                   \
  71.   --program-suffix=""                                   \
  72.   --build=$ARCH-slackware-linux || exit 1
  73. make -j2 || exit 1
  74. make install DESTDIR=$PKG
  75.  
  76. ( cd $PKG
  77.   find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  78.   find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  79.   find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs strip -g 2> /dev/null
  80. )
  81.  
  82. if [ ! -d $PKG/usr/doc/$NAME-$VERSION ]; then
  83.   mkdir -p $PKG/usr/doc/$NAME-$VERSION
  84. fi
  85.  
  86. mkdir -p $PKG/install
  87. cat $CWD/slack-desc > $PKG/install/slack-desc
  88. cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc
  89. cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
  90. cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README $PKG/usr/doc/$NAME-$VERSION
  91.  
  92.  
  93. if [ -d $PKG/usr/info ]; then
  94.   find $PKG/usr/info -type f -name "*.info" -exec gzip -9f {} \;
  95. fi
  96.  
  97. cd $PKG
  98. requiredbuilder -v -y -s $CWD $PKG
  99. makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz
  100.  
  101.  
  102. if [ "$1" = "--cleanup" ]; then
  103.  rm -rf $TMP
  104. fi
  105.