2010-05-11 14:28:17 +02:00
|
|
|
#!/bin/sh
|
2010-05-13 00:26:02 +02:00
|
|
|
#
|
2010-05-11 14:28:17 +02:00
|
|
|
# Slackware build script for Brutal Chess
|
2010-05-13 00:26:02 +02:00
|
|
|
#
|
|
|
|
# Copyright 2009 Erik W. Hanson, Minneapolis, MN, USA
|
|
|
|
# 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-11 14:28:17 +02:00
|
|
|
|
|
|
|
PRGNAM=brutalchess
|
|
|
|
VERSION=0.5.2
|
2012-04-03 07:09:25 +02:00
|
|
|
BUILD=${BUILD:-2}
|
2010-05-11 14:28:17 +02:00
|
|
|
TAG=${TAG:-_SBo}
|
2010-05-13 00:26:02 +02:00
|
|
|
|
2010-06-04 07:04:05 +02:00
|
|
|
# Automatically determine the architecture we're building on:
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
# Unless $ARCH is already set, use uname -m for all other archs:
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-11 19:44:25 +02:00
|
|
|
CWD=$(pwd)
|
2010-05-11 14:28:17 +02:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
2010-05-13 00:26:02 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 14:28:17 +02:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-05-13 00:26:02 +02:00
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
2010-06-04 07:04:05 +02:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 14:28:17 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG
|
2010-05-13 00:26:02 +02:00
|
|
|
cd $TMP
|
2010-05-11 14:28:17 +02:00
|
|
|
rm -rf $PRGNAM-$VERSION
|
|
|
|
# Currently the filename is .tar.gz but it is really only a .tar
|
|
|
|
# but tar does not mind so do not change this.
|
|
|
|
tar xvf $CWD/$PRGNAM-alpha-$VERSION-src.tar.gz || exit 1
|
|
|
|
cd $PRGNAM-$VERSION
|
|
|
|
chown -R root:root .
|
|
|
|
chmod -R u+w,go+r-w,a-s .
|
|
|
|
|
2010-05-13 00:26:02 +02:00
|
|
|
patch -p0 -i $CWD/brutalchess-0.5.2-fix-FTBFS.patch || exit 1
|
|
|
|
patch -p0 -i $CWD/brutalchess-0.5.2-gcc4.3.patch || exit 1
|
2012-04-03 07:09:25 +02:00
|
|
|
# fix for gcc-4.7.x build
|
|
|
|
patch -p1 -i $CWD/brutalchess-0.5.2-gcc4.7.patch || exit 1
|
2010-05-13 00:26:02 +02:00
|
|
|
|
2010-05-11 14:28:17 +02:00
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--bindir=/usr/games \
|
2010-05-13 00:26:02 +02:00
|
|
|
--libdir=/usr/lib$LIBDIRSUFFIX \
|
2010-05-11 14:28:17 +02:00
|
|
|
--sysconfdir=/etc \
|
|
|
|
--localstatedir=/var \
|
2010-05-13 00:26:02 +02:00
|
|
|
--build=$ARCH-slackware-linux \
|
2010-05-11 14:28:17 +02:00
|
|
|
|| exit 1
|
|
|
|
|
|
|
|
make || exit 1
|
|
|
|
make install DESTDIR=$PKG || exit 1
|
|
|
|
|
2010-05-19 08:34:20 +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
|
2010-05-11 14:28:17 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc
|
|
|
|
mv $PKG/usr/share/brutalchess/doc $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
# Manually copy desktop file and icon
|
|
|
|
mkdir -p $PKG/usr/share/{applications,pixmaps}
|
|
|
|
cp $CWD/brutalchess.desktop $PKG/usr/share/applications
|
|
|
|
cp $CWD/brutalchess.png $PKG/usr/share/pixmaps/brutalchess.png
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
|
|
|
|
cd $PKG
|
2010-05-13 00:26:02 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|