summaryrefslogtreecommitdiff
path: root/games/scid/scid.SlackBuild
blob: c682c5e261664beff2bc3e6dd7e17592ca4db9bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/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}
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

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

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM
chmod -R u+w,go+r-w,a-s .
chown -R root:root .

./configure \
  BINDIR="/usr/bin" \
  SHAREDIR="/usr/share/scid" \
  OPTIMIZE="$SLKCFLAGS -fno-rtti -fno-exceptions"

make all_scid  
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 
    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 
    mkdir -p $PKG/usr/share/scid/photos
    unzip $CWD/photos2007.zip -d $PKG/usr/share/scid/photos
fi

# Fix some permissions 
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 
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
  ln -s ../../../var/games/scid/bases .
  ln -s ../../../var/games/scid/books .
cd -

# 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
  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 ; 
    do ln -s scid.1.gz $i.1.gz
  done
cd -

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
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}