summaryrefslogblamecommitdiffstats
path: root/source/l/libsamplerate/libsamplerate.SlackBuild
blob: 25d9419bce4e0990cafb3fd90dba26d3d27789d2 (plain) (tree)
1
2
3
4
5
6
7
8
9
           




                                                      

                             
                    

                                                                                          



                                                             
                             





                                                                    
                
                        

                      

                                         











                                         







                                                                              


                          

                                               
                             


                         

                                                                           





                                    
                                            

                        
                                         



                                   


                                         


                                                                             
                                      
                                                                 




                                             

                                                                 
#!/bin/bash

# Slackware build script for libsamplerate
# Written by paul wisehart paul@1ud2.com
# Modified by Robby Workman <rworkman@slackbuilds.org>

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

PKGNAM=libsamplerate
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-2}

# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) export ARCH=i586 ;;
    arm*) export ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
       *) export ARCH=$( uname -m ) ;;
  esac
fi

TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
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

# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
  exit 0
fi

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PKGNAM-$VERSION
tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

sed -i "s|\$prefix/share/doc/libsamplerate0-dev/html|\$htmldir|g" configure

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --htmldir=/usr/doc/$PKGNAM-$VERSION/html \
  --disable-static \
  --localstatedir=/var \
  --build=$ARCH-slackware-linux || exit 1

make -j4 || exit 1
make install DESTDIR=$PKG || exit 1

# Don't ship .la files:
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la

find $PKG | xargs 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/$PKGNAM-$VERSION
cp -a AUTHORS COPYING* NEWS README* $PKG/usr/doc/$PKGNAM-$VERSION

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

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD.txz