1 <chapter id="compiling">
2 <title>Getting and Compiling the Wine Source</title>
3 <para>How to obtain and compile wine, and problems that may arise...</para>
5 <sect1 id="getting-source">
6 <title>Getting Wine Source</title>
8 If you are going to compile Wine, either to use the most recent
9 code possible or to improve it, then the first thing to do is to
10 obtain a copy of the source code. We'll cover how to retrieve and
11 compile the official source releases from the <link
12 linkend="getting-source-ftp">FTP archives</link>, and also how
13 to get the cutting edge up-to-the-minute fresh Wine source
14 code from <link linkend="getting-source-cvs">CVS (Concurrent
15 Versions System)</link>. Both processes of source code
16 installation are similar, and once you master one, you should
17 have no trouble dealing with the other one.
20 You may also need to know how to apply a source code patch to
21 your version of Wine. Perhaps you've uncovered
22 a bug in Wine, reported it to the <ulink
23 url="mailto:wine-devel@winehq.com">Wine mailing list</ulink>,
24 and received a patch from a developer to hopefully fix the
25 bug. We will show you how to
26 <link linkend="getting-upgrading">safely apply the
27 patch</link> and revert it if the patch doesn't work.
30 <sect2 id="getting-source-ftp">
31 <title>Getting Wine Source Code from the FTP Archive</title>
34 The safest way to grab the source is from one of the official
35 FTP archives. An up to date listing is in the <ulink
36 url="http://www.winehq.com/source/ANNOUNCE">ANNOUNCE</ulink>
37 file in the Wine distribution (which you would have if you
38 already downloaded it). Here is a list
39 of FTP servers carrying Wine:
44 <ulink url="ftp://ftp.ibiblio.org/pub/Linux/ALPHA/wine/development/">
45 ftp://ftp.ibiblio.org/pub/Linux/ALPHA/wine/development/
51 <ulink url="ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/ALPHA/wine/development/">
52 ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/ALPHA/wine/development/
58 <ulink url="ftp://ftp.fu-berlin.de/unix/linux/mirrors/sunsite.unc.edu/ALPHA/wine/development/">
59 ftp://ftp.fu-berlin.de/unix/linux/mirrors/sunsite.unc.edu/ALPHA/wine/development/
65 <ulink url="ftp://orcus.progsoc.uts.edu.au/pub/Wine/development/">
66 ftp://orcus.progsoc.uts.edu.au/pub/Wine/development/
72 The official releases are tagged by date with the format
73 "Wine-<replaceable>YYYYMMDD</>.tar.gz". Your best bet is to grab
77 Once you have downloaded this, you must first compile wine, and then
78 install it. This is not very hard to do. First switch to the
79 directory containing the file you just downloaded. Then extract the
82 <prompt># </><userinput>tar xzvf wine-<replaceable>20021031</>.tar.gz</>
86 Then, switch to the directory that was created and compile it by typing (e.g.):
88 <prompt># </><userinput>./tools/wineinstall</>
92 NOTE: You must make sure that you are not the superuser (root) when doing this,
93 and that you have write permission to the directory that was created by the tar
94 command as well as all of its subdirectories and files..
98 <sect2 id="getting-source-cvs">
99 <title>Getting Wine Source Code from CVS</title>
102 The official web page for Wine CVS is
103 <ulink url="http://www.winehq.com/development/">
104 http://www.winehq.com/development/</>.
107 First, you need to get a copy of the latest Wine sources
108 using CVS. You can tell it where to find the source tree by
109 setting the <envar>CVSROOT</envar> environment variable. You
110 also have to log in anonymously to the wine CVS server. In
111 <command>bash</>, it might look something like this:
113 <prompt>$ </><userinput>export CVSROOT=:pserver:cvs@cvs.winehq.com:/home/wine</>
114 <prompt>$ </><userinput>cvs login</>
116 <prompt>$ </><userinput>cvs checkout wine</>
120 That'll pull down the entire Wine source tree from
121 winehq.com and place it in the current directory (actually
122 in the 'wine' subdirectory). CVS has a million command line
123 parameters, so there are many ways to pull down files, from
124 anywhere in the revision history. Later, you can grab just
127 <prompt>$ </><userinput>cvs -PAd update</>
131 <command>cvs update</> works from inside the source tree.
132 You don't need the <envar>CVSROOT</> environment variable
133 to run it either. You just have to be inside the source tree.
134 The <parameter>-P</>, <parameter>-A</> and <parameter>-d</>
135 options make sure your local Wine tree directory structure stays
136 in sync with the remote repository.
139 After you've made changes, you can create a patch with
140 <command>cvs diff -u</>, which sends output to stdout
141 (the <parameter>-u</> controls the format of the
142 patch). So, to create an <filename>my_patch.diff</>
143 file, you would do this:
145 <prompt>$ </><userinput>cvs diff -u ><replaceable>my_patch.diff</></>
149 You can call <command>cvs diff</command> from anywhere in the
150 tree (just like <command>cvs update</command>), and it will
151 always grab recursively from that point. You can also specify
152 single files or subdirectories:
154 <prompt>$ </><userinput>cvs diff -u dlls/winaspi ><replaceable>my_aspi_patch.diff</></>
158 Experiment around a little. It's fairly intuitive.
162 <sect2 id="getting-upgrading">
163 <title>Upgrading Wine with a Patch</title>
165 If you have the Wine source code, as opposed to a binary
166 distribution, you have the option of applying patches to the
167 source tree to fix bugs and add experimental features.
168 Perhaps you've found a bug, reported it to the <ulink
169 url="mailto:wine-devel@winehq.com">Wine mailing list</>,
170 and received a patch file to fix the bug. You can apply the
171 patch with the <command>patch</> command, which takes a
172 streamed patch from <filename>stdin</>:
174 <prompt>$ </><userinput>cd wine</>
175 <prompt>$ </><userinput>patch -p0 <<replaceable>../patch_to_apply.diff</></>
179 To remove the patch, use the <parameter>-R</> option:
181 <prompt>$ </><userinput>patch -p0 -R <<replaceable>../patch_to_apply.diff</></>
185 If you want to do a test run to see if the patch will apply
186 successfully (e.g., if the patch was created from an older or
187 newer version of the tree), you can use the
188 <parameter>--dry-run</> parameter to run the patch
189 without writing to any files:
191 <prompt>$ </><userinput>patch -p0 --dry-run <<replaceable>../patch_to_apply.diff</></>
195 <command>patch</> is pretty smart about extracting
196 patches from the middle of a file, so if you save an email with
197 an inlined patch to a file on your hard drive, you can invoke
198 patch on it without stripping out the email headers and other
199 text. <command>patch</> ignores everything that doesn't
203 The <parameter>-p0</> option to <command>patch</>
204 tells it to keep the full file name from the patch file. For example,
205 if the file name in the patch file was
206 <filename>wine/programs/clock/main.c</>.
207 Setting the <parameter>-p0</> option would apply the patch
208 to the file of the same name i.e.
209 <filename>wine/programs/clock/main.c </>.
210 Setting the <parameter>-p1</> option would strip off the
211 first part of the file name and apply
212 the patch instead to <filename>programs/clock/main.c </>.
213 The <parameter>-p1</> option would be useful if you named
214 your top level wine directory differently to the person who sent you
215 the patch. For the <parameter>-p1</> option
216 <command>patch</> should be run from the top level wine directory.
221 <sect1 id="compiling-wine">
222 <title>Compiling Wine</title>
225 <title>Tools required</title>
230 gcc -- 2.7.x required (Wine uses attribute stdcall).
231 Versions earlier than 2.7.2.3 barf on shellord.c
232 -- compile without optimizing for that file.
233 In addition EGCS 1.1.x and GCC 2.95.x are reported
239 flex >= 2.5.1 (required for the debugger and wrc,
245 bison (also required for debugger. Don't know whether BSD yacc
251 X11 libs and include files
256 texinfo >= 3.11 (optional, to compile the documentation.)
261 autoconf (if you want to remake configure, which is
262 not normally required)
267 XF86DGA extension (optional, detected by configure,
268 needed for DirectX support)
273 Open Sound System (optional, detected by configure,
280 The Red Hat RPMs are gcc-XXX, flex-XXX, and
281 XFree86-devel-XXX, where XXX is the version number.
286 <title>Space required</title>
288 You also need about 230 MB of available disk space for compilation.
289 The compiled libwine.so binary takes around 5 MB of disk space,
290 which can be reduced to about 1 MB by stripping ('strip wine').
291 Stripping is not recommended, however, as you can't submit
292 proper crash reports with a stripped binary any more.
297 <title>Common problems</title>
299 If you get a repeatable sig11 compiling shellord.c, thunk.c
300 or other files, try compiling just that file without optimization.
301 Then you should be able to finish the build.
306 <title>OS specific issues</title>
311 FreeBSD -- In order to run Wine, the FreeBSD kernel
312 needs to be compiled with
314 <informaltable frame="all">
318 <entry>options</entry>
319 <entry>USER_LDT</entry>
322 <entry>options</entry>
323 <entry>SYSVSHM</entry>
326 <entry>options</entry>
327 <entry>SYSVSEM</entry>
330 <entry>options</entry>
331 <entry>SYSVMSG</entry>
338 If you need help, read the chapter "<ulink url="http://www.freebsd.org/handbook/kernelconfig-building.html">Building and Installing a Custom Kernel</ulink>" in the "<ulink url="http://www.freebsd.org/handbook/">FreeBSD handbook</ulink>. You'll need to be running FreeBSD 3.x or later.
343 SCO Unixware, Openserver -- UW port is supported by SCO.
348 OS/2 -- not a complete port. See <ulink url="http://odin.netlabs.org/ProjectAbout.phtml">Odin</ulink> for a project which uses some Wine code.
353 Solaris x86 2.x -- Needs GNU toolchain (gcc, gas, flex as above, yacc may work) to compile, seems functional (980215).
358 DGUX, HP, Irix, or other Unixes; non-intel Linux.
359 No ports have been seriously attempted.
360 For non-intel Unixes, only a winelib port is relevant.
361 Alignment may be a problem.
366 Macintosh/Rhapsody/BeOS -- no ports have been attempted.
375 <!-- Keep this comment at the end of the file
378 sgml-parent-document:("wine-doc.sgml" "set" "book" "part" "chapter" "")