slackbuilds_ponce/games/scid/scid.SlackBuild

127 lines
3.4 KiB
Text
Raw Normal View History

2010-05-12 23:29:29 +02:00
#!/bin/sh
# Slackware build script for scid
# written by Marco Pessotto <melmothx@gmail.com>
# public domain
# Modified by Robby Workman <rworkman@slackbuilds.org>
PRGNAM=scid
VERSION=${VERSION:-4.3}
2010-05-12 23:29:29 +02:00
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
2010-05-12 23:29:29 +02:00
CWD=$(pwd)
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:27:01 +02:00
LIBDIRSUFFIX=""
2010-05-12 23:29:29 +02:00
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
2010-05-13 00:27:01 +02:00
LIBDIRSUFFIX=""
2010-05-12 23:29:29 +02:00
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
2010-05-13 00:27:01 +02:00
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
2010-05-12 23:29:29 +02:00
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM
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 {} \;
2010-05-12 23:29:29 +02:00
# Don't force the possibly wrong tcl version.
sed -i -e "s/tclsh8.5;/tclsh;/" configure
2010-05-12 23:29:29 +02:00
./configure \
BINDIR="/usr/bin" \
SHAREDIR="/usr/share/scid" \
OPTIMIZE="$SLKCFLAGS -fno-rtti -fno-exceptions"
make all_scid
2010-05-12 23:29:29 +02:00
make strip
make install_scid DESTDIR=$PKG
## Add some stuff if it's present
if [ -f $CWD/scidlet40k.zip ] ; then
mkdir -p $PKG/usr/share/scid/books
unzip $CWD/scidlet40k.zip -d $PKG/usr/share/scid/books
fi
if [ -f $CWD/ratings_2008_4.zip ] ; then
2010-05-12 23:29:29 +02:00
mkdir -p $PKG/usr/share/scid/data
unzip $CWD/ratings_2008_4.zip -d $PKG/usr/share/scid/data
fi
if [ -f $CWD/photos2007.zip ] ; then
2010-05-12 23:29:29 +02:00
mkdir -p $PKG/usr/share/scid/photos
unzip $CWD/photos2007.zip -d $PKG/usr/share/scid/photos
fi
# Fix some permissions
2010-05-12 23:29:29 +02:00
find $PKG/usr/share/scid -type d -exec chmod 0755 {} \;
find $PKG/usr/share/scid -type f -exec chmod 0644 {} \;
# We're going to diverge from upstream a bit in location but not functionality
# This will require users to be in the 'games' group for write permissions
mkdir -p $PKG/var/games/scid
2010-05-12 23:29:29 +02:00
mv $PKG/usr/share/scid/{bases,books} $PKG/var/games/scid
chown -R root:games $PKG/var/games/scid
find $PKG/var/games/scid -type d -exec chmod 2775 {} \;
find $PKG/var/games/scid -type f -exec chmod 0664 {} \;
cd $PKG/usr/share/scid
2010-05-12 23:29:29 +02:00
ln -s ../../../var/games/scid/bases .
ln -s ../../../var/games/scid/books .
cd -
2010-05-12 23:29:29 +02:00
# Add a desktop menu entry
mkdir -p $PKG/usr/share/{applications,pixmaps}
cat $CWD/scid.desktop > $PKG/usr/share/applications/scid.desktop
cat $CWD/scid.png > $PKG/usr/share/pixmaps/scid.png
## Add the manpage (Thanks to debian)
mkdir -p $PKG/usr/man/man1
cd $PKG/usr/man/man1
2010-05-12 23:29:29 +02:00
sed "s%@VERSION@%$VERSION%g" $CWD/scid.1 | gzip -9c > scid.1.gz
for i in \
sc_remote scmerge pgnscid sc_spell spliteco sc_eco sc_tree scidpgn pgnfix \
tkscid sc_epgn sc_addmove tcscid sc_import scidlet scidt ;
2010-05-12 23:29:29 +02:00
do ln -s scid.1.gz $i.1.gz
done
cd -
2010-05-12 23:29:29 +02:00
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
ChangeLog CHANGES COPYING help README THANKS TODO \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
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:27:01 +02:00
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}