summaryrefslogtreecommitdiff
path: root/audio/listener/listener.SlackBuild
blob: 622464b13ff9f4d382964ff75d9334e989e65bf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
#
# Slackware build script for listener.
#
# Distributed under the beerware licence:
#
# "THE BEER-WARE LICENSE" (Revision 42):
# pwcazenave <at> gmail <dot> com wrote this file. As long as you retain this
# notice you can do whatever you want with this stuff. If we meet some day,
# and you think this stuff is worth it, you can buy me a beer in return
# Pierre Cazenave
#
# Created 07/08/2008
# Updated for Slackware64 28/05/2009
# Updated to version 2.0.1 09/10/2011
#

# 20170813 bkw:
# - take over maintenance. If you want to buy me a beer too, I won't stop you!
# - update for v2.2 (which has been out for 4+ years now)
# - include filter plugins in package
# - add man page
# - script cleanups

PRGNAM=listener
VERSION=${VERSION:-2.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar -xvf $CWD/$PRGNAM-$VERSION.tgz
cd $PRGNAM-$VERSION
chown -R root:root .
find . -type f -exec chmod 644 {} +
find . -type d -exec chmod 755 {} +

# fix hardcoded config file path
sed -i 's,/usr/local/etc,/etc,g' $PRGNAM.h manual.html

# search for filter plugins here:
FILTERDIR=/usr/lib$LIBDIRSUFFIX/$PRGNAM
sed -i "s|-ldl|-Wl,-rpath,$FILTERDIR &|" Makefile

# build the main program
CFLAGS="$SLKCFLAGS" make

# build (some of) the example filters
mkdir -p $PKG/$FILTERDIR
for i in deglitch highpass lowpass unspike; do
  cd filter_lib_examples/$i
    sed -i "s,^CFLAGS=,&$SLKCFLAGS ," Makefile
    CFLAGS="$SLKCFLAGS" make
    install -s *.so.* $PKG/$FILTERDIR
  cd -
done

# easier to install manually than coerce 'make install' to play nice.
mkdir -p $PKG/usr/bin $PKG/etc
install -s -m0755 $PRGNAM set$PRGNAM $PKG/usr/bin
cat $PRGNAM.conf > $PKG/etc/$PRGNAM.conf.new

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a license.txt manual.html $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}