Added more conversion routines (rate conversion is implemented).
[wine.git] / tools / wineinstall
blobe71725d93993eb8fc815b6f9479953413dfbe2ff
1 #!/bin/bash
2 # WINE Installation script
4 # Mar 31 1999 - Ove Kåven
5 # First version
6 # 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
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)
59 #--- end of defaults
61 # temporary files used by the installer
62 TMPCONF=/tmp/wineinstall.conf
63 TMPREG=/tmp/wineinstall.reg
65 # startup...
67 echo "WINE Installer v0.4"
68 echo
70 if [ "$BINDIST" = 'no' ]
71 then {
73 if ! [ -f configure ]
74 then {
75 echo "You're running this from the wrong directory."
76 echo "Change to the Wine directory and try again."
77 exit 1
81 # check whether RPM installed, and if it is, remove any old wine rpm.
82 hash rpm; RET=$? &>/dev/null
83 if [ $RET -eq 0 ]; then
84 if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
85 echo "Warning: Old Wine RPM install detected. We want to get rid of it first."
86 echo -n "ok (Y/n) ? "
87 read DOWINE
88 if [ "$DOWINE" != 'n' -a "$DOWINE" != 'N' ]; then
89 echo Starting wine rpm removal...
90 rpm -e wine; RET=$?
91 if [ $RET -eq 0 ]; then
92 echo Done.
93 else
94 echo "FAILED. Probably you aren't installing as root."
96 else
97 echo "Sorry, I won't install Wine when an rpm version is still installed."
98 echo "(Wine support suffered from way too many conflicts)"
99 echo "Have a nice day !"
100 exit
105 # run the configure script, if necessary
107 if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
108 then {
109 echo "I see that WINE has already been configured, so I'll skip that."
110 # load configure results
111 . ./config.cache
113 else {
114 echo "Running configure..."
115 echo
116 if ! ./configure $CONFARGS
117 then {
118 echo
119 echo "Configure failed, aborting install."
120 rm -f config.cache
121 exit 1
124 # load configure results
125 . ./config.cache
126 # make sure X was found
127 eval "$ac_cv_have_x"
128 if [ "$have_x" != "yes" ]
129 then {
130 echo "Install the X development headers and try again."
131 rm -f config.cache
132 exit 1
134 elif [ "$ac_cv_header_X11_xpm_h" != "yes" ]
135 then {
136 echo "Install the Xpm development headers and try again."
137 rm -f config.cache
138 exit 1
144 # now do the compilation
146 if [ -f wine ] && [ wine -nt Makefile ]
147 then {
148 echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
150 else {
151 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever, in the meantime..."
152 echo
153 if ! { make depend && make; }
154 then {
155 echo
156 echo "Compilation failed, aborting install."
157 exit 1
160 echo
164 # and installation, if root
166 if [ `whoami` != 'root' ]
167 then {
168 echo "You aren't root, so I'll skip the make install."
169 # setup to run from current directory
170 DLLPATH="$PWD/dlls"
171 if [ -z "$LD_LIBRARY_PATH" ]
172 then LD_LIBRARY_PATH="$PWD:$DLLPATH"
173 else LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD:$DLLPATH"
175 export LD_LIBRARY_PATH
176 DEBUGGER="$PWD/$HDEBUGGER"
177 echo
178 echo "NOTE! To run Wine without installing, you must set the environment variable"
179 echo "LD_LIBRARY_PATH to $PWD:$DLLPATH"
180 echo "in your logon scripts."
182 else {
183 echo "Now installing binaries onto the system..."
184 echo
185 if ! make install
186 then {
187 echo
188 echo "Installation failed, aborting."
189 exit 1
192 if [ -f /etc/ld.so.conf ] && ! grep -qs "$libdir" /etc/ld.so.conf
193 then {
194 echo
195 echo "$libdir didn't exist in your /etc/ld.so.conf, adding it now..."
196 echo "$libdir" >>/etc/ld.so.conf
197 echo "Re-running ldconfig..."
198 eval "$ac_cv_path_LDCONFIG"
203 echo
206 fi # BINDIST
208 # now check whether we should generate wine.conf
209 if [ -z "$DOCONF" ]
210 then DOCONF=auto
213 if [ "$DOCONF" = 'auto' ]
214 then {
215 # see if we already have a system wine.conf
216 if [ -f $CONF ]
217 then DOCONF=no
222 if [ "$DOCONF" != 'no' ]
223 then {
224 if [ `whoami` != 'root' ]
225 then {
226 CONF=~/.winerc
227 if ! [ -f $CONF ]
228 then {
229 if [ "$DOCONF" != 'yes' ]
230 then {
231 echo "Since you aren't root, and there's no system wine.conf, I assume"
232 echo "you want a user-specific .winerc. Am I correct? (yes/no)"
233 while [ "$DOCONF" != 'yes' ] && [ "$DOCONF" != 'no' ]
234 do read DOCONF
235 done
238 if [ "$DOCONF" = 'no' ]
239 then {
240 echo "Aborting install. Try again as root to generate a system wine.conf."
241 exit 1
244 echo
248 else {
249 mkdir -p $sysconfdir
250 DOCONF=yes
256 # generate wine.conf from existing windows install, if any
257 if [ "$DOCONF" = 'yes' ]
258 then {
259 if [ "$DOWCHK" = 'yes' ] || [ "$DOWCHK" = 'auto' ]
260 then {
261 echo "Searching for an existing Windows installation..."
262 if ! $WINECONF > $CONF 2>/dev/null
263 then {
264 rm -f $CONF
265 echo
266 echo "Windows was not found on your system, so I assume you want a Wine-only installation."
267 echo "Am I correct? (yes/no)"
268 while [ "$DOWINE" != 'yes' ] && [ "$DOWINE" != 'no' ]
269 do read DOWINE
270 done
271 if [ "$DOWINE" = 'no' ]
272 then {
273 echo "Aborting install. Make sure your Windows partition is mounted and try again,"
274 echo "or create $CONF manually by copying from $WINEINI and adapting the drive paths."
275 exit 1
279 else {
280 echo
281 echo "Created $CONF using your existing Windows installation."
282 echo "You probably want to review the file, though."
283 DOWINE=no
286 echo
288 elif [ "$DOWINE" = 'auto' ]
289 then DOWINE=yes
292 elif [ "$DOWINE" = 'auto' ]
293 then DOWINE=no
296 # setup a no-windows installation, if necessary
297 if [ "$DOWINE" = 'yes' ]
298 then {
299 if [ `whoami` != 'root' ]
300 then DCROOT=~/c
301 else DCROOT=/c
303 echo "Configuring Wine without Windows. Some fake Windows directories must be created, to"
304 echo "hold any .ini files, DLLs, and start menu entries your applications may need to install."
305 while [ -z "$CROOT" ]
306 do {
307 echo "Where would you like your fake C drive to be placed? (default is $DCROOT)"
308 read CROOT
309 if [ -z "$CROOT" ]
310 then CROOT="$DCROOT"
312 if ! [ -d "$CROOT" ]
313 then {
314 if ! mkdir -p "$CROOT"
315 then unset CROOT
320 done
321 echo "Configuring Wine for a no-windows install in $CROOT..."
322 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"
323 do [ -d "$tdir" ] || mkdir "$tdir"
324 done
325 [ -f "$CROOT/windows/win.ini" ] || cp "$WININI" "$CROOT/windows/win.ini"
326 [ -f "$CROOT/windows/system.ini" ] || cp "$SYSTEMINI" "$CROOT/windows/system.ini"
327 if [ "$DOCONF" = 'yes' ]
328 then {
329 sed "s|Path=/c\$|Path=${CROOT}|" $WINEINI > $CONF
330 echo "Created $CONF using default Wine configuration."
331 echo "You probably want to review the file, though."
334 # now we really should install the registry
335 if [ "$DOREG" = 'auto' ]
336 then DOREG=yes
339 elif [ -z "$CROOT" ]
340 then {
341 echo "Reading current Wine configuration from $CONF..."
342 CROOT=`sed -n '/^\[Drive C\]$/,/^\[.*\]$/ s/^Path=\(.*\)/\1/p' $CONF`
343 echo "Drive C is configured at $CROOT."
346 echo
348 # fixup EXTRA_LD_LIBRARY_PATH
349 if [ "$DOCONF" = 'yes' ]
350 then {
351 echo "Setting EXTRA_LD_LIBRARY_PATH in .winerc to $DLLPATH..."
352 sed "s|EXTRA_LD_LIBRARY_PATH=.*|EXTRA_LD_LIBRARY_PATH=${DLLPATH}|" $CONF > $CONF.new
353 mv -f $CONF.new $CONF
354 echo
358 # check whether we need to install default registry
359 # (not to be done if windows registry exists)
360 if [ "$DOREG" = 'auto' ]
361 then {
362 echo "Checking for real Windows registry..."
363 if [ -f "$CROOT/windows/system.dat" ]
364 then DOREG=no
365 elif [ -f "$CROOT/windows/system32/config/system" ]
366 then DOREG=no
367 else DOREG=yes
369 if [ "$DOREG" = 'yes' ]
370 then echo "Not found, default Wine registry will be installed."
371 else echo "Windows registry found, will not install default Wine registry."
373 echo
377 # install default registry entries
378 if [ "$DOREG" = 'yes' ]
379 then {
380 if [ "$BINDIST" = 'no' ]
381 then {
382 echo "Compiling regapi..."
383 echo
384 (cd programs/regapi; make)
385 echo
388 echo "Preparing to install default Wine registry entries..."
390 # create a temporary wineinstall.conf file using ttydrv,
391 # so that we don't have to run regapi under X
392 sed "s/GraphicsDriver=.*/GraphicsDriver=ttydrv/" $CONF > $TMPCONF
394 # create a temporary wineinstall.reg with fixed debugger path
395 sed "s|debugger/winedbg|${DEBUGGER}|" $DEFREG > $TMPREG
397 echo "Installing default Wine registry entries..."
398 echo
399 if ! $REGAPI --config $TMPCONF setValue < $TMPREG > /dev/null
400 then {
401 rm -f $TMPCONF $TMPREG
402 echo
403 echo "Registry install failed."
404 exit 1
406 else echo "Registry entries successfully installed."
408 rm -f $TMPCONF $TMPREG
409 if [ "$SYSREG" = 'auto' ]
410 then SYSREG=yes
415 # make root's registry global, if desired
416 if [ `whoami` = 'root' ] && [ "$SYSREG" = 'yes' ]
417 then {
418 [ -d ~/.wine ] || mkdir ~/.wine
419 if ! [ -f $sysconfdir/wine.userreg ]
420 then {
421 echo "Linking root's user registry hive to the global registry..."
422 cp ~/.wine/wine.userreg $sysconfdir/wine.userreg
423 ln -sf $sysconfdir/wine.userreg ~/.wine/wine.userreg
426 if ! [ -f $sysconfdir/wine.systemreg ]
427 then {
428 echo "Linking root's system registry hive to the global registry..."
429 cp ~/.wine/system.reg $sysconfdir/wine.systemreg
430 ln -sf $sysconfdir/wine.systemreg ~/.wine/system.reg
436 # it's a wrap
437 echo
438 echo "Installation complete for now. Good luck (this is still alpha software)."
439 echo "If you have problems with WINE, please read the documentation first,"
440 echo "as many kinds of potential problems are explained there."