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

ddate.SlackBuild

By: a guest on May 3rd, 2013  |  syntax: Bash  |  size: 2.36 KB  |  views: 37  |  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. # SlackBuild script for ddate
  4.  
  5.  
  6. PKGNAM=ddate
  7. VERSION=${VERSION:-0.2}
  8. GITVERSION=${GITVERSION:-master}
  9. BUILD=${BUILD:-1}
  10. NUMJOBS=${NUMJOBS:-" -j7 "}
  11.  
  12. if [ -z "$ARCH" ]; then
  13.   case "$( uname -m )" in
  14.     i?86) export ARCH=i486 ;;
  15.     arm*) export ARCH=arm ;;
  16.     # Unless $ARCH is already set, use uname -m for all other archs:
  17.        *) export ARCH=$( uname -m ) ;;
  18.   esac
  19. fi
  20.  
  21. if [ "$ARCH" = "i486" ]; then
  22.    SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  23.    LIBDIRSUFFIX=""
  24. elif [ "$ARCH" = "i686" ]; then
  25.    SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  26.    LIBDIRSUFFIX=""
  27. elif [ "$ARCH" = "x86_64" ]; then
  28.    SLKCFLAGS="-O2 -fPIC"
  29.    LIBDIRSUFFIX="64"
  30. else
  31.   SLKCFLAGS="-O2"
  32.   LIBDIRSUFFIX=""
  33. fi
  34.  
  35. set -e
  36.  
  37. CWD=$(pwd)
  38. TMP=${TMP:-/tmp}
  39. PKG=$TMP/package-${PKGNAM}
  40. rm -rf $PKG
  41. mkdir -p $TMP $PKG
  42.  
  43. cd $TMP
  44. rm -rf ${PKGNAM}-${GITVERSION}
  45. unzip -a $CWD/${PKGNAM}-${GITVERSION}.zip || exit 1
  46. cd ${PKGNAM}-${GITVERSION}
  47.  
  48. cat $CWD/man-path.diff | patch -p1 || exit 1
  49.  
  50. # Make sure ownerships and permissions are sane:
  51. chown -R root:root .
  52. find . \
  53.   \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  54.   -exec chmod 755 {} \; -o \
  55.   \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  56.   -exec chmod 644 {} \;
  57.  
  58. mkdir build
  59. cd build
  60.   cmake \
  61.     -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  62.     -DCMAKE_INSTALL_PREFIX=/usr \
  63.     -DCMAKE_BUILD_TYPE=Release ..
  64.  
  65.   make $NUMJOBS || make || return 1
  66.   make install DESTDIR=$PKG || exit 1
  67.  
  68. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  69.   | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || exit 1
  70.  
  71. if [ -d $PKG/usr/man ]; then
  72.   ( cd $PKG/usr/man
  73.     for manpagedir in $(find . -type d -name "man*") ; do
  74.       ( cd $manpagedir
  75.         for eachpage in $( find . -type l -maxdepth 1) ; do
  76.           ln -s $( readlink $eachpage ).gz $eachpage.gz
  77.           rm $eachpage
  78.         done
  79.         gzip -9 *.gz
  80.       )
  81.     done
  82.   )
  83. fi
  84.  
  85. mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
  86. cp -a $CWD/README $PKG/usr/doc/${PKGNAM}-$VERSION
  87. cp -a $CWD/dobbs.jpg $PKG/usr/doc/${PKGNAM}-$VERSION
  88. cat $CWD/$PKGNAM.SlackBuild > $PKG/usr/doc/$PKGNAM-$VERSION/$PKGNAM.SlackBuild
  89.  
  90. mkdir $PKG/install
  91. cat $CWD/slack-desc > $PKG/install/slack-desc
  92.  
  93. cd $PKG
  94. /sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.${PKGTYPE:-txz}