2 # WINE Installation script
3 # Can do almost everything from compiling to configuring...
5 # Mar 31 1999 - Ove Kåven
7 # Dec 9 1999 - Ove Kåven
9 # Feb 25 2000 - Ove Kåven
10 # auto-add /usr/local/lib to /etc/ld.so.conf
11 # Mar 2 2000 - Ove Kåven
12 # source rather than grep config.cache
13 # use sourced config.cache to start ldconfig
14 # reconfigure if config.cache doesn't exist
15 # Mar 30 2000 - Ove Kåven
16 # autoconfigure no-windows installs
17 # do not install registry on real-windows installs
18 # some support for binary package installs
19 # set and tell user about LD_LIBRARY_PATH if necessary
20 # set EXTRA_LD_LIBRARY_PATH in wine.conf
21 # Apr 9 2000 - Ove Kåven
22 # make root's registry global (system-default)
23 # May 9 2000 - Ove Kåven
24 # use ttydrv when running regapi, so we don't have to run from X
25 # change debugger path in registry
26 # Oct 29 2000 - Ove Kåven
27 # added --enable-opengl to default confargs
28 # added conf_question, conf_yesno_answer, and conf_string_answer functions
29 # added DEFCAT variable
31 #--- defaults (change these if you are a packager)
32 CONFARGS=--enable-opengl # configure args, e.g. --prefix=/usr --sysconfdir=/etc
33 prefix=/usr/local # installation prefix
34 sysconfdir=$prefix/etc # where wine.conf and global registry is supposed to be
35 bindir=$prefix/bin # where winelib apps will be (or is) installed
36 libdir=$prefix/lib # where libwine.so will be (or is) installed
37 exdir=documentation/samples # where the example system.ini resides
38 CONF=$sysconfdir/wine.conf # default path of the wine.conf
39 BINDIST=no # whether called from a binary package config script
40 DOCONF=auto # whether to autogenerate wine.conf
41 DOWCHK=auto # whether to autoconfigure existing-windows installation
42 DOWINE=auto # whether to autoconfigure no-windows installation
43 DOREG=auto # whether to install default registry
44 SYSREG=yes # whether to make root's registry global (system-default)
46 # "make install" still installs the dlls into $libdir, but this may change in the future
47 # (DLLPATH should point to them if/when they are not in standard ld.so paths)
48 DLLPATH=$libdir/wine # default path of the dll .so files (except libwine.so)
50 # having the Wine debugger launched automatically will be a plus for us
51 DEBUGGER=$bindir/winedbg # the (installed) path of winedbg
52 HDEBUGGER=debugger/winedbg # the (non-installed) path of winedbg
54 # this is only for existing-windows installs
55 WINECONF=tools/wineconf # the path of wineconf perl script
57 # this is only for no-windows installs
58 WINEINI=wine.ini # the path of default wine.ini (also used by wineconf)
59 WININI=/dev/null # the path of default win.ini
60 SYSTEMINI=$exdir/system.ini # the path of default system.ini
61 REGAPI=programs/regapi/regapi # the path of regapi winelib application
62 DEFREG=winedefault.reg # the path of the registry file to be fed to regapi
63 # CROOT=/var/wine # the path of the fake Drive C (asks user if not set)
64 DEFCAT=cat # program to cat $DEFREG with (some packages need zcat)
67 # temporary files used by the installer
68 TMPCONF=/tmp/wineinstall.conf
69 TMPREG=/tmp/wineinstall.reg
73 function conf_question {
74 # parameters: $1 = importance, $2 = question-id, $3+ = message lines
75 # the first two parameters can be used by e.g. debconf in debian packages
76 # but here we just print the message
88 function conf_yesno_answer {
90 while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
98 function conf_string_answer {
105 echo "WINE Installer v0.5"
108 if [ "$BINDIST" = 'no' ]
111 if ! [ -f configure ]
113 echo "You're running this from the wrong directory."
114 echo "Change to the Wine directory and try again."
119 # check whether RPM installed, and if it is, remove any old wine rpm.
122 if [ $RET -eq 0 ]; then
123 if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
124 echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
125 conf_yesno_answer "(yes/no) "
126 if [ "$ANSWER" = 'yes' ]; then
127 echo Starting wine rpm removal...
129 if [ $RET -eq 0 ]; then
132 echo "FAILED. Probably you aren't installing as root."
135 echo "Sorry, I won't install Wine when an rpm version is still installed."
136 echo "(Wine support suffered from way too many conflicts)"
137 echo "Have a nice day !"
143 # run the configure script, if necessary
145 if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
147 echo "I see that WINE has already been configured, so I'll skip that."
148 # load configure results
152 echo "Running configure..."
154 if ! ./configure $CONFARGS
157 echo "Configure failed, aborting install."
162 # load configure results
164 # make sure X was found
166 if [ "$have_x" != "yes" ]
168 echo "Install the X development headers and try again."
172 elif [ "$ac_cv_header_X11_xpm_h" != "yes" ]
174 echo "Install the Xpm development headers and try again."
182 # now do the compilation
184 if [ -f wine ] && [ wine -nt Makefile ]
186 echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
189 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever, in the meantime..."
191 if ! { make depend && make; }
194 echo "Compilation failed, aborting install."
202 # and installation, if root
204 if [ `whoami` != 'root' ]
206 echo "You aren't root, so I'll skip the make install."
207 # setup to run from current directory
209 if [ -z "$LD_LIBRARY_PATH" ]
210 then LD_LIBRARY_PATH="$PWD:$DLLPATH"
211 else LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD:$DLLPATH"
213 export LD_LIBRARY_PATH
214 DEBUGGER="$PWD/$HDEBUGGER"
216 echo "NOTE! To run Wine without installing, you must set the environment variable"
217 echo "LD_LIBRARY_PATH to $PWD:$DLLPATH"
218 echo "in your logon scripts."
221 echo "Now installing binaries onto the system..."
226 echo "Installation failed, aborting."
230 if [ -f /etc/ld.so.conf ] && ! grep -qs "$libdir" /etc/ld.so.conf
233 echo "$libdir didn't exist in your /etc/ld.so.conf, adding it now..."
234 echo "$libdir" >>/etc/ld.so.conf
235 echo "Re-running ldconfig..."
236 eval "$ac_cv_path_LDCONFIG"
245 # now check whether we should generate wine.conf
250 if [ "$DOCONF" = 'auto' ]
252 # see if we already have a system wine.conf
259 if [ "$DOCONF" != 'no' ]
261 if [ `whoami` != 'root' ]
266 if [ "$DOCONF" != 'yes' ]
268 conf_question medium make_user_winerc \
269 "Since you aren't root, and there's no system wine.conf, I assume" \
270 "you want a user-specific .winerc. Am I correct?"
271 conf_yesno_answer "(yes/no) "
275 if [ "$DOCONF" = 'no' ]
277 conf_question high need_root \
278 "Aborting install. Try again as root to generate a system wine.conf."
294 # generate wine.conf from existing windows install, if any
295 if [ "$DOCONF" = 'yes' ]
297 if [ "$DOWCHK" = 'yes' ] || [ "$DOWCHK" = 'auto' ]
300 echo -n "Searching for an existing Windows installation..."
301 if ! $WINECONF > $CONF 2>/dev/null
305 conf_question low do_without_windows \
306 "Windows was not found on your system, so I assume you want a Wine-only installation." \
308 conf_yesno_answer "(yes/no) "
309 if [ "$ANSWER" = 'no' ]
311 conf_question high windows_not_found \
312 "Aborting install. Make sure your Windows partition is mounted and try again," \
313 "or create $CONF manually by copying from $WINEINI and adapting the drive paths."
321 conf_question low windows_found \
322 "Created $CONF using your existing Windows installation." \
323 "You probably want to review the file, though."
328 elif [ "$DOWINE" = 'auto' ]
332 elif [ "$DOWINE" = 'auto' ]
336 # setup a no-windows installation, if necessary
337 if [ "$DOWINE" = 'yes' ]
339 if [ `whoami` != 'root' ]
343 conf_question low drivec_path \
344 "Configuring Wine without Windows. Some fake Windows directories must be created, to" \
345 "hold any .ini files, DLLs, and start menu entries your applications may need to install."
346 while [ -z "$CROOT" ]
348 conf_string_answer "Where would you like your fake C drive to be placed? (default is $DCROOT)"
352 if ! [ -d "$ANSWER" ]
354 if mkdir -p "$ANSWER"
361 echo "Configuring Wine for a no-windows install in $CROOT..."
362 for tdir in "$CROOT/windows" "$CROOT/windows/system" "$CROOT/windows/Start Menu" "$CROOT/windows/Start Menu/Programs" "$CROOT/Common Files" "$CROOT/windows/Profiles/Administrator" "$CROOT/Program Files"
363 do [ -d "$tdir" ] || mkdir "$tdir"
365 [ -f "$CROOT/windows/win.ini" ] || cp "$WININI" "$CROOT/windows/win.ini"
366 [ -f "$CROOT/windows/system.ini" ] || cp "$SYSTEMINI" "$CROOT/windows/system.ini"
367 if [ "$DOCONF" = 'yes' ]
369 sed "s|Path=/c\$|Path=${CROOT}|" $WINEINI > $CONF
370 conf_question low default_config \
371 "Created $CONF using default Wine configuration." \
372 "You probably want to review the file, though."
375 # now we really should install the registry
376 if [ "$DOREG" = 'auto' ]
383 echo "Reading current Wine configuration from $CONF..."
384 CROOT=`sed -n '/^\[Drive C\]$/,/^\[.*\]$/ s/^Path=\(.*\)/\1/p' $CONF`
385 echo "Drive C is configured at $CROOT."
390 # fixup EXTRA_LD_LIBRARY_PATH
391 if [ "$DOCONF" = 'yes' ]
393 echo "Setting EXTRA_LD_LIBRARY_PATH in .winerc to $DLLPATH..."
394 sed "s|EXTRA_LD_LIBRARY_PATH=.*|EXTRA_LD_LIBRARY_PATH=${DLLPATH}|" $CONF > $CONF.new
395 mv -f $CONF.new $CONF
400 # check whether we need to install default registry
401 # (not to be done if windows registry exists)
402 if [ "$DOREG" = 'auto' ]
404 echo "Checking for real Windows registry..."
405 if [ -f "$CROOT/windows/system.dat" ]
407 elif [ -f "$CROOT/windows/system32/config/system" ]
411 if [ "$DOREG" = 'yes' ]
412 then echo "Not found, default Wine registry will be installed."
413 else echo "Windows registry found, will not install default Wine registry."
419 # install default registry entries
420 if [ "$DOREG" = 'yes' ]
422 if [ "$BINDIST" = 'no' ]
424 echo "Compiling regapi..."
426 (cd programs/regapi; make)
430 echo "Preparing to install default Wine registry entries..."
432 # create a temporary wineinstall.conf file using ttydrv,
433 # so that we don't have to run regapi under X
434 sed "s/GraphicsDriver=.*/GraphicsDriver=ttydrv/" $CONF > $TMPCONF
436 # create a temporary wineinstall.reg with fixed debugger path
437 $DEFCAT $DEFREG | sed "s|debugger/winedbg|${DEBUGGER}|" > $TMPREG
439 echo "Installing default Wine registry entries..."
441 if ! $REGAPI --config $TMPCONF setValue < $TMPREG > /dev/null
443 rm -f $TMPCONF $TMPREG
444 echo "Registry install failed."
445 conf_question high regapi_error
448 else echo "Registry entries successfully installed."
450 rm -f $TMPCONF $TMPREG
451 if [ "$SYSREG" = 'auto' ]
457 # make root's registry global, if desired
458 if [ `whoami` = 'root' ] && [ "$SYSREG" = 'yes' ]
460 [ -d ~/.wine ] || mkdir ~/.wine
461 if ! [ -f $sysconfdir/wine.userreg ]
463 echo "Linking root's user registry hive to the global registry..."
464 cp ~/.wine/wine.userreg $sysconfdir/wine.userreg
465 ln -sf $sysconfdir/wine.userreg ~/.wine/wine.userreg
468 if ! [ -f $sysconfdir/wine.systemreg ]
470 echo "Linking root's system registry hive to the global registry..."
471 cp ~/.wine/system.reg $sysconfdir/wine.systemreg
472 ln -sf $sysconfdir/wine.systemreg ~/.wine/system.reg
480 echo "Installation complete for now. Good luck (this is still alpha software)."
481 echo "If you have problems with WINE, please read the documentation first,"
482 echo "as many kinds of potential problems are explained there."