summaryrefslogtreecommitdiffstats
path: root/audio/calf-ladspa/calf-ladspa.SlackBuild
blob: bfeacdf188377f113684b7407d6e25991f579242 (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
#!/bin/bash

# Slackware build script for calf-ladspa

# Written by B. Watson (yalhcru@gmail.com)

# 20170706 bkw:
# - Patch source so it doesn't check for jack-audio-connection-kit or
#   fluidsynth. Previously they were required for the build to complete,
#   but the stuff that got built with support for them was being rm'ed
#   after make install (because the package only contains LADSPA plugins).
# - Remove jack-audio-connection-kit and fluidsynth from REQUIRES.
# - Add patch to support -current's gcc7. For now, it's commented out
#   in the SlackBuild, since 14.2 doesn't need it.

# 20151105 bkw:
# - Renamed to calf-ladspa. The main calf build is now for calf-0.0.60,
#   which lacks LADSPA support. Removed LV2 and standalone support, use
#   calf for that instead. Removed DSSI support, because I don't
#   think anyone's using it, and because it's non-trivial to install
#   the gui support files anywhere other than /usr/share/calf, which
#   would step on the main calf package.

# 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-ladspa
VERSION=${VERSION:-0.0.19kx}
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

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

# 20151106 bkw: --enable-experimental only enables the fluidsynth
# module, which doesn't work as LADSPA (needs to be DSSI or LV2), so
# leave it disabled here.
EXPOPT=disable

# We'll disable what we can, and rm -rf what we don't need after install.
LADSPA_OPT="--with-ladspa-dir=/usr/lib${LIBDIRSUFFIX}/ladspa"
DSSI_OPT="--without-dssi"
LV2_OPT="--without-lv2"

set -e

SRCNAM=calf

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$VERSION
chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

# There are no --without or --disable options for jack and fluidsynth,
# so patch the autoconf to skip them (they're not needed for the LADSPA
# plugins).
patch -p1 < $CWD/disable-jack-and-fluidsynth.diff

# gcc 7 is very picky about the argument types of std::min() and std::max().
# This patch replaces them with C-style MIN and MAX macros. Not actually
# needed on Slack 14.2, so it's commented out, but I'm checking the actual
# patch into git so I won't lose track of it.
patch -p1 < $CWD/minmax.diff

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
fi

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --${EXPOPT}-experimental \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --mandir=/usr/man \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --htmldir=/usr/doc/$PRGNAM-$VERSION \
  --enable-shared \
  --disable-static \
  $LADSPA_OPT \
  $DSSI_OPT \
  $LV2_OPT \
  --build=$ARCH-slackware-linux

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

# install-strip is supported, but doesn't work:
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

# This build is only for the ladspa plugins, so none of this
# other stuff should be in the package:
rm -rf $PKG/usr/share $PKG/usr/bin $PKG/usr/man $PKG/usr/lib64/calf

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

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

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