aboutsummaryrefslogtreecommitdiff
path: root/audio/calf/calf.SlackBuild
blob: 7d30e66878bedb3218e2d8c4035f0fd3a6bbc673 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/bash

# Slackware build script for calf

# Written by B. Watson (urchlay@slackware.uk)

# 20211204 bkw: BUILD=3, move html docs to subdir.
# 20200117 bkw: demote lash from required to optional dependency.
# 20191208 bkw: update for v0.90.3.

# 20180709 bkw:
# - Update to latest release (less than a day old).
# - Use correct upstream homepage.

# 20170622 bkw:
# - Update to latest git. It's been a long time since the last release.
# - Actually make the SSE=yes option work (d'oh!)

# 20170301 bkw: use long-format github URL, no more $VERSION.tar.gz

# 20151106 bkw:
# Switch to -master and upgrade to v0.0.60. No more LADSPA or DSSI
# support (upstream dropped it). But if you need LADSPA, there's a
# separate calf-ladspa build now. If there's a popular demand for
# DSSI, I'll add it to calf-ladspa, not here.
# fluidsynth is now required, because the build fails without it, even
# though it's listed as experimental and there's a --disable-experimental
# option. Since it's required anyway, might as well --enable-experimental.

# 20141030 bkw:
# Finally getting around to submitting this, there have been no code
# changes upstream since 20140308.

# 20140308 bkw:
# - Switched to falkTX's KXStudio fork of CALF. falkTX doesn't do release
#   tarballs, so this is a git checkout from 20140308.
# - Added capability stuff.

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

PRGNAM=calf
VERSION=${VERSION:-0.90.3}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

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

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.tar.?z
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 {} \+

autoreconf -if

# Note: The build ignores the provided -O2 in the flags (but the
# -march/-mtune -fPIC stuff is used). If you really want to force
# it to use -O2 (Slackware default), set FORCE_SLACK_CFLAGS=yes
# in the environment.
if [ "${FORCE_SLACK_CFLAGS:-no}" = "yes" ]; then
  sed -i -e 's/ -O3[^"]*//' configure
  SSE=no
fi

# Build with SSE support?
case "${SSE:-auto}" in
  "yes") SSEOPT="--enable-sse"  ;;
  "no")  SSEOPT="--disable-sse" ;;
  *)     grep sse /proc/cpuinfo >/dev/null \
              && SSEOPT="--enable-sse" \
              || SSEOPT="--disable-sse" ;;
esac

echo "=== SSEOPT: $SSEOPT"

# For the slack-desc:
WITHSSE="without"
[ "$SSEOPT" = "--enable-sse" ] && WITHSSE="with"

# 20211204 bkw: --docdir and --htmldir accepted and ignored.
# htmldir on the make command line is also ignored (html docs go to docdir).
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  $SSEOPT \
  --enable-experimental \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --mandir=/usr/man \
  --enable-shared \
  --disable-static \
  --with-lv2-dir=/usr/lib${LIBDIRSUFFIX}/lv2 \
  --build=$ARCH-slackware-linux

make
make install \
     DESTDIR=$PKG \
     docdir=/usr/doc/$PRGNAM-$VERSION/html \

# install-strip is supported, but doesn't work:
strip $PKG/usr/bin/* $PKG/usr/lib*/{lv2/calf.lv2/calflv2gui.so,calf/calf.so}

gzip $PKG/usr/man/man?/*

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

# This shouldn't be in the package:
rm -f $PKG/usr/share/icons/hicolor/icon-theme.cache

# Shipped .desktop file doesn't validate, use modified copy:
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

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

# 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
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE