blob: b2760c77faa6fc4c6fa2e3572570fbdac121ce87 [file] [log] [blame]
Ove Kaaven2043ba01999-04-18 13:16:29 +00001#!/bin/bash
2# WINE Installation script
3
4# Mar 31 1999 - Ove Kåven
5# First version
Ove Kaavenb822b842000-02-25 20:51:09 +00006# Dec 9 1999 - Ove Kåven
7# require Xpm
8# Feb 25 2000 - Ove Kåven
9# auto-add /usr/local/lib to /etc/ld.so.conf
Ove Kaavence2b7242000-03-04 19:13:52 +000010# Mar 2 2000 - Ove Kåven
11# source rather than grep config.cache
12# use sourced config.cache to start ldconfig
13# reconfigure if config.cache doesn't exist
Ove Kaaven2043ba01999-04-18 13:16:29 +000014
15# defaults
16
17sysconfdir=/usr/local/etc
18DOCONF=auto
19DOREG=yes
20
21# startup...
22
Ove Kaavenb822b842000-02-25 20:51:09 +000023echo "WINE Installer v0.2"
Ove Kaaven2043ba01999-04-18 13:16:29 +000024echo
25if ! [ -f configure ]
26then {
27 echo "You're running this from the wrong directory."
28 echo "Change to the Wine directory and try again."
29 exit 1
30}
31fi
32
33# run the configure script, if necessary
34
Ove Kaavence2b7242000-03-04 19:13:52 +000035if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
Ove Kaaven2043ba01999-04-18 13:16:29 +000036then {
37 echo "I see that WINE has already been configured, so I'll skip that."
Ove Kaavence2b7242000-03-04 19:13:52 +000038 # load configure results
39 . ./config.cache
Ove Kaaven2043ba01999-04-18 13:16:29 +000040}
41else {
42 # we'll run with defaults (we need libwine.a later)
43 echo "Running configure..."
44 echo
45 if ! ./configure
46 then {
47 echo
48 echo "Configure failed, aborting install."
49 rm -f config.cache
50 exit 1
51 }
52 fi
Ove Kaavence2b7242000-03-04 19:13:52 +000053 # load configure results
54 . ./config.cache
Ove Kaaven2043ba01999-04-18 13:16:29 +000055 # make sure X was found
Ove Kaavence2b7242000-03-04 19:13:52 +000056 eval "$ac_cv_have_x"
57 if [ "$have_x" != "yes" ]
Ove Kaaven2043ba01999-04-18 13:16:29 +000058 then {
59 echo "Install the X development headers and try again."
60 rm -f config.cache
61 exit 1
62 }
Ove Kaavence2b7242000-03-04 19:13:52 +000063 elif [ "$ac_cv_header_X11_xpm_h" != "yes" ]
Ove Kaavenb822b842000-02-25 20:51:09 +000064 then {
65 echo "Install the Xpm development headers and try again."
66 rm -f config.cache
67 exit 1
68 }
Ove Kaaven2043ba01999-04-18 13:16:29 +000069 fi
70}
71fi
72
73# now do the compilation
74
75if [ -f wine ] && [ wine -nt Makefile ]
76then {
77 echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
78}
79else {
80 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever, in the meantime..."
81 echo
82 if ! { make depend && make; }
83 then {
84 echo
85 echo "Compilation failed, aborting install."
86 exit 1
87 }
88 fi
89 echo
90}
91fi
92
93# and installation, if root
94
95if [ `whoami` != 'root' ]
96then {
97 echo "You aren't root, so I'll skip the make install."
98}
99else {
100 echo "Now installing binaries onto the system..."
101 echo
102 if ! make install
103 then {
104 echo
105 echo "Installation failed, aborting."
106 exit 1
107 }
108 fi
Ove Kaavenb822b842000-02-25 20:51:09 +0000109 if [ -f /etc/ld.so.conf ] && ! grep -qs "/usr/local/lib" /etc/ld.so.conf
110 then {
111 echo
112 echo "/usr/local/lib didn't exist in your /etc/ld.so.conf, adding it now..."
113 echo /usr/local/lib >>/etc/ld.so.conf
114 echo "Re-running ldconfig..."
Ove Kaavence2b7242000-03-04 19:13:52 +0000115 eval "$ac_cv_path_LDCONFIG"
Ove Kaavenb822b842000-02-25 20:51:09 +0000116 }
117 fi
Ove Kaaven2043ba01999-04-18 13:16:29 +0000118}
119fi
120echo
121
122# now check whether we should generate wine.conf
123if [ -z "$DOCONF" ]
124then DOCONF=auto
125fi
126
127if [ "$DOCONF" = 'auto' ]
128then {
129 # see if we already have a system wine.conf
130 if [ -f $sysconfdir/wine.conf ] || [ -f /etc/wine.conf ]
131 then DOCONF=no
132 fi
133}
134fi
135
136if [ "$DOCONF" != 'no' ]
137then {
138 if [ `whoami` != 'root' ]
139 then {
140 CONF=~/.winerc
141 if ! [ -f $CONF ]
142 then {
143 if [ "$DOCONF" != 'yes' ]
144 then {
145 echo "Since you aren't root, and there's no system wine.conf, I assume"
146 echo "you want a user-specific .winerc. Am I correct? (yes/no)"
147 while [ "$DOCONF" != 'yes' ] && [ "$DOCONF" != 'no' ]
148 do read DOCONF
149 done
150 }
151 fi
152 if [ "$DOCONF" = 'no' ]
153 then echo "Skipping generation of .winerc."
154 fi
155 }
156 fi
157 }
158 else {
159 CONF=$sysconfdir/wine.conf
Joerg Mayerd178fb01999-08-04 14:26:08 +0000160 mkdir -p $sysconfdir
Ove Kaaven2043ba01999-04-18 13:16:29 +0000161 DOCONF=yes
162 }
163 fi
164}
165fi
166
167if [ "$DOCONF" = 'yes' ]
168then {
169 echo "Now automatically generating $CONF for you..."
170 echo
171 tools/wineconf > $CONF
172 echo
173 echo "Done. You probably want to review the file, though."
174}
175fi
176echo
177
178# install default registry entries
179if [ "$DOREG" = 'yes' ]
180then {
181 echo "Compiling regapi..."
182 echo
183 (cd programs/regapi; make)
184 echo
185 echo "Installing default registry entries, please wait..."
186 echo
187 if ! programs/regapi/regapi setValue < winedefault.reg
188 then {
189 echo
190 echo "Registry install failed. Perhaps you weren't running X."
Ove Kaavenb822b842000-02-25 20:51:09 +0000191 exit 1
Ove Kaaven2043ba01999-04-18 13:16:29 +0000192 }
193 fi
Ove Kaavenb822b842000-02-25 20:51:09 +0000194 # FIXME: perhaps install registry to $sysconfdir/winesystem.reg and $sysconfdir/wineuser.reg?
Ove Kaaven2043ba01999-04-18 13:16:29 +0000195}
196fi
197echo
198echo "Installation complete for now. Good luck (this is still alpha software)."
199echo "If you have problems with WINE, please read the documentation first."