slackbuilds/y/gnugo/gnugo.SlackBuild
2011-04-02 20:45:52 +07:00

97 lines
2.2 KiB
Bash
Executable file

#!/bin/sh -x
# variables
TAG=cyco
OUTPUT=/tmp
TMP=/tmp/$TAG
CWD=$(pwd)
PRGNAM=gnugo
PKG=$TMP/pkg-$PRGNAM
VERSION=3.8
EXT=tar.gz
DOCS="AUTHORS ChangeLog COPYING INSTALL NEWS README TODO"
ARCH=x86_64
BUILD=1
PREFIX=/usr
SLCKFLAGS="-fPIC -O2"
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM-$VERSION
mkdir -p $PKG
# mise en place
cd $TMP
tar xf $CWD/$PRGNAM-$VERSION.$EXT
cd $PRGNAM-$VERSION
# configuration
CFLAGS=$SLCKFLAGS \
CPPFLAGS=$SLCKFLAGS \
./configure \
--prefix=$PREFIX \
--mandir=$PREFIX/man \
--infodir=$PREFIX/info
# compilation
make -j3 PREFIX=$PREFIX
# installation
make install DESTDIR=$PKG
# correction
cd $PKG
chown -R root:root *
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cd $TMP/$PRGNAM-$VERSION
cp -R $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
[ -d $PKG/usr/info ] && find $PKG/usr/info -type f -name "*.info*" -exec gzip -9f {} \;
[ -d $PKG/usr/info ] && rm $PKG/usr/info/dir{,.gz,.new}
# Strip binaries
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/doinst.sh
cd /usr/info
[ -e dir ] && rm dir
[ -e dir.gz ] && rm dir.gz
[ -e dir.new ] && rm dir.new
for file in \$(ls *.gz | grep -v ".*\-[0-9]\+\.gz")
do
install-info \$file ./dir
done
EOF
cat <<EOF > $PKG/install/slack-desc
$PRGNAM: $PRGNAM (Go game)
$PRGNAM:
$PRGNAM: GNU Go is a free program that plays the game of Go. GNU Go has played
$PRGNAM: thousands of games on the NNGS Go server. GNU Go is now also playing
$PRGNAM: regularly on the Legend Go Server in Taiwan, on the WING server in Japan,
$PRGNAM: and many volunteers run GNU Go clients on KGS. GNU Go has established itself
$PRGNAM: as the leading non-commercial go program in the recent tournaments that it
$PRGNAM: has taken part in.
$PRGNAM:
$PRGNAM: http://www.gnu.org/software/gnugo/gnugo.html
$PRGNAM:
EOF
# empaquetage
cd $PKG
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz