2021-07-04 01:48:15 +08:00
|
|
|
#!/bin/bash
|
2014-01-23 14:41:59 +08:00
|
|
|
|
|
|
|
# Slackware build script for klick
|
|
|
|
|
2022-06-09 00:26:11 +08:00
|
|
|
# Written by B. Watson (urchlay@slackware.uk)
|
2014-01-23 14:41:59 +08:00
|
|
|
|
|
|
|
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
|
|
|
|
2021-11-30 02:25:52 +08:00
|
|
|
# 20211129 bkw: BUILD=2
|
|
|
|
# - fix build on -current. see Makefile.
|
|
|
|
# - autodetect rubberband and liblo.
|
|
|
|
# - enable terminal support.
|
|
|
|
# - add missing klick.pod (source for the man page).
|
|
|
|
# - dynamic slack-desc.
|
|
|
|
# - include klick2ardour.py, in case someone has a use for it.
|
|
|
|
|
2017-06-21 11:10:14 +08:00
|
|
|
# 20170620 bkw: add -fpermissive to cflags, for -current's gcc7.
|
|
|
|
|
2021-07-04 17:41:06 +08:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2014-01-23 14:41:59 +08:00
|
|
|
PRGNAM=klick
|
|
|
|
VERSION=${VERSION:-0.12.2}
|
2021-11-30 02:25:52 +08:00
|
|
|
BUILD=${BUILD:-2}
|
2014-01-23 14:41:59 +08:00
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 18:23:38 +08:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
2014-01-23 14:41:59 +08:00
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2016-08-19 16:59:12 +08:00
|
|
|
i?86) ARCH=i586 ;;
|
2014-01-23 14:41:59 +08:00
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2021-07-04 18:23:38 +08:00
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2014-01-23 14:41:59 +08:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2016-08-19 16:59:12 +08:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2014-01-23 14:41:59 +08:00
|
|
|
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.tar.gz
|
|
|
|
cd $PRGNAM-$VERSION
|
|
|
|
chown -R root:root .
|
2021-11-30 02:25:52 +08:00
|
|
|
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
|
|
|
|
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
|
2014-01-23 14:41:59 +08:00
|
|
|
|
2021-11-30 02:25:52 +08:00
|
|
|
RUBBERBAND=${RUBBERBAND:-yes}
|
|
|
|
LIBLO=${LIBLO:-yes}
|
|
|
|
pkg-config --exists rubberband || RUBBERBAND="no"
|
|
|
|
pkg-config --exists liblo || LIBLO="no"
|
2014-01-23 14:41:59 +08:00
|
|
|
|
2021-11-30 02:25:52 +08:00
|
|
|
# 20211129 bkw: wrote a Makefile because the SConstruct is too old
|
|
|
|
# for scons-4.0.1 and I hate scons anyway.
|
|
|
|
make -f $CWD/Makefile RUBBERBAND=$RUBBERBAND OSC=$LIBLO SLKCFLAGS="$SLKCFLAGS"
|
2014-01-23 14:41:59 +08:00
|
|
|
|
2021-11-30 02:25:52 +08:00
|
|
|
mkdir -p $PKG/usr/bin $PKG/usr/share/$PRGNAM/samples
|
|
|
|
install -oroot -groot -s -m0755 $PRGNAM $PKG/usr/bin
|
|
|
|
install -oroot -groot -m0755 $CWD/klick2ardour.py $PKG/usr/bin
|
|
|
|
install -oroot -groot -m0644 samples/* $PKG/usr/share/$PRGNAM/samples
|
2014-01-23 14:41:59 +08:00
|
|
|
|
|
|
|
# man page written for this SlackBuild (from --help output)
|
|
|
|
mkdir -p $PKG/usr/man/man1
|
|
|
|
gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cp -a COPYING NEWS README doc/manual.html $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
2021-11-30 02:25:52 +08:00
|
|
|
L=no; R=no
|
|
|
|
objdump -p $PKG/usr/bin/$PRGNAM > otmp
|
|
|
|
grep -q 'NEEDED.*liblo' otmp && L=yes
|
|
|
|
grep -q 'NEEDED.*librubberband' otmp && R=yes
|
|
|
|
|
2014-01-23 14:41:59 +08:00
|
|
|
mkdir -p $PKG/install
|
2021-11-30 02:25:52 +08:00
|
|
|
sed -e "s,@L@,$L," -e "s,@R@,$R," $CWD/slack-desc > $PKG/install/slack-desc
|
2014-01-23 14:41:59 +08:00
|
|
|
|
|
|
|
# Only add capability stuff if not disabled:
|
|
|
|
if [ "${SETCAP:-yes}" = "yes" ]; then
|
|
|
|
cat $CWD/setcap.sh >> $PKG/install/doinst.sh
|
|
|
|
# Only allow execution by audio group
|
|
|
|
chown root:audio $PKG/usr/bin/$PRGNAM
|
|
|
|
chmod 0750 $PKG/usr/bin/$PRGNAM
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $PKG
|
2021-07-04 18:23:38 +08:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|