kbdd.SlackBuild 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/bin/bash
  2. # Slackware build script for kbdd
  3. # Written by Veljko Tanjga (veljko@tanjga.net)
  4. # Licensed under the WTFPL. See http://sam.zoy.org/wtfpl/ for details.
  5. #Set initial variables:
  6. cd $(dirname $0) ; CWD=$(pwd)
  7. PRGNAM=kbdd
  8. VERSION=${VERSION:-0.6.2}
  9. BUILD=${BUILD:-1}
  10. TAG=${TAG:-_SBo}
  11. PKGTYPE=${PKGTYPE:-tgz}
  12. if [ -z "$ARCH" ]; then
  13. case "$( uname -m )" in
  14. i?86) ARCH=i586 ;;
  15. arm*) ARCH=arm ;;
  16. *) ARCH=$( uname -m ) ;;
  17. esac
  18. fi
  19. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  20. # the name of the created package would be, and then exit. This information
  21. # could be useful to other scripts.
  22. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  23. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  24. exit 0
  25. fi
  26. TMP=${TMP:-/tmp/SBo}
  27. PKG=$TMP/package-$PRGNAM
  28. OUTPUT=${OUTPUT:-/tmp}
  29. if [ "$ARCH" = "i586" ]; then
  30. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  31. LIBDIRSUFFIX=""
  32. elif [ "$ARCH" = "i686" ]; then
  33. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "x86_64" ]; then
  36. SLKCFLAGS="-O2 -fPIC"
  37. LIBDIRSUFFIX="64"
  38. else
  39. SLKCFLAGS="-O2"
  40. LIBDIRSUFFIX=""
  41. fi
  42. set -e
  43. rm -rf $PKG
  44. mkdir -p $TMP $PKG $OUTPUT
  45. cd $TMP
  46. rm -rf $PRGNAM-$VERSION
  47. # respecting content-disposition may include cgi params in the filename
  48. TARBALL=$CWD/$PRGNAM-$VERSION.tar.bz2
  49. if [ ! -e $TARBALL ]; then
  50. TARBALL="$(/bin/ls $TARBALL\?* | head -1)"
  51. fi
  52. tar xvf $TARBALL
  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 \
  57. -o -perm 511 \) -exec chmod 755 {} \; -o \
  58. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  59. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  60. autoreconf -vif
  61. FLAGS="$SLKCFLAGS" \
  62. CXXFLAGS="$SLKCFLAGS" \
  63. ./configure \
  64. --prefix=/usr \
  65. --libdir=/usr/lib${LIBDIRSUFFIX} \
  66. --docdir=/usr/doc/$PRGNAM-$VERSION \
  67. --localstatedir=/var \
  68. --mandir=/usr/man \
  69. --build=$ARCH-slackware-linux
  70. # Sure, let's ignore --docdir
  71. make PREFIX=/usr docdir=/usr/doc/$PRGNAM-$VERSION
  72. make install docdir=/usr/doc/$PRGNAM-$VERSION DESTDIR=$PKG
  73. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  74. cp -a \
  75. ChangeLog AUTHORS COPYING NEWS README \
  76. $PKG/usr/doc/$PRGNAM-$VERSION
  77. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  78. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  79. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  80. find $PKG/usr/man -type f -exec gzip -9 {} \;
  81. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  82. mkdir -p $PKG/install
  83. cat $CWD/slack-desc > $PKG/install/slack-desc
  84. cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo
  85. cd $PKG
  86. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE