dwdiff.SlackBuild 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/bin/bash
  2. # Slackware build script for dwdiff
  3. # Written by slakmagik <slakmagik@gmail.com>
  4. # Released under the WTFPL
  5. cd $(dirname $0) ; CWD=$(pwd)
  6. PRGNAM=dwdiff
  7. VERSION=${VERSION:-2.1.4}
  8. BUILD=${BUILD:-1}
  9. TAG=${TAG:-_SBo}
  10. PKGTYPE=${PKGTYPE:-tgz}
  11. if [ -z "$ARCH" ]; then
  12. case "$( uname -m )" in
  13. i?86) ARCH=i586 ;;
  14. arm*) ARCH=arm ;;
  15. *) ARCH=$( uname -m ) ;;
  16. esac
  17. fi
  18. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  19. # the name of the created package would be, and then exit. This information
  20. # could be useful to other scripts.
  21. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  22. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  23. exit 0
  24. fi
  25. TMP=${TMP:-/tmp/SBo}
  26. PKG=$TMP/package-$PRGNAM
  27. OUTPUT=${OUTPUT:-/tmp}
  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. if [ -z "$UNICODE" ]; then
  42. UNICODE=without
  43. else
  44. UNICODE=with
  45. fi
  46. NLS="${NLS:-""}"
  47. set -e
  48. rm -rf $PKG
  49. mkdir -p $TMP $PKG $OUTPUT
  50. cd $TMP
  51. rm -rf $PRGNAM-$VERSION
  52. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  53. cd $PRGNAM-$VERSION
  54. chown -R root:root .
  55. find -L . \
  56. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  57. -exec chmod 755 {} \; -o \
  58. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 \
  59. -o -perm 400 \) -exec chmod 644 {} \;
  60. # Patch for configure --mandir
  61. patch -p1 < $CWD/config.pkg.patch
  62. # Patch for a build failure if not building with unicode.
  63. patch -p1 < $CWD/src-option.c.patch
  64. # This is one messed up makefile - and its configure doesn't accept '--build'
  65. CC="gcc -fgnu89-inline" \
  66. CFLAGS="$SLKCFLAGS" \
  67. CXXFLAGS="$SLKCFLAGS" \
  68. ./configure \
  69. --$UNICODE-unicode \
  70. --prefix=/usr \
  71. --mandir='$(prefix)/man'
  72. make LINGUAS="$NLS" prefix=/usr
  73. make LINGUAS="$NLS" prefix=$PKG/usr install
  74. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF |
  75. cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  76. find $PKG/usr/man -type f -exec gzip -9 {} \;
  77. mv $PKG/usr/share/doc $PKG/usr
  78. if [ -z "$NLS" ]; then # share/ will be empty
  79. rmdir $PKG/usr/share
  80. fi
  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. cd $PKG
  85. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE