alsacap.SlackBuild 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. # Slackware build script for alsacap
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # In case anyone's wondering: VERSION is just the date I downloaded the
  6. # source. So far as I can tell, this was released once and has never been
  7. # changed.
  8. # 20140824 bkw: OK, it changed. I haven't got a copy of the old tarball
  9. # and web.archive.org doesn't seem to either. No idea what changed, sorry.
  10. # 20201207 bkw: actual new release! No functional changes, just fixes for
  11. # compiler warnings in alsacap.c. VERSION now 20200821 (modification time
  12. # of alsacap.c).
  13. cd $(dirname $0) ; CWD=$(pwd)
  14. PRGNAM=alsacap
  15. VERSION=${VERSION:-20200821}
  16. BUILD=${BUILD:-1}
  17. TAG=${TAG:-_SBo}
  18. PKGTYPE=${PKGTYPE:-tgz}
  19. if [ -z "$ARCH" ]; then
  20. case "$( uname -m )" in
  21. i?86) ARCH=i586 ;;
  22. arm*) ARCH=arm ;;
  23. *) ARCH=$( uname -m ) ;;
  24. esac
  25. fi
  26. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  27. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  28. exit 0
  29. fi
  30. TMP=${TMP:-/tmp/SBo}
  31. PKG=$TMP/package-$PRGNAM
  32. OUTPUT=${OUTPUT:-/tmp}
  33. if [ "$ARCH" = "i586" ]; then
  34. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "i686" ]; then
  37. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  38. LIBDIRSUFFIX=""
  39. elif [ "$ARCH" = "x86_64" ]; then
  40. SLKCFLAGS="-O2 -fPIC"
  41. LIBDIRSUFFIX="64"
  42. else
  43. SLKCFLAGS="-O2"
  44. LIBDIRSUFFIX=""
  45. fi
  46. set -e
  47. rm -rf $PKG
  48. mkdir -p $TMP $PKG $OUTPUT
  49. cd $TMP
  50. rm -rf $PRGNAM
  51. tar xvf $CWD/$PRGNAM.tgz
  52. cd $PRGNAM
  53. chown -R root:root .
  54. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  55. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  56. sed -i "s,gcc,gcc $SLKCFLAGS," Makefile
  57. make
  58. mkdir -p $PKG/usr/bin $PKG/usr/man/man1
  59. install -s -m0755 $PRGNAM $PKG/usr/bin/$PRGNAM
  60. gzip -9c < $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  61. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  62. cat LICENSE > $PKG/usr/doc/$PRGNAM-$VERSION/LICENSE
  63. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  64. mkdir -p $PKG/install
  65. cat $CWD/slack-desc > $PKG/install/slack-desc
  66. cd $PKG
  67. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE