dwdiff.SlackBuild 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/sh
  2. # Slackware build script for dwdiff
  3. # Written by slakmagik <jsun@freeshell.org>
  4. # Released under the WTFPL
  5. PRGNAM=dwdiff
  6. VERSION=1.4
  7. ARCH=${ARCH:-i486}
  8. BUILD=${BUILD:-1}
  9. TAG=${TAG:-_SBo}
  10. CWD=$(pwd)
  11. TMP=${TMP:-/tmp/SBo}
  12. PKG=$TMP/package-$PRGNAM
  13. OUTPUT=${OUTPUT:-/tmp}
  14. if [ "$ARCH" = "i486" ]; then
  15. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  16. elif [ "$ARCH" = "i686" ]; then
  17. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  18. elif [ "$ARCH" = "x86_64" ]; then
  19. SLKCFLAGS="-O2 -fPIC"
  20. fi
  21. if [[ -z $UNICODE ]]; then
  22. UNICODE=without
  23. else
  24. UNICODE=with
  25. fi
  26. set -e
  27. rm -rf $PKG
  28. mkdir -p $TMP $PKG $OUTPUT
  29. cd $TMP
  30. rm -rf $PRGNAM-$VERSION
  31. tar xvf $CWD/$PRGNAM-$VERSION.tgz
  32. cd $PRGNAM-$VERSION
  33. chown -R root:root .
  34. find . \
  35. \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  36. -exec chmod 755 {} \; -o \
  37. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 \
  38. -o -perm 400 \) -exec chmod 644 {} \;
  39. # This is one messed up makefile
  40. CFLAGS="$SLKCFLAGS" \
  41. CXXFLAGS="$SLKCFLAGS" \
  42. ./configure \
  43. --${UNICODE}-unicode \
  44. --prefix=/usr \
  45. --mandir='$(prefix)/man'
  46. make LINGUAS="${NLS:=""}" prefix=$PKG/usr
  47. make LINGUAS="${NLS:=""}" prefix=$PKG/usr install
  48. mv $PKG/usr/share/doc $PKG/usr
  49. if [ -z "$NLS" ]; then # share/ will be empty
  50. rmdir $PKG/usr/share
  51. fi
  52. ( cd $PKG
  53. find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : |
  54. xargs strip --strip-unneeded 2> /dev/null || true
  55. find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : |
  56. xargs strip --strip-unneeded 2> /dev/null
  57. )
  58. ( cd $PKG/usr/man
  59. find . -type f -exec gzip -9 {} \;
  60. for i in $(find . -type l); do ln -s $(readlink $i).gz $i.gz; rm $i; done
  61. )
  62. mkdir -p $PKG/install
  63. cat $CWD/slack-desc > $PKG/install/slack-desc
  64. cd $PKG
  65. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz