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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 "`wine --version 2>/dev/null`" ]
141 echo "Warning !! wine binary (still) found, which may indicate"
142 echo "a (conflicting) previous installation."
143 echo "You might want to abort and uninstall Wine first."
144 echo "(If you previously tried to install from source manually, "
145 echo "run 'make uninstall' from the wine root directory)"
149 # run the configure script, if necessary
151 if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
154 echo "I see that WINE has already been configured, so I'll skip that."
156 # load configure results
160 echo "Running configure..."
162 if ! ./configure -C $CONFARGS --prefix=$prefix
165 echo "Configure failed, aborting install."
170 # load configure results
172 # make sure X was found
174 if [ "$have_x" != "yes" ]
176 echo "Install the X development headers and try again."
184 # now do the compilation and install, we need to always do this because we
185 # don't want the 'make install' command we might run to run 'make' as root
186 if [ `whoami` != 'root' ]
188 # ask the user if they want to build and install wine
190 echo "We need to install wine as root user, do you want us to build wine,"
191 echo "'su root' and install Wine? Enter 'no' to continue without installing"
192 conf_yesno_answer "(yes/no) "
193 ROOTINSTALL="$ANSWER"
195 if [ "$ROOTINSTALL" = "yes" ]
197 # start out with the basic command
198 sucommand="make install"
200 # if the user doesn't have $libdir in their ld.so.conf add this
201 # to our sucommand string
202 if [ -f /etc/ld.so.conf ]
204 if ! grep -s "$libdir" /etc/ld.so.conf >/dev/null 2>&1
207 echo "$libdir doesn't exist in your /etc/ld.so.conf, it will be added"
208 echo "when we perform the install..."
209 sucommand="$sucommand;echo $libdir>>/etc/ld.so.conf"
212 # run ldconfig always just in case some updated files don't get linked
213 sucommand="$sucommand;$ac_cv_path_LDCONFIG"
216 fi # [ "$ROOTINSTALL" = "yes" ]
220 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
221 echo "in the meantime..."
225 # try to just make wine, if this fails 'make depend' and try to remake
228 if ! { make depend && make; }
231 echo "Compilation failed, aborting install."
238 if [ "$ROOTINSTALL" = "yes" ]
242 echo "Performing 'make install' as root to install binaries, enter root password"
246 if ! su root -c "$sucommand"
249 echo "Incorrect root password. If you are running Ubuntu or a similar distribution,"
250 echo "'make install' needs to be run via the sudo wrapper, so trying that one now"
251 if ! sudo su root -c "$sucommand"
254 echo "Either you entered an incorrect password or we failed to"
255 echo "run '$sucommand' correctly."
256 echo "If you didn't enter an incorrect password then please"
257 echo "report this error and any steps to possibly reproduce it to"
258 echo "http://bugs.winehq.org/"
260 echo "Installation failed, aborting."
269 # see if wine is installed on the users system, if not prompt them
271 if [ -z "`wine --version 2>/dev/null`" ]
273 echo "Could not find wine on your system. Run wineinstall as root to install wine"
274 echo "before re-running wineinstall as a user."
276 echo "Exiting wineinstall"
285 fi # [ "$ROOTINSTALL" = "yes" ]
287 fi # [ `whoami` != 'root' ]
292 if [ "$WINEINSTALLED" = 'no' ]
294 tools/wineprefixcreate --use-wine-tree .
303 echo "Installation complete for now. Good luck (this is still beta software)."
304 echo "If you have problems with WINE, please read the documentation first,"
305 echo "as many kinds of potential problems are explained there."