summaryrefslogtreecommitdiffstats
path: root/audio/mda-lv2/mda-lv2.SlackBuild
blob: 8b31d4345d89ba2ffe3b8f1db9d0d34b7bb3b314 (plain)
#!/bin/sh

# Slackware build script for mda-lv2

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

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

PRGNAM=mda-lv2
VERSION=${VERSION:-1.2.4}
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

CWD=$(pwd)
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.bz2
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 {} \+

# The include structure for lv2 has changed drastically. Recreating
# the old structure is easier than patching all the includes in all
# the source files.
mkdir -p lv2includes/lv2/core
ln -s /usr/include/lv2/lv2plug.in/ns/ext/* lv2includes/lv2
ln -s /usr/include/lv2.h lv2includes/lv2/core

SLKCFLAGS="$SLKCFLAGS -I$(pwd)/lv2includes"
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./waf configure build install  \
  --prefix=/usr \
  --lv2dir=/usr/lib$LIBDIRSUFFIX/lv2 \
  --destdir=$PKG

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

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYING README* NEWS $PKG/usr/doc/$PRGNAM-$VERSION

# All the documentation on the individual plugins is buried in the .ttl
# files as comments, which none of my LV2 hosts will display. It's useful
# info, so let's put it in /usr/doc.
cd $PKG/usr/lib$LIBDIRSUFFIX/lv2/mda.lv2
perl $CWD/extract_docs.pl > $PKG/usr/doc/$PRGNAM-$VERSION/plugins.txt
cd -

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}