2010-08-16 00:13:29 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for discord
|
|
|
|
|
2015-01-15 18:49:57 +01:00
|
|
|
# Written by Ruan K. F <ruan.klein@gmail.com>
|
2010-08-16 00:13:29 +02:00
|
|
|
#
|
|
|
|
# Redistribution and use of this script, with or without modification, is
|
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of script must retain the above copyright notice,
|
|
|
|
# this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "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 COPYRIGHT OWNER OR
|
|
|
|
# CONTRIBUTORS 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.
|
|
|
|
|
|
|
|
PRGNAM=discord
|
|
|
|
VERSION=${VERSION:-3.2.1}
|
2015-01-21 12:12:40 +01:00
|
|
|
BUILD=${BUILD:-3}
|
2010-08-16 00:13:29 +02:00
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
2015-01-15 18:49:57 +01:00
|
|
|
DOCS="AUTHORS ChangeLog COPYING INSTALL NEWS README"
|
|
|
|
|
|
|
|
# The svn version contains new features like Sin, Square, Triangle, half saw wave and others.
|
|
|
|
# The Spin voice is other feature for this version.
|
|
|
|
# New options:
|
|
|
|
# --auto_volume and --max_volume options to specify volume levels.
|
|
|
|
SVN=${SVN:-no}
|
2015-01-21 12:12:40 +01:00
|
|
|
SVN_LINK=svn://svn.code.sf.net/p/$PRGNAM/code/trunk
|
|
|
|
PKGSVN=$PRGNAM-svn
|
2015-01-15 18:49:57 +01:00
|
|
|
|
2010-08-16 00:13:29 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -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
|
|
|
|
|
2015-01-15 18:49:57 +01:00
|
|
|
set -e
|
2010-08-16 00:13:29 +02:00
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $PRGNAM-$VERSION
|
|
|
|
tar -jxvf $CWD/$PRGNAM-$VERSION.tar.bz2
|
|
|
|
cd $PRGNAM-$VERSION
|
|
|
|
chown -R root:root .
|
2013-11-22 08:37:19 +01:00
|
|
|
find -L . \
|
2015-01-15 18:49:57 +01:00
|
|
|
\( -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 {} \;
|
2010-08-16 00:13:29 +02:00
|
|
|
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--mandir=/usr/man \
|
|
|
|
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
|
|
|
--build=$ARCH-slackware-linux
|
|
|
|
|
2015-01-21 12:12:40 +01:00
|
|
|
make
|
2015-01-15 18:49:57 +01:00
|
|
|
make install DESTDIR=$PKG
|
|
|
|
if [ "$SVN" = "yes" ]; then
|
|
|
|
OPT="${SLKCFLAGS} -Wall -W -s "
|
|
|
|
LIBS=" -lm -lpthread -lasound -lncurses -lsndfile -lm -lsamplerate "
|
|
|
|
DOCS+=" $PKGSVN/CAUTION $PKGSVN/DISCLAIMER"
|
|
|
|
svn checkout $SVN_LINK $PKGSVN || exit 1
|
|
|
|
cd $PKGSVN
|
|
|
|
# fix version on discord.c to compile
|
2015-01-21 12:12:40 +01:00
|
|
|
sed -i 's/^\(\#.*\)$/\#include\ \"version.h\"\n\1/' discord.c
|
2015-01-15 18:49:57 +01:00
|
|
|
echo -e "#ifndef VERSION\n\t#define VERSION \"${VERSION}svn\"\n#endif" > version.h
|
|
|
|
gcc $OPT discord.c $LIBS -o $PKGSVN || exit 1;
|
|
|
|
install -m0755 -o 0:0 $PKGSVN $PKG/usr/bin
|
|
|
|
cd ..
|
|
|
|
fi
|
2010-08-16 00:13:29 +02:00
|
|
|
|
2015-01-21 12:12:40 +01:00
|
|
|
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
2010-08-16 00:13:29 +02:00
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
|
|
|
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
|
|
|
|
2015-01-21 12:12:40 +01:00
|
|
|
|
2010-08-16 00:13:29 +02:00
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
2015-01-15 18:49:57 +01:00
|
|
|
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
|
2010-08-16 00:13:29 +02:00
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
2015-01-21 12:12:40 +01:00
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
2015-01-15 18:49:57 +01:00
|
|
|
|
2010-08-16 00:13:29 +02:00
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|