Check for Xpm headers and add /usr/local/lib to /etc/ld.so.conf if
[wine] / tools / wineinstall
1 #!/bin/bash
2 # WINE Installation script
3
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
11 # defaults
12
13 sysconfdir=/usr/local/etc
14 DOCONF=auto
15 DOREG=yes
16
17 # startup...
18
19 echo "WINE Installer v0.2"
20 echo
21 if ! [ -f configure ]
22 then {
23   echo "You're running this from the wrong directory."
24   echo "Change to the Wine directory and try again."
25   exit 1
26 }
27 fi
28
29 # run the configure script, if necessary
30
31 if [ -f Makefile ] && [ Makefile -nt configure ]
32 then {
33   echo "I see that WINE has already been configured, so I'll skip that."
34 }
35 else {
36   # we'll run with defaults (we need libwine.a later)
37   echo "Running configure..."
38   echo
39   if ! ./configure
40   then {
41     echo
42     echo "Configure failed, aborting install."
43     rm -f config.cache
44     exit 1
45   }
46   fi
47   # make sure X was found
48   if ! grep -qs "have_x=yes" config.cache
49   then {
50     echo "Install the X development headers and try again."
51     rm -f config.cache
52     exit 1
53   }
54   elif ! grep -qs "xpm_h=yes" config.cache
55   then {
56     echo "Install the Xpm development headers and try again."
57     rm -f config.cache
58     exit 1
59   }
60   fi
61 }
62 fi
63
64 # now do the compilation
65
66 if [ -f wine ] && [ wine -nt Makefile ]
67 then {
68   echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
69 }
70 else {
71   echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever, in the meantime..."
72   echo
73   if ! { make depend && make; }
74   then {
75     echo
76     echo "Compilation failed, aborting install."
77     exit 1
78   }
79   fi
80   echo
81 }
82 fi
83
84 # and installation, if root
85
86 if [ `whoami` != 'root' ]
87 then {
88   echo "You aren't root, so I'll skip the make install."
89 }
90 else {
91   echo "Now installing binaries onto the system..."
92   echo
93   if ! make install
94   then {
95     echo
96     echo "Installation failed, aborting."
97     exit 1
98   }
99   fi
100   if [ -f /etc/ld.so.conf ] && ! grep -qs "/usr/local/lib" /etc/ld.so.conf
101   then {
102     echo
103     echo "/usr/local/lib didn't exist in your /etc/ld.so.conf, adding it now..."
104     echo /usr/local/lib >>/etc/ld.so.conf
105     echo "Re-running ldconfig..."
106     ldconfig
107   }
108   fi
109 }
110 fi
111 echo
112
113 # now check whether we should generate wine.conf
114 if [ -z "$DOCONF" ]
115 then DOCONF=auto
116 fi
117
118 if [ "$DOCONF" = 'auto' ]
119 then {
120   # see if we already have a system wine.conf
121   if [ -f $sysconfdir/wine.conf ] || [ -f /etc/wine.conf ]
122   then DOCONF=no
123   fi
124 }
125 fi
126
127 if [ "$DOCONF" != 'no' ]
128 then {
129   if [ `whoami` != 'root' ]
130   then {
131     CONF=~/.winerc
132     if ! [ -f $CONF ]
133     then {
134       if [ "$DOCONF" != 'yes' ]
135       then {
136         echo "Since you aren't root, and there's no system wine.conf, I assume"
137         echo "you want a user-specific .winerc. Am I correct? (yes/no)"
138         while [ "$DOCONF" != 'yes' ] && [ "$DOCONF" != 'no' ]
139         do read DOCONF
140         done
141       }
142       fi
143       if [ "$DOCONF" = 'no' ]
144       then echo "Skipping generation of .winerc."
145       fi
146     }
147     fi
148   }
149   else {
150     CONF=$sysconfdir/wine.conf
151     mkdir -p $sysconfdir
152     DOCONF=yes
153   }
154   fi
155 }
156 fi
157
158 if [ "$DOCONF" = 'yes' ]
159 then {
160   echo "Now automatically generating $CONF for you..."
161   echo
162   tools/wineconf > $CONF
163   echo
164   echo "Done. You probably want to review the file, though."
165 }
166 fi
167 echo
168
169 # install default registry entries
170 if [ "$DOREG" = 'yes' ]
171 then {
172   echo "Compiling regapi..."
173   echo
174   (cd programs/regapi; make)
175   echo
176   echo "Installing default registry entries, please wait..."
177   echo
178   if ! programs/regapi/regapi setValue < winedefault.reg
179   then {
180     echo
181     echo "Registry install failed. Perhaps you weren't running X."
182     exit 1
183   }
184   fi
185   # FIXME: perhaps install registry to $sysconfdir/winesystem.reg and $sysconfdir/wineuser.reg?
186 }
187 fi
188 echo
189 echo "Installation complete for now. Good luck (this is still alpha software)."
190 echo "If you have problems with WINE, please read the documentation first."