ophcrack.SlackBuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/bash
  2. # Slackware build script for ophcrack
  3. # Written by Larry Hajali <larryhaja[at]gmail[dot]com>
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=ophcrack
  6. VERSION=${VERSION:-3.8.0}
  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=i586 ;;
  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. GRAPH=${GRAPH:-no}
  28. if [ "$ARCH" = "i586" ]; then
  29. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "i686" ]; then
  32. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "x86_64" ]; then
  35. SLKCFLAGS="-O2 -fPIC"
  36. LIBDIRSUFFIX="64"
  37. else
  38. SLKCFLAGS="-O2"
  39. LIBDIRSUFFIX=""
  40. fi
  41. set -e
  42. rm -rf $PKG
  43. mkdir -p $TMP $PKG $OUTPUT
  44. cd $TMP
  45. rm -rf $PRGNAM-$VERSION
  46. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  47. cd $PRGNAM-$VERSION
  48. chown -R root:root .
  49. find -L . \
  50. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  51. -exec chmod 755 {} \; -o \
  52. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  53. -exec chmod 644 {} \;
  54. if [ "$GRAPH" == "yes" ]; then
  55. GRAPH_STATUS="--enable-graph"
  56. else
  57. GRAPH_STATUS="--disable-graph"
  58. fi
  59. CFLAGS="$SLKCFLAGS" \
  60. CXXFLAGS="$SLKCFLAGS" \
  61. ./configure \
  62. --prefix=/usr \
  63. --enable-debug=no \
  64. --enable-gui \
  65. $GRAPH_STATUS \
  66. --build=$ARCH-slackware-linux \
  67. make
  68. make install DESTDIR=$PKG
  69. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  70. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  71. mkdir -p $PKG/usr/man/man1
  72. gzip -9c $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  73. # Make a desktop menu entry
  74. mkdir -p $PKG/usr/share/{applications,pixmaps}
  75. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  76. cat src/gui/pixmaps/os.xpm > $PKG/usr/share/pixmaps/$PRGNAM.xpm
  77. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  78. cp -a \
  79. AUTHORS COPYING ChangeLog INSTALL LICENSE* NEWS README* \
  80. $PKG/usr/doc/$PRGNAM-$VERSION
  81. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  82. mkdir -p $PKG/install
  83. cat $CWD/slack-desc > $PKG/install/slack-desc
  84. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  85. cd $PKG
  86. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE