aboutsummaryrefslogtreecommitdiff
path: root/audio/fmit/fmit.SlackBuild
blob: a280035b4d5e6636aa8b0536d2a9cc4de9d01500 (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
#!/bin/bash

# Slackware build script for fmit (Free Musical Instrument Tuner)

# Originally written by Josiah Boothby
# Modified and now maintained by B. Watson <urchlay@slackware.uk>

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# 20240103 bkw:
# - New maintainer.
# - Relicense as WTFPL with permission.
# - Add missing setcap.sh. This has been broken (by me) for 2 years,
#   and nobody reported it...
# - Move the "=== CONFIG" message down, so it doesn't interfere
#   with PRINT_PACKAGE_NAME.

# 20220218 bkw: Modified by SlackBuilds.org:
# - update for v1.2.14 (the old download disappeared).
# - autodetect jack and portaudio, instead of making the user manually
#   set environment variables (can still disable with environment).

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=fmit
VERSION=${VERSION:-1.2.14}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

# 20220218 bkw: always include qt (aka PulseAudio) and ALSA support.
CONFIG="acs_qt acs_alsa"

# 20220218 bkw: autodetect jack and portaudio, allow disabling in env.
pkg-config --exists jack && \
  [ "${JACK:-yes}" != "no" ] && \
  CONFIG+=" acs_jack" && \
  SETCAP="${SETCAP:-yes}"
pkg-config --exists portaudio-2.0 && \
  [ "${PORTAUDIO:-yes}" != "no" ] && \
  CONFIG+=" acs_portaudio"

# 20220218 bkw: build without OSS, allow enabling in env.
[ "${OSS:-no}" = "yes" ] && CONFIG+=" acs_oss"

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

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

echo "=== CONFIG='$CONFIG'"

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

# 20220218 bkw: SLKCFLAGS and LIBDIRSUFFIX not needed (qmake uses
# the ones qt5 was compiled with, which is correct).

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 .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +

qmake-qt5 PREFIX=/usr CONFIG+="$CONFIG"
make
make install INSTALL_ROOT=$PKG

# 20220218 bkw: binary already stripped.

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYING* README.txt $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
sed "s,@CONFIG@,$CONFIG," < $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

if [ "$SETCAP" = "yes" ]; then
  cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  chown root:audio $PKG/usr/bin/$PRGNAM
  chmod 0750 $PKG/usr/bin/$PRGNAM
fi

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