widl: Modify generic_msg() to behave like all the other Wine tracing methods, that...
[wine/wine-jacek.git] / tools / wineinstall
blob6602477c65884b207c8dc26500ce08b9282e4766
1 #!/bin/bash
2 # WINE Installation script
3 # Can do almost everything from compiling to configuring...
5 # Copyright 1999 Ove Kåven
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #--- defaults (change these if you are a packager)
23 CONFARGS="" # configure args, e.g. --prefix=/usr
24 prefix=/usr/local # installation prefix
25 bindir=$prefix/bin # where winelib apps will be (or are) installed
26 libdir=$prefix/lib # where libwine.so will be (or is) installed
27 BINDIST=no # whether called from a binary package config script
29 # functions
31 function std_sleep {
32 sleep 1
35 function conf_question {
36 # parameters: $1 = importance, $2 = question-id, $3+ = message lines
37 # the first two parameters can be used by e.g. debconf in debian packages
38 # but here we just print the message
39 shift 2
40 echo
41 local LINE="$1"
42 while [ $# -gt 0 ] && shift
43 do {
44 echo "$LINE"
45 LINE="$1"
47 done
50 function conf_reset_question {
51 # parameters: $1 = question-id
52 # this is used to flush any cached answers and "already-displayed" flags
53 shift # dummy command
56 function conf_yesno_answer {
57 unset ANSWER
58 while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
59 do {
60 echo -n "$1"
61 read ANSWER
63 done
66 function conf_string_answer {
67 echo -n "$1"
68 read ANSWER
71 # startup...
73 echo "WINE Installer v0.75"
74 echo
76 if [ "$BINDIST" = 'no' ]
77 then {
79 if ! [ -f configure ]
80 then {
81 if [ -f ../configure ]
82 then {
83 pushd ..
85 else {
86 echo "You're running this from the wrong directory."
87 echo "Change to the Wine source's main directory and try again."
88 exit 1
94 if [ `whoami` = 'root' ]
95 then {
96 echo "You are running wineinstall as root, this is not advisable. Please rerun as a user."
97 echo "Aborting."
98 exit 1
102 if [ ! -w . ]
103 then {
104 echo "The source directory is not writable. You probably extracted the sources as root."
105 echo "You should remove the source tree and extract it again as a normal user."
106 exit 1
110 # check whether RPM installed, and if it is, remove any old wine rpm.
111 hash rpm &>/dev/null
112 RET=$?
113 if [ $RET -eq 0 ]; then
114 if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
115 echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
116 conf_yesno_answer "(yes/no) "
117 if [ "$ANSWER" = 'yes' ]; then
118 echo "We need to remove the rpm as root, please enter your root password"
119 echo
120 echo Starting wine rpm removal...
121 su -c "rpm -e wine; RET=$?"
122 if [ $RET -eq 0 ]; then
123 echo Done.
124 else
125 echo "FAILED. Probably you aren't installing as root."
126 echo "Expect problems (library conflicts with existing install etc.)."
128 else
129 echo "Sorry, I won't install Wine when an rpm version is still installed."
130 echo "(Wine support suffered from way too many conflicts between RPM"
131 echo "and source installs)"
132 echo "Have a nice day !"
133 exit 1
138 # check whether wine binary still available
139 if [ -n "`wine --version 2>/dev/null`" ]
140 then
141 echo "Warning !! wine binary (still) found, which may indicate"
142 echo "a (conflicting) previous installation."
143 echo "You might want to abort and uninstall Wine first."
144 echo "(If you previously tried to install from source manually, "
145 echo "run 'make uninstall' from the wine root directory)"
146 std_sleep
149 # run the configure script, if necessary
151 if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
152 then {
153 echo
154 echo "I see that WINE has already been configured, so I'll skip that."
155 std_sleep
156 # load configure results
157 . ./config.cache
159 else {
160 echo "Running configure..."
161 echo
162 if ! ./configure -C $CONFARGS --prefix=$prefix
163 then {
164 echo
165 echo "Configure failed, aborting install."
166 rm -f config.cache
167 exit 1
170 # load configure results
171 . ./config.cache
172 # make sure X was found
173 eval "$ac_cv_have_x"
174 if [ "$have_x" != "yes" ]
175 then {
176 echo "Install the X development headers and try again."
177 rm -f config.cache
178 exit 1
184 # now do the compilation and install, we need to always do this because we
185 # don't want the 'make install' command we might run to run 'make' as root
186 if [ `whoami` != 'root' ]
187 then {
188 # ask the user if they want to build and install wine
189 echo
190 echo "We need to install wine as root user, do you want us to build wine,"
191 echo "'su root' and install Wine? Enter 'no' to continue without installing"
192 conf_yesno_answer "(yes/no) "
193 ROOTINSTALL="$ANSWER"
195 if [ "$ROOTINSTALL" = "yes" ]
196 then {
197 # start out with the basic command
198 sucommand="make install"
200 # if the user doesn't have $libdir in their ld.so.conf add this
201 # to our sucommand string
202 if [ -f /etc/ld.so.conf ]
203 then
204 if ! grep -s "$libdir" /etc/ld.so.conf >/dev/null 2>&1
205 then {
206 echo
207 echo "$libdir doesn't exist in your /etc/ld.so.conf, it will be added"
208 echo "when we perform the install..."
209 sucommand="$sucommand;echo $libdir>>/etc/ld.so.conf"
212 # run ldconfig always just in case some updated files don't get linked
213 sucommand="$sucommand;$ac_cv_path_LDCONFIG"
216 fi # [ "$ROOTINSTALL" = "yes" ]
218 echo
220 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
221 echo "in the meantime..."
222 echo
223 std_sleep
225 # try to just make wine, if this fails 'make depend' and try to remake
226 if ! { make; }
227 then {
228 if ! { make depend && make; }
229 then {
230 echo
231 echo "Compilation failed, aborting install."
232 exit 1
238 if [ "$ROOTINSTALL" = "yes" ]
239 then {
240 echo
242 echo "Performing 'make install' as root to install binaries, enter root password"
244 std_sleep
246 if ! su root -c "$sucommand"
247 then {
248 echo
249 echo "Incorrect root password. If you are running Ubuntu or a similar distribution,"
250 echo "'make install' needs to be run via the sudo wrapper, so trying that one now"
251 if ! sudo su root -c "$sucommand"
252 then {
253 echo
254 echo "Either you entered an incorrect password or we failed to"
255 echo "run '$sucommand' correctly."
256 echo "If you didn't enter an incorrect password then please"
257 echo "report this error and any steps to possibly reproduce it to"
258 echo "http://bugs.winehq.org/"
259 echo
260 echo "Installation failed, aborting."
261 exit 1
267 echo
269 # see if wine is installed on the users system, if not prompt them
270 # and then exit
271 if [ -z "`wine --version 2>/dev/null`" ]
272 then
273 echo "Could not find wine on your system. Run wineinstall as root to install wine"
274 echo "before re-running wineinstall as a user."
275 echo
276 echo "Exiting wineinstall"
277 exit 1;
280 WINEINSTALLED=yes
282 else {
283 WINEINSTALLED=no
285 fi # [ "$ROOTINSTALL" = "yes" ]
287 fi # [ `whoami` != 'root' ]
290 fi # BINDIST
292 if [ "$WINEINSTALLED" = 'no' ]
293 then
294 tools/wineprefixcreate --use-wine-tree .
295 else
296 wineprefixcreate
298 echo
301 # it's a wrap
302 echo
303 echo "Installation complete for now. Good luck (this is still beta software)."
304 echo "If you have problems with WINE, please read the documentation first,"
305 echo "as many kinds of potential problems are explained there."
307 exit 0