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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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
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
42 while [ $# -gt 0 ] && shift
50 function conf_reset_question {
51 # parameters: $1 = question-id
52 # this is used to flush any cached answers and "already-displayed" flags
56 function conf_yesno_answer {
58 while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
66 function conf_string_answer {
73 echo "WINE Installer v0.75"
76 if [ "$BINDIST" = 'no' ]
81 if [ -f ../configure ]
86 echo "You're running this from the wrong directory."
87 echo "Change to the Wine source's main directory and try again."
94 if [ `whoami` = 'root' ]
96 echo "You are running wineinstall as root, this is not advisable. Please rerun as a user."
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."
110 # check whether RPM installed, and if it is, remove any old wine rpm.
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"
120 echo Starting wine rpm removal...
121 su -c "rpm -e wine; RET=$?"
122 if [ $RET -eq 0 ]; then
125 echo "FAILED. Probably you aren't installing as root."
126 echo "Expect problems (library conflicts with existing install etc.)."
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 !"
138 # check whether wine binary still available
139 if [ -n "`which wine 2>/dev/null|grep '/wine'`" ]; then
140 echo "Warning !! wine binary (still) found, which may indicate"
141 echo "a (conflicting) previous installation."
142 echo "You might want to abort and uninstall Wine first."
143 echo "(If you previously tried to install from source manually, "
144 echo "run 'make uninstall' from the wine root directory)"
148 # run the configure script, if necessary
150 if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
153 echo "I see that WINE has already been configured, so I'll skip that."
155 # load configure results
159 echo "Running configure..."
161 if ! ./configure -C $CONFARGS --prefix=$prefix
164 echo "Configure failed, aborting install."
169 # load configure results
171 # make sure X was found
173 if [ "$have_x" != "yes" ]
175 echo "Install the X development headers and try again."
183 # now do the compilation and install, we need to always do this because we
184 # don't want the 'make install' command we might run to run 'make' as root
185 if [ `whoami` != 'root' ]
187 # ask the user if they want to build and install wine
189 echo "We need to install wine as root user, do you want us to build wine,"
190 echo "'su root' and install Wine? Enter 'no' to continue without installing"
191 conf_yesno_answer "(yes/no) "
192 ROOTINSTALL="$ANSWER"
194 if [ "$ROOTINSTALL" = "yes" ]
196 # start out with the basic command
197 sucommand="make install"
199 # if the user doesn't have $libdir in their ld.so.conf add this
200 # to our sucommand string
201 if [ -f /etc/ld.so.conf ]
203 if ! grep -s "$libdir" /etc/ld.so.conf >/dev/null 2>&1
206 echo "$libdir doesn't exist in your /etc/ld.so.conf, it will be added"
207 echo "when we perform the install..."
208 sucommand="$sucommand;echo $libdir>>/etc/ld.so.conf"
211 # run ldconfig always just in case some updated files don't get linked
212 sucommand="$sucommand;$ac_cv_path_LDCONFIG"
215 fi # [ "$ROOTINSTALL" = "yes" ]
219 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
220 echo "in the meantime..."
224 # try to just make wine, if this fails 'make depend' and try to remake
227 if ! { make depend && make; }
230 echo "Compilation failed, aborting install."
237 if [ "$ROOTINSTALL" = "yes" ]
241 echo "Performing 'make install' as root to install binaries, enter root password"
245 if ! su root -c "$sucommand"
247 if ! su root -c "$sucommand"
250 echo "Either you entered an incorrect password or we failed to"
251 echo "run '$sucommand' correctly."
252 echo "If you didn't enter an incorrect password then please"
253 echo "report this error and any steps to possibly reproduce it to"
254 echo "http://bugs.winehq.org/"
256 echo "Installation failed, aborting."
265 # see if wine is installed on the users system, if not prompt them
267 if [ ! `which wine` ]
269 echo "Could not find wine on your system. Run wineinstall as root to install wine"
270 echo "before re-running wineinstall as a user."
272 echo "Exiting wineinstall"
281 fi # [ "$ROOTINSTALL" = "yes" ]
283 fi # [ `whoami` != 'root' ]
288 if [ "$WINEINSTALLED" = 'no' ]
290 tools/wineprefixcreate --use-wine-tree .
299 echo "Installation complete for now. Good luck (this is still alpha software)."
300 echo "If you have problems with WINE, please read the documentation first,"
301 echo "as many kinds of potential problems are explained there."