kvm.SlackBuild 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/sh
  2. # Slackware build script for kvm
  3. # Written by Murat D. Kadirov <banderols@gmail.com>
  4. # Modified by SlackBuilds.org
  5. PRGNAM=kvm
  6. VERSION=${VERSION:-78}
  7. ARCH=${ARCH:-i486}
  8. BUILD=${BUILD:-1}
  9. TAG=${TAG:-_SBo}
  10. KERNELVERSION=${KERNELVERSION:-$(uname -r)}
  11. PKG_VERS=${VERSION}_$(echo $KERNELVERSION | tr - _)
  12. CWD=$(pwd)
  13. TMP=${TMP:-/tmp/SBo}
  14. PKG=$TMP/package-$PRGNAM
  15. OUTPUT=${OUTPUT:-/tmp}
  16. # Needed to build man pages if build is ran from su
  17. export PATH=$PATH:/usr/share/texmf/bin
  18. if [ "$ARCH" = "i486" ]; then
  19. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  20. elif [ "$ARCH" = "i686" ]; then
  21. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  22. elif [ "$ARCH" = "x86_64" ]; then
  23. SLKCFLAGS="-O2 -fPIC"
  24. fi
  25. set -e
  26. rm -rf $PKG
  27. mkdir -p $TMP $PKG $OUTPUT
  28. cd $TMP
  29. rm -rf $PRGNAM-$VERSION
  30. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  31. cd $PRGNAM-$VERSION
  32. chown -R root:root .
  33. find . \
  34. \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  35. -exec chmod 755 {} \; -o \
  36. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  37. -exec chmod 644 {} \;
  38. CFLAGS="$SLKCFLAGS" \
  39. CXXFLAGS="$SLKCFLAGS" \
  40. ./configure \
  41. --prefix=/usr \
  42. --audio-drv-list="alsa oss" \
  43. --enable-mixemu
  44. make
  45. make install DESTDIR=$PKG
  46. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  47. cp -r $TMP/$PRGNAM-$VERSION/scripts $PKG/usr/doc/$PRGNAM-$VERSION/
  48. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  49. mkdir -p $PKG/install
  50. cat $CWD/slack-desc > $PKG/install/slack-desc
  51. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  52. ( cd $PKG
  53. find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  54. find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  55. )
  56. # Fix up the manpages
  57. mv $PKG/usr/share/man $PKG/usr/man
  58. gzip -9 $PKG/usr/man/man?/*.?
  59. # Add a udev rule
  60. mkdir -p $PKG/etc/udev/rules.d/
  61. cp $PKG/usr/doc/$PRGNAM-$VERSION/scripts/65-kvm.rules \
  62. $PKG/etc/udev/rules.d/65-kvm.rules
  63. cd $PKG
  64. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$PKG_VERS-$ARCH-$BUILD$TAG.tgz