Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 14th, 2011  |  syntax: None  |  size: 2.10 KB  |  views: 83  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2.  
  3. # Slackware build script for ipsec-tools
  4.  
  5. PRGNAM=ipsec-tools
  6. VERSION=${VERSION:-0.8.0}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_sar}
  9.  
  10. # Automatically determine the architecture we're building on:
  11. if [ -z "$ARCH" ]; then
  12.   case "$( uname -m )" in
  13.     i?86) ARCH=i486 ;;
  14.     arm*) ARCH=arm ;;
  15.     # Unless $ARCH is already set, use uname -m for all other archs:
  16.        *) ARCH=$( uname -m ) ;;
  17.   esac
  18. fi
  19.  
  20. CWD=$(pwd)
  21. TMP=${TMP:-/tmp/sar}
  22. PKG=$TMP/package-$PRGNAM
  23. OUTPUT=${OUTPUT:-/tmp}
  24.  
  25. if [ "$ARCH" = "i486" ]; then
  26.   SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  27.   LIBDIRSUFFIX=""
  28. elif [ "$ARCH" = "i686" ]; then
  29.   SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  30.   LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "x86_64" ]; then
  32.   SLKCFLAGS="-O2 -fPIC"
  33.   LIBDIRSUFFIX="64"
  34. else
  35.   SLKCFLAGS="-O2"
  36.   LIBDIRSUFFIX=""
  37. fi
  38.  
  39. set -e
  40.  
  41. rm -rf $PKG
  42. mkdir -p $TMP $PKG $OUTPUT
  43. cd $TMP
  44. rm -rf $PRGNAM-$VERSION
  45. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  46. cd $PRGNAM-$VERSION
  47. chown -R root:root .
  48. find . \
  49.  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  50.  -exec chmod 755 {} \; -o \
  51.  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  52.  -exec chmod 644 {} \;
  53.  
  54. CFLAGS="$SLKCFLAGS" \
  55. CXXFLAGS="$SLKCFLAGS" \
  56. ./configure \
  57.   --prefix=/usr \
  58.   --sysconfdir=/etc \
  59.   --mandir=/usr/man \
  60.   --enable-security-context=no \
  61.   --with-kernel-headers=/lib/modules/2.6.36.6/build/include \
  62.   --build=$ARCH-slackware-linux
  63.  
  64. make
  65. make install DESTDIR=$PKG
  66.  
  67. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  68.   | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  69.  
  70. find $PKG/usr/man -type f -exec gzip -9 {} \;
  71. for i in $(find $PKG/usr/man -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
  72.  
  73. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  74. cp -a \
  75.   ChangeLog NEWS README \
  76.   $PKG/usr/doc/$PRGNAM-$VERSION
  77. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  78.  
  79. mkdir -p $PKG/install
  80. cat $CWD/slack-desc > $PKG/install/slack-desc
  81.  
  82. cd $PKG
  83. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}