2018-05-28 21:12:29 +02:00
|
|
|
#!/bin/bash
|
2010-05-19 10:58:23 +02:00
|
|
|
|
2020-11-26 00:25:45 +01:00
|
|
|
# Copyright 2018 paul wisehart <paul@1ud2.com>
|
2021-09-06 20:55:54 +02:00
|
|
|
# Copyright 2021 Patrick J. Volkerding, Sebeka, Minnesota, USA
|
2020-11-26 00:25:45 +01:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use of this script, with or without modification, is
|
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
|
|
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
# Modified by Robby Workman <rworkman@slackbuilds.org>
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2011-04-25 15:37:00 +02:00
|
|
|
PKGNAM=libsamplerate
|
2021-09-06 20:55:54 +02:00
|
|
|
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
|
|
|
|
BUILD=${BUILD:-1}
|
2010-05-19 10:58:23 +02:00
|
|
|
|
|
|
|
# Automatically determine the architecture we're building on:
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2018-05-28 21:12:29 +02:00
|
|
|
i?86) export ARCH=i586 ;;
|
2010-05-19 10:58:23 +02:00
|
|
|
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}
|
2011-04-25 15:37:00 +02:00
|
|
|
PKG=$TMP/package-$PKGNAM
|
2022-11-21 21:23:13 +01:00
|
|
|
OUTPUT=${OUTPUT:-$TMP}
|
2010-05-19 10:58:23 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2010-05-19 10:58:23 +02:00
|
|
|
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
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# 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
|
|
|
|
|
2021-09-06 20:55:54 +02:00
|
|
|
NUMJOBS=${NUMJOBS:-" -j $(expr $(nproc) + 1) "}
|
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
2011-04-25 15:37:00 +02:00
|
|
|
rm -rf $PKGNAM-$VERSION
|
2021-09-06 20:55:54 +02:00
|
|
|
tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
|
2018-05-28 21:12:29 +02:00
|
|
|
cd $PKGNAM-$VERSION || exit 1
|
2010-05-19 10:58:23 +02:00
|
|
|
chown -R root:root .
|
|
|
|
chmod -R u+w,go+r-w,a-s .
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
sed -i "s|\$prefix/share/doc/libsamplerate0-dev/html|\$htmldir|g" configure
|
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
|
|
|
--sysconfdir=/etc \
|
2021-01-25 21:42:50 +01:00
|
|
|
--docdir=/usr/doc/$PKGNAM-$VERSION \
|
2018-05-28 21:12:29 +02:00
|
|
|
--htmldir=/usr/doc/$PKGNAM-$VERSION/html \
|
2010-05-19 10:58:23 +02:00
|
|
|
--disable-static \
|
|
|
|
--localstatedir=/var \
|
2018-05-28 21:12:29 +02:00
|
|
|
--build=$ARCH-slackware-linux || exit 1
|
2010-05-19 10:58:23 +02:00
|
|
|
|
2021-09-06 20:55:54 +02:00
|
|
|
make $NUMJOBS || make || exit 1
|
2010-05-19 10:58:23 +02:00
|
|
|
make install DESTDIR=$PKG || exit 1
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# Don't ship .la files:
|
|
|
|
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
|
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
2011-04-25 15:37:00 +02:00
|
|
|
mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
|
2021-01-25 21:42:50 +01:00
|
|
|
cp -a AUTHORS* COPYING* NEWS* README* $PKG/usr/doc/$PKGNAM-$VERSION
|
2010-05-19 10:58:23 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
2011-04-25 15:37:00 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
|
|
|
|
|