Remove incorrect entry for 16 bit driver support.
[wine] / documentation / compiling.sgml
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>
4
5     <sect1 id="getting-source">
6       <title>Getting Wine Source</title>
7       <para>
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.
18       </para>
19       <para>
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.
28       </para>
29
30       <sect2 id="getting-source-ftp">
31         <title>Getting Wine Source Code from the FTP Archive</title>
32
33         <para>
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:
40         </para>
41         <itemizedlist>
42           <listitem>
43             <para>
44               <ulink url="ftp://ftp.ibiblio.org/pub/Linux/ALPHA/wine/development/">
45                 ftp://ftp.ibiblio.org/pub/Linux/ALPHA/wine/development/
46               </ulink>
47             </para>
48           </listitem>
49           <listitem>
50             <para>
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/
53               </ulink>
54             </para>
55           </listitem>
56           <listitem>
57             <para>
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/
60               </ulink>
61             </para>
62           </listitem>
63           <listitem>
64             <para>
65               <ulink url="ftp://orcus.progsoc.uts.edu.au/pub/Wine/development/">
66                 ftp://orcus.progsoc.uts.edu.au/pub/Wine/development/
67               </ulink>
68             </para>
69           </listitem>
70         </itemizedlist>
71         <para>
72           The official releases are tagged by date with the format
73           "Wine-<replaceable>YYYYMMDD</>.tar.gz".  Your best bet is to grab
74           the latest one.
75         </para>
76         <para>
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
80           source with (e.g.):
81 <screen>
82 <prompt># </><userinput>tar xzvf wine-<replaceable>20021031</>.tar.gz</>
83 </screen>
84         </para>
85         <para>
86           Then, switch to the directory that was created and compile it by typing (e.g.):
87 <screen>
88 <prompt># </><userinput>./tools/wineinstall</>
89 </screen>
90         </para>
91         <para>
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..
95         </para>
96       </sect2>
97
98       <sect2 id="getting-source-cvs">
99         <title>Getting Wine Source Code from CVS</title>
100
101         <para>
102           The official web page for Wine CVS is
103           <ulink url="http://www.winehq.com/development/">
104             http://www.winehq.com/development/</>.
105         </para>
106         <para>
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:
112 <screen>
113 <prompt>$ </><userinput>export CVSROOT=:pserver:cvs@cvs.winehq.com:/home/wine</>
114 <prompt>$ </><userinput>cvs login</>
115 Password:
116 <prompt>$ </><userinput>cvs checkout wine</>
117 </screen>
118         </para>
119         <para>
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
125           the updates:
126 <screen>
127 <prompt>$ </><userinput>cvs -PAd update</>
128 </screen>
129         </para>
130         <para>
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.
137         </para>
138         <para>
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:
144 <screen>
145 <prompt>$ </><userinput>cvs diff -u &gt;<replaceable>my_patch.diff</></>
146 </screen>
147         </para>
148         <para>
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:
153 <screen>
154 <prompt>$ </><userinput>cvs diff -u dlls/winaspi &gt;<replaceable>my_aspi_patch.diff</></>
155 </screen>
156         </para>
157         <para>
158           Experiment around a little.  It's fairly intuitive.
159         </para>
160       </sect2>
161
162       <sect2 id="getting-upgrading">
163         <title>Upgrading Wine with a Patch</title>
164         <para>
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</>:
173 <screen>
174 <prompt>$ </><userinput>cd wine</>
175 <prompt>$ </><userinput>patch -p0 &lt;<replaceable>../patch_to_apply.diff</></>
176 </screen>
177         </para>
178         <para>
179           To remove the patch, use the <parameter>-R</> option:
180 <screen>
181 <prompt>$ </><userinput>patch -p0 -R &lt;<replaceable>../patch_to_apply.diff</></>
182 </screen>
183         </para>
184         <para>
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:
190 <screen>
191 <prompt>$ </><userinput>patch -p0 --dry-run &lt;<replaceable>../patch_to_apply.diff</></>
192 </screen>
193         </para>
194         <para>
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
200           look like a patch.
201         </para>
202         <para>
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.
217         </para>
218       </sect2>
219     </sect1>
220
221     <sect1 id="compiling-wine">
222       <title>Compiling Wine</title>
223
224       <sect2>
225         <title>Tools required</title>
226         <para>
227           <itemizedlist>
228             <listitem>
229               <para>
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
234                 to work fine.
235               </para>
236             </listitem>
237             <listitem>
238               <para>
239                 flex >= 2.5.1 (required for the debugger and wrc,
240                 and lex won't do)
241               </para>
242             </listitem>
243             <listitem>
244               <para>
245                 bison (also required for debugger. Don't know whether BSD yacc
246                 would work.)
247               </para>
248             </listitem>
249             <listitem>
250               <para>
251                 X11 libs and include files
252               </para>
253             </listitem>
254             <listitem>
255               <para>
256                 texinfo >= 3.11 (optional, to compile the documentation.)
257               </para>
258             </listitem>
259             <listitem>
260               <para>
261                 autoconf (if you want to remake configure, which is
262                 not normally required)
263               </para>
264             </listitem>
265             <listitem>
266               <para>
267                 XF86DGA extension (optional, detected by configure,
268                 needed for DirectX support)
269               </para>
270             </listitem>
271             <listitem>
272               <para>
273                 Open Sound System (optional, detected by configure,
274                 for sound support)
275               </para>
276             </listitem>
277           </itemizedlist>
278         </para>
279         <para>
280           The Red Hat RPMs are gcc-XXX, flex-XXX, and
281           XFree86-devel-XXX, where XXX is the version number.
282         </para>
283       </sect2>
284
285       <sect2>
286         <title>Space required</title>
287         <para>
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.
293         </para>
294       </sect2>
295       
296       <sect2>
297         <title>Common problems</title>
298         <para>
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.
302         </para>
303       </sect2>
304
305       <sect2>
306         <title>OS specific issues</title>
307         <para>
308           <itemizedlist>
309             <listitem>
310               <para>
311                 FreeBSD -- In order to run Wine, the FreeBSD kernel
312                 needs to be compiled with
313
314                 <informaltable frame="all">
315                   <tgroup cols="2">
316                     <tbody>
317                       <row>
318                         <entry>options</entry>
319                         <entry>USER_LDT</entry>
320                       </row>
321                       <row>
322                         <entry>options</entry>
323                         <entry>SYSVSHM</entry>
324                       </row>
325                       <row>
326                         <entry>options</entry>
327                         <entry>SYSVSEM</entry>
328                       </row>
329                       <row>
330                         <entry>options</entry>
331                         <entry>SYSVMSG</entry>
332                       </row>
333                     </tbody>
334                   </tgroup>
335                 </informaltable>
336
337
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.
339               </para>
340             </listitem>
341             <listitem>
342               <para>
343                 SCO Unixware, Openserver -- UW port is supported by SCO.
344               </para>
345             </listitem>
346             <listitem>
347               <para>
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.
349               </para>
350             </listitem>
351             <listitem>
352               <para>
353                 Solaris x86 2.x -- Needs GNU toolchain (gcc, gas, flex as above, yacc may work) to compile, seems functional (980215). 
354               </para>
355             </listitem>
356             <listitem>
357               <para>
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.
362               </para>
363             </listitem>
364             <listitem>
365               <para>
366                 Macintosh/Rhapsody/BeOS -- no ports have been attempted.
367               </para>
368             </listitem>
369           </itemizedlist>
370         </para>
371       </sect2>
372     </sect1>
373   </chapter>
374
375 <!-- Keep this comment at the end of the file
376 Local variables:
377 mode: sgml
378 sgml-parent-document:("wine-doc.sgml" "set" "book" "part" "chapter" "")
379 End:
380 -->