summaryrefslogtreecommitdiff
path: root/games/xscrabble/xscrabble.SlackBuild
blob: ffbd8a60f86e2314a0fc641d4637168fa0ce45e8 (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
#!/bin/sh

# Slackware build script for Xscrabble
# Written by Steven A. McIntosh (samac) (mcintosh@cotterochan.co.uk)
# Modified by Robby Workman <rworkman@slackbuilds.org>

PRGNAM=xscrabble
VERSION=2.12
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

DEFAULT_LANG=${DEFAULT_LANG:-en}

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

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

# The included "build" script isn't exactly ideal, so we'll do it ourselves
printf \
"#define VERSION $(printf $VERSION|tr -d \.)
#define DICT_FILE \"/usr/share/games/scrabble/en/OSPD3.gz\"
#define SCORE_FILE \"/var/games/scrabble/en/scrabble_scores\"
#define RULES_FILE \"/usr/share/games/scrabble/en/scrabble_rules\"\n" \
  > src/config.h
xmkmf -a
make

mkdir -p $PKG/usr/games
cp -a src/xscrab src/xscrabble $PKG/usr/games
chown root:games $PKG/usr/games/*
chmod 2755 $PKG/usr/games/*

mkdir -p $PKG/var/games/scrabble/{en,fr}
chown -R root:games $PKG/var/games/scrabble
chmod -R 2775 $PKG/var/games/scrabble

mkdir -p $PKG/etc/X11/app-defaults $PKG/usr/share/games/scrabble/{en,fr}

install_english() {
  tar xf $CWD/xscrabble_en.tar.bz2
  mv xscrabble_en/lib/* $PKG/usr/share/games/scrabble/en
  rm -f $PKG/usr/share/games/scrabble/en/scrabble_scores
  ( cd $PKG/usr/share/games/scrabble/en
    ln -fs /var/games/scrabble/en/scrabble_scores .
  )
  touch $PKG/var/games/scrabble/en/scrabble_scores.new
  chmod 0664 $PKG/var/games/scrabble/en/scrabble_scores.new
  mv xscrabble_en/app-defaults/XScrabble_en \
    $PKG/etc/X11/app-defaults/XScrabble_en
  ( cd $PKG/etc/X11/app-defaults ; ln -fs XScrabble_en XScrabble )
}
install_french() {
  tar xf $CWD/xscrabble_fr.tar.bz2
  mv xscrabble_fr/lib/* $PKG/usr/share/games/scrabble/fr
  rm -f $PKG/usr/share/games/scrabble/fr/scrabble_scores
  ( cd $PKG/usr/share/games/scrabble/fr
    ln -fs /var/games/scrabble/fr/scrabble_scores .
  )
  touch $PKG/var/games/scrabble/fr/scrabble_scores.new
  chmod 0664 $PKG/var/games/scrabble/fr/scrabble_scores.new
  mv xscrabble_fr/app-defaults/XScrabble_fr \
    $PKG/etc/X11/app-defaults/XScrabble_fr
  ( cd $PKG/etc/X11/app-defaults ; ln -fs XScrabble_fr XScrabble )
}

if [ -e $CWD/xscrabble_en.tar.bz2 -a -e $CWD/xscrabble_fr.tar.bz2 ]; then
  if [ "$DEFAULT_LANG" = "en" ]; then
    install_french
    install_english
  else
    install_english
    install_french
  fi
elif [ -e $CWD/xscrabble_fr.tar.bz2 ]; then
  install_french
elif [ -e $CWD/xscrabble_en.tar.bz2 ]; then
  install_english
else
  printf "You need to have at least one language pack - get them here:\n"
  printf "ftp://ftp.ac-grenoble.fr/ge/educational_games/xscrabble_en.tar.bz2\n"
  printf "ftp://ftp.ac-grenoble.fr/ge/educational_games/xscrabble_fr.tar.bz2\n"
  exit 1
fi

mkdir -p $PKG/usr/share/{applications,pixmaps}
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png

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.tgz