listener.SlackBuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #!/bin/bash
  2. #
  3. # Slackware build script for listener.
  4. #
  5. # Distributed under the beerware licence:
  6. #
  7. # "THE BEER-WARE LICENSE" (Revision 42):
  8. # pwcazenave <at> gmail <dot> com wrote this file. As long as you retain this
  9. # notice you can do whatever you want with this stuff. If we meet some day,
  10. # and you think this stuff is worth it, you can buy me a beer in return
  11. # Pierre Cazenave
  12. #
  13. # Created 07/08/2008
  14. # Updated for Slackware64 28/05/2009
  15. # Updated to version 2.0.1 09/10/2011
  16. #
  17. # 20211224 bkw: BUILD=2, fix for latest portaudio.
  18. # 20170813 bkw:
  19. # - take over maintenance. If you want to buy me a beer too, I won't stop you!
  20. # - update for v2.2 (which has been out for 4+ years now)
  21. # - include filter plugins in package
  22. # - add man page
  23. # - script cleanups
  24. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=listener
  26. VERSION=${VERSION:-2.2}
  27. BUILD=${BUILD:-2}
  28. TAG=${TAG:-_SBo}
  29. PKGTYPE=${PKGTYPE:-tgz}
  30. if [ -z "$ARCH" ]; then
  31. case "$( uname -m )" in
  32. i?86) ARCH=i586 ;;
  33. arm*) ARCH=arm ;;
  34. *) ARCH=$( uname -m ) ;;
  35. esac
  36. fi
  37. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  38. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  39. exit 0
  40. fi
  41. TMP=${TMP:-/tmp/SBo}
  42. PKG=$TMP/package-$PRGNAM
  43. OUTPUT=${OUTPUT:-/tmp}
  44. if [ "$ARCH" = "i586" ]; then
  45. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  46. LIBDIRSUFFIX=""
  47. elif [ "$ARCH" = "i686" ]; then
  48. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  49. LIBDIRSUFFIX=""
  50. elif [ "$ARCH" = "x86_64" ]; then
  51. SLKCFLAGS="-O2 -fPIC"
  52. LIBDIRSUFFIX="64"
  53. else
  54. SLKCFLAGS="-O2"
  55. LIBDIRSUFFIX=""
  56. fi
  57. set -e
  58. rm -rf $PKG
  59. mkdir -p $TMP $PKG $OUTPUT
  60. cd $TMP
  61. rm -rf $PRGNAM-$VERSION
  62. tar -xvf $CWD/$PRGNAM-$VERSION.tgz
  63. cd $PRGNAM-$VERSION
  64. chown -R root:root .
  65. find . -type f -exec chmod 644 {} +
  66. find . -type d -exec chmod 755 {} +
  67. # 20211224 bkw: PortAudio API has changed: we have to call
  68. # Pa_GetDefaultInputDevice() to get the default input device,
  69. # it's no longer device #0. This matters because e.g. on my system,
  70. # device zero is the HDMI output to my monitor's speakers... which of
  71. # course doesn't have a microphone or line input. Ideally, listener
  72. # would let you list the input devices and choose the one you want,
  73. # but that's more work than I want to do right now. You could set
  74. # PA_RECOMMENDED_OUTPUT_DEVICE in the environment, but there's no
  75. # handy tool to list the available device numbers.
  76. patch -p1 < $CWD/portaudio_default_input_device.diff
  77. # fix hardcoded config file path
  78. sed -i 's,/usr/local/etc,/etc,g' $PRGNAM.h manual.html
  79. # search for filter plugins here:
  80. FILTERDIR=/usr/lib$LIBDIRSUFFIX/$PRGNAM
  81. sed -i "s|-ldl|-Wl,-rpath,$FILTERDIR &|" Makefile
  82. # build the main program
  83. CFLAGS="$SLKCFLAGS" make
  84. # build (some of) the example filters
  85. mkdir -p $PKG/$FILTERDIR
  86. for i in deglitch highpass lowpass unspike; do
  87. cd filter_lib_examples/$i
  88. sed -i "s,^CFLAGS=,&$SLKCFLAGS ," Makefile
  89. CFLAGS="$SLKCFLAGS" make
  90. install -s *.so.* $PKG/$FILTERDIR
  91. cd -
  92. done
  93. # easier to install manually than coerce 'make install' to play nice.
  94. mkdir -p $PKG/usr/bin $PKG/etc
  95. install -s -m0755 $PRGNAM set$PRGNAM $PKG/usr/bin
  96. cat $PRGNAM.conf > $PKG/etc/$PRGNAM.conf.new
  97. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  98. cp -a license.txt manual.html $PKG/usr/doc/$PRGNAM-$VERSION
  99. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  100. mkdir -p $PKG/install
  101. cat $CWD/slack-desc > $PKG/install/slack-desc
  102. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  103. cd $PKG
  104. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE