aboutsummaryrefslogtreecommitdiff
path: root/audio/qm-vamp-plugins/qm-vamp-plugins.SlackBuild
blob: a4664f586743dab3c597ecb8c8a24b1f1456e570 (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 qm-vamp-plugins

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

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

# 20201103 bkw: update for v1.8.0. qm-dsp source is included now, get
# rid of separate download and build for it. Also, there's no longer
# a prebuilt atlas, and the build uses a bundled blas and lapack
# now. It also uses a bundled vamp-plugin-sdk, so I removed that from
# REQUIRES.

# 20200123 bkw: found out upstream includes a prebuilt libatlas.a, which
# the build has been using all along. Remove atlas from REQUIRES since
# it was never used anyway. Tried to build this with atlas, lapack,
# blas from SBo instead of the prebuilt stuff, but it fails, and for
# now I've run out of patience for it. So added a note to README about
# the prebuilt libs.

# 20191202 bkw: update for v1.7.1
# 20150403 bkw:
# Bump BUILD to 3, make it build against vamp-plugin-sdk 2.5 (whoops)

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

PRGNAM=qm-vamp-plugins
VERSION=${VERSION:-1.8.0}
BUILD=${BUILD:-1}
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}

# No CFLAGS support (releases are tested with their own opts)

if [ "$ARCH" = "i586" ]; then
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  LIBDIRSUFFIX="64"
else
  LIBDIRSUFFIX=""
fi

set -e

# Remove SSE/SSE2 flags as needed from the CFLAGS
fix_sse_flags() {
  local makefile="$1"

  if [ "$USE_SSE2" != "yes" ]; then
    sed -i \
      -e 's/-msse2//g' \
      $makefile
  fi

  if [ "$USE_SSE" != "yes" ]; then
    sed -i \
      -e 's/-msse//g' \
      -e 's/-mfpmath=sse//g' \
      $makefile
  fi
}

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 {} \+

# SSE/SSE2 support:
case "$SSE" in
  "yes") USE_SSE=yes ;;
  "no")  USE_SSE=no  ;;
  *)     if grep -q '\<sse\>' /proc/cpuinfo; then
           USE_SSE=yes
         else
           USE_SSE=no
         fi
         ;;
esac

if [ "$USE_SSE" = "yes" ]; then
  case "$SSE2" in
    "yes") USE_SSE2=yes ;;
    "no")  USE_SSE2=no  ;;
    *)     if grep -q '\<sse2\>' /proc/cpuinfo; then
             USE_SSE2=yes
           else
             USE_SSE2=no
           fi
           ;;
  esac
else
  USE_SSE2=no
fi

echo "USE_SSE=$USE_SSE and USE_SSE2=$USE_SSE2"

# Makefile.linux64 works fine on 32-bit.
MAKEFILE=build/linux/Makefile.linux64

# 20150403 bkw: crap. getting rid of vamp-plugin-sdk static libs
# breaks this. Fix by getting rid of -Wl,-Bstatic and -Wl,-Bdynamic
# options (so it doesn't insist on a static libvamp-sdk).
sed -i 's/-Wl,-B[^ ]* //g' $MAKEFILE

# Apply correct SSE-related flags. also we need c++11 starting with 1.8.0.
fix_sse_flags $MAKEFILE
sed -i '/^CXXFLAGS/s,=,= -std=c++11,' $MAKEFILE

# It's either 2 separate makes, or use -j1.
make -f $MAKEFILE lib/qm-dsp
make -f $MAKEFILE

# no 'make install' target, just cp it.
mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/vamp
strip $PRGNAM.so
cp $PRGNAM.so $PRGNAM.cat $PRGNAM.n3 $PKG/usr/lib$LIBDIRSUFFIX/vamp

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README* COPYING $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