some documentation updates
[wmaker-crm.git] / Install
blob49c119d280338ae1aef3ee34682192123d1666aa
1 #!/bin/sh
3 # WindowMaker configuration and compilation script.
5 # Copyright (c) 1997, 1998, 1999 Alfredo K. Kojima
8 export LINGUAS;LINGUAS=""
9 if test "$NLSDIR" = ""; then
10 export NLSDIR;NLSDIR="/usr/lib/locale"
14 OPTIONS=""
15 PREFIX="/usr/local"
17 perai() {
18 echo "Type <Return> to continue"
19 read nada
23 perform() {
24 if ! $* ; then
25 echo
26 echo "Window Maker installation failed or aborted by user."
27 exit 1
31 help() {
32 echo "Usage: $(basename $0) <switch>"
33 echo "Where switches are:"
34 echo " -s --quiet make silent build"
35 echo " -h --help show this message"
36 echo ""
37 exit $1
41 OPTIONS=""
42 MAKE_OPTIONS=""
43 while [ -n "$1" ]
45 case "$1" in
46 "-s"|"--quiet") OPTIONS="--quiet"
47 MAKE_OPTIONS="-s";;
48 "-h"|"--help") help 0;;
49 *) echo "bad command-line parameter $1"
50 help 1;;
51 esac
52 shift
53 done
55 trap "echo Window Maker installation aborted. ; exit 1" 2 3
57 echo
58 echo "========================="
59 echo "Window Maker Installation"
60 echo "========================="
61 echo
62 echo "NOTE: If this script fails, read the INSTALL file and"
63 echo "install by hand."
64 echo
65 echo "Please read the README, INSTALL and FAQ files before e-mailing "
66 echo "questions. We will IGNORE any questions that are already"
67 echo "answered in the documentation."
68 echo
69 perai
70 echo "Did you read the INSTALL file?"
71 echo -n "<y/n> "
72 read rtfm
73 if [ "$rtfm" != y ]; then
74 echo "Please read the INSTALL file before installing"
75 exit
77 echo "Are you sure?"
78 echo -n "<y/n> "
79 read rtfm
80 if [ "$rtfm" != y ]; then
81 echo "Please read the INSTALL file before installing"
82 exit
84 echo "Are you lying?"
85 echo -n "<y/n> "
86 read rtfm
87 if [ "$rtfm" != n ]; then
88 echo "What a shame!"
89 echo "Please read the INSTALL file before installing"
90 exit
92 echo "Do you *swear* that you really read the INSTALL file?"
93 echo -n "<y/n> "
94 read rtfm
95 if [ "$rtfm" != y ]; then
96 echo "Please read the INSTALL file before installing"
97 exit
99 echo "Last chance. You will not get help if you have some problem"
100 echo "because you didn't read that file. Even if your computer explodes."
101 echo "Do you *really* read it?"
102 echo -n "<y/n> "
103 read rtfm
104 if [ "$rtfm" != y ]; then
105 echo "Please read the INSTALL file before installing"
106 exit
108 echo
109 echo "Ok, you have been warned."
110 echo
111 perai
114 if test "$USER" != "root"; then
115 echo
116 echo "Warning: you must run this script as root to install"
117 echo "Window Maker. Hit <Control>-<C> to quit this script."
118 perai
119 echo
123 echo
124 echo "Option Selection"
125 echo "================"
127 ######################## NLS
128 echo
129 echo "Do you want National Language Support?"
130 echo -n "<y/n> [n] "
131 read NLS
133 if [ "$NLS" = "y" -o "$NLS" = "Y" ]; then
134 NLS="Y"
135 echo "The supported locales are:"
136 ling=` (cd po; /bin/ls *.po) `
137 ALL_LINGUAS=""
138 for l in $ling; do
139 lname=`(cd po; grep Language-Team $l|cut -f2- -d:|cut -f1 -d\\\\|cut -f1 -d\<)`
140 lname=`echo $lname`
141 lcode=`basename $l .po`
142 ALL_LINGUAS="$ALL_LINGUAS $lcode"
143 echo "$lcode $lname"
144 done
145 echo "Type in the locales you want (all will install everything) [none]"
146 read foo
147 if test "$foo" = "all"; then
148 LINGUAS="$ALL_LINGUAS"
149 else
150 LINGUAS="$foo"
152 echo "Selected locales are: $LINGUAS"
154 MB=""
155 for i in $LINGUAS; do
156 ok=0
157 for b in $ALL_LINGUAS; do
158 if test "$b" = "$i"; then
159 ok=1
160 break
162 done
163 if test "$ok" = "0"; then
164 echo
165 echo "$i is not a supported locale"
166 perai
167 continue
170 done
171 echo
172 echo "Where do you want to put the message files? [$NLSDIR]"
173 echo -n "? "
174 read foo
175 if test "x$foo" != "x"; then
176 NLSDIR=$foo
179 ##################### Installation path
181 done=0
182 while [ $done = 0 ]; do
183 echo
184 echo "Where do you want to install Window Maker? [$PREFIX]"
185 echo "Don't change it if you don't know what you're doing."
186 if test "$USER" != "root"; then
187 echo "Make sure to specify a path where you have write permission."
189 echo "(The default will put Window Maker in $PREFIX/bin, $PREFIX/lib etc.)"
190 echo -n "? "
191 read foo
192 if test "x$foo" != "x"; then
193 if [ "$foo" = "y" -o "$foo" = "n" ]; then
194 echo
195 echo "Hmm... I don't think you really want to install Window Maker into \"$foo\""
196 echo
197 else
198 done=1
199 PREFIX=$foo
201 else
202 done=1
204 echo
205 echo " $PREFIX/bin must be in the PATH environment variable"
206 echo "of all users who will use Window Maker"
207 perai
208 done
210 OPTIONS="$OPTIONS --prefix=$PREFIX"
213 ##################### Install stripped binaries?
215 INSTALL="install"
216 echo "Do you want stripped binaries to be installed?"
217 echo "Installed binaries will be smaller (with debug info removed)."
218 echo -n "<y/n> [n] "
219 read foo
220 if [ "$foo" = y -o "$foo" = Y ]; then
221 INSTALL="install-strip"
225 ##################### Configure
226 echo "--------------------------"
227 echo "Configuring Window Maker..."
228 echo "--------------------------"
229 if [ `uname -s` = "SCO_SV" ]; then
230 echo "CFLAGS=\"$CFLAGS -belf -DANSICPP\" ./configure $OPTIONS"
232 CFLAGS="$CFLAGS -belf -DANSICPP"
234 perform ./configure $OPTIONS
235 else
236 echo "CFLAGS=\"$CFLAGS $GCCFLAGS\" ./configure $OPTIONS"
238 CFLAGS="$CFLAGS $GCCFLAGS"
240 perform ./configure $OPTIONS
244 #################### Compile
245 echo "-------------------------"
246 echo "Compiling Window Maker..."
247 echo "-------------------------"
248 (cd src; perform make $MAKE_OPTIONS clean)
249 perform make $MAKE_OPTIONS
251 echo "--------------------------"
252 echo "Installing Window Maker..."
253 echo "--------------------------"
255 perform make $MAKE_OPTIONS $INSTALL
257 if [ `uname -s` = "Linux" ]; then
258 echo
259 echo " Make sure $PREFIX/lib is in the /etc/ld.so.conf file"
260 /sbin/ldconfig
263 echo
264 echo "Installation Finished!"
265 echo
266 echo "Now, each user that wishes to use WindowMaker must run the wmaker.inst"
267 echo "script that was just installed."
270 if test "$NLS" = "Y"; then
271 echo "Don't forget to set the LANG environment variable to your locale"