1#!/bin/sh
2
3# Install defaults
4APPDEFAULTS=/etc/X11/app-defaults
5BINDIR=/usr/games
6LIBDIR=/usr/share/games/scrabble
7
8# Version (don't modify without knowing!!)
9MAJOR=2
10MINOR=12
11
12if ! [ "$*" ] ; then
13  echo "\
14Usage:
15   ./build bin          builds the binary programs
16   ./build install      installs the binary programs
17   ./build lang XX      installs language XX
18                       (currently available: en, fr)
19   ./build clean        cleans everything
20
21Present settings are:
22   APPDEFAULTS=$APPDEFAULTS
23   BINDIR=$BINDIR
24   LIBDIR=$LIBDIR
25First edit these parameters as needed in the 'build' script...
26"
27fi
28
29if test "$1" = "bin" ; then
30  xmkmf -a
31  echo "Building src/config.h"
32  echo "\
33#define VERSION $MAJOR$MINOR
34#define DICT_FILE \"$LIBDIR/en/OSPD3.gz\"
35#define SCORE_FILE \"$LIBDIR/en/scrabble_scores\"
36#define RULES_FILE \"$LIBDIR/en/scrabble_rules\"
37" > src/config.h
38  make
39  echo "
40Now, type './build install' to install programs in $BINDIR
41"
42fi
43
44if test "$1" = "clean" ; then
45  if [ -r Makefile ]; then
46    make clean
47  fi
48  rm -rf exports Xc/exports
49  echo "rm -rf exports Xc/exports"
50  rm -f *~ Makefile* src/Makefile* src/config.h
51  echo "rm -f *~ Makefile* src/Makefile* src/config.h"
52fi
53
54if test "$1" = "install" ; then
55  mkdirhier $BINDIR
56  echo "mkdirhier $BINDIR"
57  install -c -s src/xscrab $BINDIR
58  echo "install -c -s src/xscrab $BINDIR"
59  install -c -s src/xscrabble $BINDIR
60  echo "install -c -s src/xscrabble $BINDIR"
61  rm -f $APPDEFAULTS/XScrabble
62  cp -f XScrabble $APPDEFAULTS
63  echo "cp -f XScrabble $APPDEFAULTS"
64  echo "
65Now, type './build lang XX' to install dictionaries in
66           $LIBDIR
67The language installed in last place will be the default.
68"
69fi
70
71if test "$1" = "lang" ; then
72
73  if ! [ -r ../xscrabble_$2.tar.bz2 ] ; then
74     echo "Can't find package xscrabble_$2.tar.bz2 !!"
75     echo "Please download the dictionary file xscrabble_$2.tar.bz2"
76     echo "(if any), from  ftp://ftp.ac-grenoble.fr/ge/educational_games"
77     echo "and make sure that you put it under the same (sub)directory"
78     echo "as the main package xscrabble-2.xx.tgz"
79     exit
80  fi
81  echo "Installing language ($en) dictionary and related files..."
82  mkdirhier $LIBDIR
83  tar xvfj ../xscrabble_$2.tar.bz2
84  echo ""
85  rm -rf $LIBDIR/$2
86  echo "rm -rf $LIBDIR/$2"
87  mv -f xscrabble_$2/lib $LIBDIR/$2
88  echo "mv -f xscrabble_$2/lib $LIBDIR/$2"
89  mv -f xscrabble_$2/app-defaults/XScrabble_$2 $APPDEFAULTS
90  echo "mv -f xscrabble_$2/app-defaults/XScrabble_$2 $APPDEFAULTS"
91  rm -f $APPDEFAULTS/XScrabble
92  echo "rm -f $APPDEFAULTS/XScrabble"
93  ln -fs $APPDEFAULTS/XScrabble_$2 $APPDEFAULTS/XScrabble
94  echo "ln -fs $APPDEFAULTS/XScrabble_$2 $APPDEFAULTS/XScrabble"
95  chmod a+rwx $LIBDIR/$2
96  chmod a+rw $LIBDIR/$2/scrabble_scores
97  rm -rf xscrabble_$2
98
99  echo "
100Type './build lang YY' to install any other dictionaries in
101          $LIBDIR
102The language installed in last place will be the default.
103When installation is finished, type './build clean' to clean-up everything.
104"
105fi
106
107
108
109
110