2 # WINE Installation script
4 # Mar 31 1999 - Ove Kåven
6 # Dec 9 1999 - Ove Kåven
8 # Feb 25 2000 - Ove Kåven
9 # auto-add /usr/local/lib to /etc/ld.so.conf
10 # 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
14 # Mar 30 2000 - Ove Kåven
15 # autoconfigure no-windows installs
16 # do not install registry on real-windows installs
17 # some support for binary package installs
18 # set and tell user about LD_LIBRARY_PATH if necessary
19 # set EXTRA_LD_LIBRARY_PATH in wine.conf
20 # Apr 9 2000 - Ove Kåven
21 # make root's registry global (system-default)
22 # May 9 2000 - Ove Kåven
23 # use ttydrv when running regapi, so we don't have to run from X
24 # change debugger path in registry
26 #--- defaults (change these if you are a packager)
27 CONFARGS= # configure args, e.g. --prefix=/usr --sysconfdir=/etc
28 prefix=/usr/local # installation prefix
29 sysconfdir=$prefix/etc # where wine.conf and global registry is supposed to be
30 bindir=$prefix/bin # where winelib apps will be (or is) installed
31 libdir=$prefix/lib # where libwine.so will be (or is) installed
32 exdir=documentation/samples # where the example system.ini resides
33 CONF=$sysconfdir/wine.conf # default path of the wine.conf
34 BINDIST=no # whether called from a binary package config script
35 DOCONF=auto # whether to autogenerate wine.conf
36 DOWCHK=auto # whether to autoconfigure existing-windows installation
37 DOWINE=auto # whether to autoconfigure no-windows installation
38 DOREG=auto # whether to install default registry
39 SYSREG=yes # whether to make root's registry global (system-default)
41 # "make install" still installs the dlls into $libdir, but this may change in the future
42 # (DLLPATH should point to them if/when they are not in standard ld.so paths)
43 DLLPATH=$libdir/wine # default path of the dll .so files (except libwine.so)
45 # having the Wine debugger launched automatically will be a plus for us
46 DEBUGGER=$bindir/winedbg # the (installed) path of winedbg
47 HDEBUGGER=debugger/winedbg # the (non-installed) path of winedbg
49 # this is only for existing-windows installs
50 WINECONF=tools/wineconf # the path of wineconf perl script
52 # this is only for no-windows installs
53 WINEINI=wine.ini # the path of default wine.ini (also used by wineconf)
54 WININI=/dev/null # the path of default win.ini
55 SYSTEMINI=$exdir/system.ini # the path of default system.ini
56 REGAPI=programs/regapi/regapi # the path of regapi winelib application
57 DEFREG=winedefault.reg # the path of the registry file to be fed to regapi
58 # CROOT=/var/wine # the path of the fake Drive C (asks user if not set)
61 # temporary files used by the installer
62 TMPCONF=/tmp/wineinstall.conf
63 TMPREG=/tmp/wineinstall.reg
67 echo "WINE Installer v0.4"
70 if [ "$BINDIST" = 'no' ]
75 echo "You're running this from the wrong directory."
76 echo "Change to the Wine directory and try again."
81 # run the configure script, if necessary
83 if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
85 echo "I see that WINE has already been configured, so I'll skip that."
86 # load configure results
90 echo "Running configure..."
92 if ! ./configure $CONFARGS
95 echo "Configure failed, aborting install."
100 # load configure results
102 # make sure X was found
104 if [ "$have_x" != "yes" ]
106 echo "Install the X development headers and try again."
110 elif [ "$ac_cv_header_X11_xpm_h" != "yes" ]
112 echo "Install the Xpm development headers and try again."
120 # now do the compilation
122 if [ -f wine ] && [ wine -nt Makefile ]
124 echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
127 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever, in the meantime..."
129 if ! { make depend && make; }
132 echo "Compilation failed, aborting install."
140 # and installation, if root
142 if [ `whoami` != 'root' ]
144 echo "You aren't root, so I'll skip the make install."
145 # setup to run from current directory
147 if [ -z "$LD_LIBRARY_PATH" ]
148 then LD_LIBRARY_PATH="$PWD:$DLLPATH"
149 else LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD:$DLLPATH"
151 export LD_LIBRARY_PATH
152 DEBUGGER=$PWD/$HDEBUGGER
154 echo "NOTE! To run Wine without installing, you must set the environment variable"
155 echo "LD_LIBRARY_PATH to $PWD:$DLLPATH"
156 echo "in your logon scripts."
159 echo "Now installing binaries onto the system..."
164 echo "Installation failed, aborting."
168 if [ -f /etc/ld.so.conf ] && ! grep -qs "$libdir" /etc/ld.so.conf
171 echo "$libdir didn't exist in your /etc/ld.so.conf, adding it now..."
172 echo "$libdir" >>/etc/ld.so.conf
173 echo "Re-running ldconfig..."
174 eval "$ac_cv_path_LDCONFIG"
184 # now check whether we should generate wine.conf
189 if [ "$DOCONF" = 'auto' ]
191 # see if we already have a system wine.conf
198 if [ "$DOCONF" != 'no' ]
200 if [ `whoami` != 'root' ]
205 if [ "$DOCONF" != 'yes' ]
207 echo "Since you aren't root, and there's no system wine.conf, I assume"
208 echo "you want a user-specific .winerc. Am I correct? (yes/no)"
209 while [ "$DOCONF" != 'yes' ] && [ "$DOCONF" != 'no' ]
214 if [ "$DOCONF" = 'no' ]
216 echo "Aborting install. Try again as root to generate a system wine.conf."
232 # generate wine.conf from existing windows install, if any
233 if [ "$DOCONF" = 'yes' ]
235 if [ "$DOWCHK" = 'yes' ] || [ "$DOWCHK" = 'auto' ]
237 echo "Searching for an existing Windows installation..."
238 if ! $WINECONF > $CONF 2>/dev/null
242 echo "Windows was not found on your system, so I assume you want a Wine-only installation."
243 echo "Am I correct? (yes/no)"
244 while [ "$DOWINE" != 'yes' ] && [ "$DOWINE" != 'no' ]
247 if [ "$DOWINE" = 'no' ]
249 echo "Aborting install. Make sure your Windows partition is mounted and try again,"
250 echo "or create $CONF manually by copying from $WINEINI and adapting the drive paths."
257 echo "Created $CONF using your existing Windows installation."
258 echo "You probably want to review the file, though."
264 elif [ "$DOWINE" = 'auto' ]
268 elif [ "$DOWINE" = 'auto' ]
272 # setup a no-windows installation, if necessary
273 if [ "$DOWINE" = 'yes' ]
275 if [ `whoami` != 'root' ]
279 echo "Configuring Wine without Windows. Some fake Windows directories must be created, to"
280 echo "hold any .ini files, DLLs, and start menu entries your applications may need to install."
281 while [ -z "$CROOT" ]
283 echo "Where would you like your fake C drive to be placed? (default is $DCROOT)"
290 if ! mkdir -p "$CROOT"
297 echo "Configuring Wine for a no-windows install in $CROOT..."
298 for tdir in "$CROOT/windows" "$CROOT/windows/system" "$CROOT/windows/Start Menu" "$CROOT/windows/Start Menu/Programs"
299 do [ -d "$tdir" ] || mkdir "$tdir"
301 [ -f "$CROOT/windows/win.ini" ] || cp "$WININI" "$CROOT/windows/win.ini"
302 [ -f "$CROOT/windows/system.ini" ] || cp "$SYSTEMINI" "$CROOT/windows/system.ini"
303 if [ "$DOCONF" = 'yes' ]
305 sed "s/Path=\/c$/Path=${CROOT//\//\\/}/" $WINEINI > $CONF
306 echo "Created $CONF using default Wine configuration."
307 echo "You probably want to review the file, though."
310 # now we really need to install the registry
315 echo "Reading current Wine configuration from $CONF..."
316 CROOT=`sed -n '/^\[Drive C\]$/,/^\[.*\]$/ s/^Path=\(.*\)/\1/p' $CONF`
317 echo "Drive C is configured at $CROOT."
322 # fixup EXTRA_LD_LIBRARY_PATH
323 if [ "$DOCONF" = 'yes' ]
325 echo "Setting EXTRA_LD_LIBRARY_PATH in .winerc to $DLLPATH..."
326 sed "s/EXTRA_LD_LIBRARY_PATH=.*/EXTRA_LD_LIBRARY_PATH=${DLLPATH//\//\\/}/" $CONF > $CONF.new
327 mv -f $CONF.new $CONF
332 # check whether we need to install default registry
333 # (not to be done if windows registry exists)
334 if [ "$DOREG" = 'auto' ]
336 echo "Checking for real Windows registry..."
337 if [ -f "$CROOT/windows/system.dat" ]
339 elif [ -f "$CROOT/windows/system32/config/system" ]
343 if [ "$DOREG" = 'yes' ]
344 then echo "Not found, default Wine registry will be installed."
345 else echo "Windows registry found, will not install default Wine registry."
351 # install default registry entries
352 if [ "$DOREG" = 'yes' ]
354 if [ "$BINDIST" = 'no' ]
356 echo "Compiling regapi..."
358 (cd programs/regapi; make)
362 echo "Preparing to install default Wine registry entries..."
364 # create a temporary wineinstall.conf file using ttydrv,
365 # so that we don't have to run regapi under X
366 sed "s/GraphicsDriver=.*/GraphicsDriver=ttydrv/" $CONF > $TMPCONF
368 # create a temporary wineinstall.reg with fixed debugger path
369 sed "s/debugger\/winedbg/${DEBUGGER//\//\\/}/" $DEFREG > $TMPREG
371 echo "Installing default Wine registry entries..."
373 if ! $REGAPI --config $TMPCONF setValue < $TMPREG > /dev/null
375 rm -f $TMPCONF $TMPREG
377 echo "Registry install failed."
380 else echo "Registry entries successfully installed."
382 rm -f $TMPCONF $TMPREG
383 if [ "$SYSREG" = 'auto' ]
389 # make root's registry global, if desired
390 if [ `whoami` = 'root' ] && [ "$SYSREG" = 'yes' ]
392 if ! [ -f $sysconfdir/wine.userreg ]
394 echo "Linking root's user registry hive to the global registry..."
395 cp ~/.wine/wine.userreg $sysconfdir/wine.userreg
396 ln -sf $sysconfdir/wine.userreg ~/.wine/wine.userreg
399 if ! [ -f $sysconfdir/wine.systemreg ]
401 echo "Linking root's system registry hive to the global registry..."
402 cp ~/.wine/system.reg $sysconfdir/wine.systemreg
403 ln -sf $sysconfdir/wine.systemreg ~/.wine/system.reg
411 echo "Installation complete for now. Good luck (this is still alpha software)."
412 echo "If you have problems with WINE, please read the documentation first,"
413 echo "as many kinds of potential problems are explained there."