hexe.SlackBuild 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/bash
  2. # Slackware build script for hexe
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # Source is distributed on upstream site as a dir full of individual
  6. # files rather than a tarball/etc. So I made a tarball containing
  7. # them all. VERSION is the server timestamp on all the files.
  8. cd $(dirname $0) ; CWD=$(pwd)
  9. PRGNAM=hexe
  10. VERSION=${VERSION:-20120305}
  11. BUILD=${BUILD:-1}
  12. TAG=${TAG:-_SBo}
  13. PKGTYPE=${PKGTYPE:-tgz}
  14. if [ -z "$ARCH" ]; then
  15. case "$( uname -m )" in
  16. i?86) ARCH=i586 ;;
  17. arm*) ARCH=arm ;;
  18. *) ARCH=$( uname -m ) ;;
  19. esac
  20. fi
  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. 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.xz
  47. cd $PRGNAM-$VERSION
  48. chown -R root:root .
  49. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  50. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  51. # The short -b version of --byte-groups didn't work (typo in source)
  52. patch -p1 < $CWD/fix-b-option.diff
  53. # Get rid of inline warnings
  54. sed -i 's,\<inline\>,,' $PRGNAM.h
  55. make CFLAGS="-Wall $SLKCFLAGS -fcommon"
  56. mkdir -p $PKG/usr/bin
  57. install -s -m0755 -oroot -groot $PRGNAM $PKG/usr/bin
  58. # man page by SlackBuild author
  59. mkdir -p $PKG/usr/man/man1
  60. gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  61. # There's *no* documentation, include our own README.
  62. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  63. cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README
  64. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  65. mkdir -p $PKG/install
  66. cat $CWD/slack-desc > $PKG/install/slack-desc
  67. cd $PKG
  68. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE