Added 2 functions to retrieve the default system fonts:
[wmaker-crm.git] / Install
blob9051e28eec8653a33965a7153db2d16c3c72b97b
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
71 echo "Did you install libPropList? If not, please install it now."
72 echo
73 perai
74 echo "Did you read the INSTALL file?"
75 echo -n "<y/n> "
76 read rtfm
77 if [ "$rtfm" != y ]; then
78 echo "Please read the INSTALL file before installing"
79 exit
81 echo "Are you sure?"
82 echo -n "<y/n> "
83 read rtfm
84 if [ "$rtfm" != y ]; then
85 echo "Please read the INSTALL file before installing"
86 exit
88 echo "Are you lying?"
89 echo -n "<y/n> "
90 read rtfm
91 if [ "$rtfm" != n ]; then
92 echo "What a shame!"
93 echo "Please read the INSTALL file before installing"
94 exit
96 echo "Do you *swear* that you really read the INSTALL file?"
97 echo -n "<y/n> "
98 read rtfm
99 if [ "$rtfm" != y ]; then
100 echo "Please read the INSTALL file before installing"
101 exit
103 echo "Last chance. You will not get help if you have some problem"
104 echo "because you didn't read that file. Even if your computer explodes."
105 echo "Do you *really* read it?"
106 echo -n "<y/n> "
107 read rtfm
108 if [ "$rtfm" != y ]; then
109 echo "Please read the INSTALL file before installing"
110 exit
112 echo
113 echo "Ok, you have been warned."
114 echo
115 perai
118 if test "$USER" != "root"; then
119 echo
120 echo "Warning: you must run this script as root to install"
121 echo "Window Maker. Hit <Control>-<C> to quit this script."
122 perai
123 echo
127 echo
128 echo "Option Selection"
129 echo "================"
131 ######################## KDE
132 echo
133 echo "Do you want KDE support?"
134 echo -n "<y/n> [n] "
135 read kde
136 if [ "$kde" = y -o "$kde" = Y ]; then
137 OPTIONS="$OPTIONS --enable-kde"
140 ######################## GNOME
141 echo
142 echo "Do you want GNOME support?"
143 echo -n "<y/n> [n] "
144 read gnome
145 if [ "$gnome" = y -o "$gnome" = Y ]; then
146 OPTIONS="$OPTIONS --enable-gnome"
149 ######################## OLWM
150 echo
151 echo "Do you want OPEN LOOK(tm)/olwm support?"
152 echo -n "<y/n> [n] "
153 read olwm
154 if [ "$olwm" = y -o "$olwm" = Y ]; then
155 OPTIONS="$OPTIONS --enable-openlook"
158 ######################## NLS
159 echo
160 echo "Do you want National Language Support?"
161 echo -n "<y/n> [n] "
162 read NLS
164 if [ "$NLS" = "y" -o "$NLS" = "Y" ]; then
165 NLS="Y"
166 echo "The supported locales are:"
167 ling=` (cd po; /bin/ls *.po) `
168 ALL_LINGUAS=""
169 for l in $ling; do
170 lname=`(cd po; grep Language-Team $l|cut -f2- -d:|cut -f1 -d\\\\|cut -f1 -d\<)`
171 lname=`echo $lname`
172 lcode=`basename $l .po`
173 ALL_LINGUAS="$ALL_LINGUAS $lcode"
174 echo "$lcode $lname"
175 done
176 echo "Type in the locales you want (all will install everything) [none]"
177 read foo
178 if test "$foo" = "all"; then
179 LINGUAS="$ALL_LINGUAS"
180 else
181 LINGUAS="$foo"
183 echo "Selected locales are: $LINGUAS"
185 MB=""
186 for i in $LINGUAS; do
187 ok=0
188 for b in $ALL_LINGUAS; do
189 if test "$b" = "$i"; then
190 ok=1
191 break
193 done
194 if test "$ok" = "0"; then
195 echo
196 echo "$i is not a supported locale"
197 perai
198 continue
201 done
202 echo
203 echo "Where do you want to put the message files? [$NLSDIR]"
204 echo -n "? "
205 read foo
206 if test "x$foo" != "x"; then
207 NLSDIR=$foo
210 ##################### Installation path
212 done=0
213 while [ $done = 0 ]; do
214 echo
215 echo "Where do you want to install Window Maker? [$PREFIX]"
216 echo "Don't change it if you don't know what you're doing."
217 if test "$USER" != "root"; then
218 echo "Make sure to specify a path where you have write permission."
220 echo "(The default will put Window Maker in $PREFIX/bin, $PREFIX/lib etc.)"
221 echo -n "? "
222 read foo
223 if test "x$foo" != "x"; then
224 if [ "$foo" = "y" -o "$foo" = "n" ]; then
225 echo
226 echo "Hmm... I don't think you really want to install Window Maker into \"$foo\""
227 echo
228 else
229 done=1
230 PREFIX=$foo
232 else
233 done=1
235 echo
236 echo " $PREFIX/bin must be in the PATH environment variable"
237 echo "of all users who will use Window Maker"
238 perai
239 done
241 OPTIONS="$OPTIONS --prefix=$PREFIX"
244 ##################### Install stripped binaries?
246 INSTALL="install"
247 echo "Do you want stripped binaries to be installed?"
248 echo "Installed binaries will be smaller (with debug info removed)."
249 echo -n "<y/n> [n] "
250 read foo
251 if [ "$foo" = y -o "$foo" = Y ]; then
252 INSTALL="install-strip"
256 ##################### Configure
257 echo "--------------------------"
258 echo "Configuring Window Maker..."
259 echo "--------------------------"
260 if [ `uname -s` = "SCO_SV" ]; then
261 echo "CFLAGS=\"$CFLAGS -belf -DANSICPP\" ./configure $OPTIONS"
263 CFLAGS="$CFLAGS -belf -DANSICPP"
265 perform ./configure $OPTIONS
266 else
267 echo "CFLAGS=\"$CFLAGS $GCCFLAGS\" ./configure $OPTIONS"
269 CFLAGS="$CFLAGS $GCCFLAGS"
271 perform ./configure $OPTIONS
275 #################### Compile
276 echo "-------------------------"
277 echo "Compiling Window Maker..."
278 echo "-------------------------"
279 (cd src; perform make $MAKE_OPTIONS clean)
280 perform make $MAKE_OPTIONS
282 echo "--------------------------"
283 echo "Installing Window Maker..."
284 echo "--------------------------"
286 perform make $MAKE_OPTIONS $INSTALL
288 if [ `uname -s` = "Linux" ]; then
289 echo
290 echo " Make sure $PREFIX/lib is in the /etc/ld.so.conf file"
291 /sbin/ldconfig
294 echo
295 echo "Installation Finished!"
296 echo
297 echo "Now, each user that wishes to use WindowMaker must run the wmaker.inst"
298 echo "script that was just installed."
301 if test "$NLS" = "Y"; then
302 echo "Don't forget to set the LANG environment variable to your locale"