miscom.SlackBuild 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/bin/bash
  2. # Slackware build script for miscom
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. cd $(dirname $0) ; CWD=$(pwd)
  6. PRGNAM=miscom
  7. VERSION=${VERSION:-1.0}
  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 [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  19. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  20. exit 0
  21. fi
  22. TMP=${TMP:-/tmp/SBo}
  23. PKG=$TMP/package-$PRGNAM
  24. OUTPUT=${OUTPUT:-/tmp}
  25. if [ "$ARCH" = "i586" ]; then
  26. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  27. LIBDIRSUFFIX=""
  28. elif [ "$ARCH" = "i686" ]; then
  29. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "x86_64" ]; then
  32. SLKCFLAGS="-O2 -fPIC"
  33. LIBDIRSUFFIX="64"
  34. else
  35. SLKCFLAGS="-O2"
  36. LIBDIRSUFFIX=""
  37. fi
  38. set -e
  39. rm -rf $PKG
  40. mkdir -p $TMP $PKG $OUTPUT
  41. cd $TMP
  42. rm -rf $PRGNAM
  43. tar xvf $CWD/$PRGNAM.tar.gz
  44. cd $PRGNAM
  45. chown -R root:root .
  46. # upstream's permissions are fugly.
  47. chmod 644 *
  48. chmod 755 sounds
  49. chmod 644 sounds/*
  50. # fix compiler warnings, some of which might actually cause problems.
  51. patch -p1 < $CWD/fixwarnings.diff
  52. # build with libaoss unless user disables it.
  53. if [ "${AOSS:-yes}" = "yes" ]; then
  54. sed -i '/^LIBS/s,$, -laoss,' Makefile
  55. fi
  56. # use our flags.
  57. sed -i "s,-O,-Wall $SLKCFLAGS," Makefile
  58. # default datadir is weird.
  59. make DATADIR=/usr/share/games/$PRGNAM
  60. # manual install since the permissions are weird.
  61. mkdir -p $PKG/usr/games $PKG/usr/man/man6 $PKG/usr/share/games/$PRGNAM
  62. install -s -m0755 $PRGNAM $PKG/usr/games
  63. gzip -9c < $PRGNAM.6 > $PKG/usr/man/man6/$PRGNAM.6.gz
  64. cp -r sounds/* $PKG/usr/share/games/$PRGNAM
  65. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  66. cp -a COPYING README ChangeLog TODO $PKG/usr/doc/$PRGNAM-$VERSION
  67. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  68. mkdir -p $PKG/install
  69. cat $CWD/slack-desc > $PKG/install/slack-desc
  70. cd $PKG
  71. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE