summaryrefslogtreecommitdiffstats
path: root/libraries/libfishsound/libfishsound.SlackBuild
blob: 1ba41ad8408e1ea8d07b75bcad9371ad891603c3 (plain)
#!/bin/sh

# Slackware build script for libfishsound

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

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

# 20191213 bkw: New package.
# This only exists as a required dep for sonic-visualiser >= 4.0.

PRGNAM=libfishsound
VERSION=${VERSION:-1.0.0}
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.gz
cd $PRGNAM-$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 {} \;

sh autogen.sh

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

make
make install-strip DESTDIR=$PKG

# PV says we don't need these, and I agree
rm -f $PKG/usr/lib$LIBDIRSUFFIX/*.la

# --docdir accepted and ignored. also, don't install the latex docs,
# they're the source for the html docs. NEWS is 0 bytes, don't install.
DOCDIR=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $DOCDIR
mv $PKG/usr/share/doc/$PRGNAM/html $DOCDIR
rm -rf $PKG/usr/share/doc
cp -a AUTHORS COPYING ChangeLog README release_notes \
  $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

if ldd $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM.so.*.*.* | grep -q speex; then
  WITHSPEEX=with
else
  WITHSPEEX=without
fi

# Install the examples, source only.
mkdir -p $DOCDIR/examples
cp -a src/examples/*.c $DOCDIR/examples

# Let the user know whether the optional speex dep is required. The other
# audio codec dependencies (libogg, flac, libvorbis) are part of a full
# Slackware install, we'll assume either they exist or the user knows
# what he's doing.
mkdir -p $PKG/install
sed "s,@WITHSPEEX@,$WITHSPEEX," $CWD/slack-desc > $PKG/install/slack-desc

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