2 <title>Porting Wine to new Platforms
</title>
3 <para>Porting Wine to different (UNIX-based) operating systems...
</para>
5 <sect1 id=
"wine-porting">
12 (Extracted from
<filename>wine/documentation/how-to-port
</filename>)
16 <title>What is this?
</title>
19 This note is a short description of:
24 <para>How to port Wine to your favourite operating system
</para>
27 <para>Why you probably shouldn't use
<symbol>#ifdef MyOS
</symbol></para>
30 <para>What to do instead.
</para>
35 This document does not say a thing about how to port Wine to
36 non-
386 operating systems, though. You would need a CPU
37 emulator. Let's get Wine into a better shape on
386 first,
43 <title>Why
<symbol>#ifdef MyOS
</symbol> is probably a mistake.
</title>
46 Operating systems change. Maybe yours doesn't have the
47 <filename>foo.h
</filename> header, but maybe a future
48 version will have it. If you want to
<symbol>#include
49 <foo.h
></symbol>, it doesn't matter what operating
50 system you are using; it only matters whether
51 <filename>foo.h
</filename> is there.
54 Furthermore, operating systems change names or
"fork" into
55 several ones. An
<symbol>#ifdef MyOs
</symbol> will break
59 If you use the feature of
<command>autoconf
</command> -- the
60 Gnu auto-configuration utility -- wisely, you will help
61 future porters automatically because your changes will test
62 for
<emphasis>features
</emphasis>, not names of operating
63 systems. A feature can be many things:
68 <para>existance of a header file
</para>
71 <para>existance of a library function
</para>
74 <para>existance of libraries
</para>
77 <para>bugs in header files, library functions, the compiler, ...
</para>
80 <para>(you name it)
</para>
84 You will need Gnu Autoconf, which you can get from your
85 friendly Gnu mirror. This program takes Wine's
86 <filename>configure.in
</filename> file and produces a
87 <filename>configure
</filename> shell script that users use
88 to configure Wine to their system.
91 There
<emphasis>are
</emphasis> exceptions to the
"avoid
92 <symbol>#ifdef MyOS</symbol>" rule. Wine, for example, needs
93 the internals of the signal stack -- that cannot easily be
94 described in terms of features.
97 Let's now turn to specific porting problems and how to solve
103 <title>MyOS doesn't have the
<filename>foo.h
</filename> header!
</title>
106 This first step is to make
<command>autoconf
</command> check
107 for this header. In
<filename>configure.in
</filename> you
108 add a segment like this in the section that checks for
109 header files (search for
"header files"):
112 AC_CHECK_HEADER(foo.h, AC_DEFINE(HAVE_FOO_H))
115 If your operating system supports a header file with the
116 same contents but a different name, say
117 <filename>bar.h
</filename>, add a check for that also.
123 #include
<foo.h
>
130 #include
<foo.h
>
131 #elif defined (HAVE_BAR_H)
132 #include
<bar.h
>
136 If your system doesn't have a corresponding header file even
137 though it has the library functions being used, you might
138 have to add an
<symbol>#else
</symbol> section to the
139 conditional. Avoid this if you can.
142 You will also need to add
<symbol>#undef HAVE_FOO_H
</symbol>
143 (etc.) to
<filename>include/config.h.in
</filename>
146 Finish up with
<command>make configure
</command> and
147 <command>./configure
</command>.
152 <title>MyOS doesn't have the
<function>bar
</function> function!
</title>
155 A typical example of this is the
156 <function>memmove
</function> function. To solve this
157 problem you would add
<function>memmove
</function> to the
158 list of functions that
<command>autoconf
</command> checks
159 for. In
<filename>configure.in
</filename> you search for
160 <function>AC_CHECK_FUNCS
</function> and add
161 <function>memmove
</function>. (You will notice that someone
162 already did this for this particular function.)
165 Secondly, you will also need to add
<symbol>#undef
167 <filename>include/config.h.in
</filename>
170 The next step depends on the nature of the missing function.
178 It's easy to write a complete implementation of the
179 function. (
<function>memmove
</function> belongs to
183 You add your implementation in
184 <filename>misc/port.c
</filename> surrounded by
185 <symbol>#ifndef HAVE_MEMMOVE
</symbol> and
186 <symbol>#endif
</symbol>.
189 You might have to add a prototype for your function.
190 If so,
<filename>include/miscemu.h
</filename> might be the place. Don't
191 forget to protect that definition by
<symbol>#ifndef
192 HAVE_MEMMOVE
</symbol> and
<symbol>#endif
</symbol> also!
200 A general implementation is hard, but Wine is only
201 using a special case.
204 An example is the various
<function>wait
</function>
205 calls used in
<function>SIGNAL_child
</function> from
206 <filename>loader/signal.c
</filename>. Here we have a
207 multi-branch case on features:
212 #elif defined (HAVE_THAT)
214 #elif defined (HAVE_SOMETHING_ELSE)
219 Note that this is very different from testing on
220 operating systems. If a new version of your operating
221 systems comes out and adds a new function, this code
222 will magically start using it.
228 Finish up with
<command>make configure
</command> and
229 <command>./configure
</command>.
235 <sect1 id=
"os2-wine">
236 <title>Running & Compiling WINE in OS/
2</title>
239 Written by &name-robert-pouliot;
<email>&email-robert-pouliot;
</email>,
243 (Extracted from
<filename>wine/documentation/wine_os2
</filename>)
247 If you want to help the port of WINE to OS/
2, send me a
248 message at
<email>krynos@clic.net
</email> I currently don't
249 want beta testers. It must work before we can test it.
252 Here is what you need to (try to) compile Wine for OS/
2:
257 <para>EMX
0.9c (fix
2)
</para>
260 <para>XFree86
3.2 OS/
2 (with development libraries)
</para>
264 <command>bash
</command>, gnu
<command>make
</command>,
265 <command>grep
</command>,
<command>tar
</command>,
266 <command>bison
</command>,
<command>flex
</command>
270 <para><command>sed
</command> (a working copy of)
</para>
276 <para><command>diff
</command> and
<command>patch
</command>
277 are recommended
</para>
280 <para>Lots of disk space (about
40-
50 megs after EMX and XFree installed)
</para>
289 <prompt>$
</prompt><userinput>sh
</userinput>
290 <prompt>$
</prompt><userinput>tools/make_os2.sh
</userinput>
291 <prompt>$
</prompt><userinput>make depend
</userinput>
292 <prompt>$
</prompt><userinput>make
</userinput>
293 <prompt>$
</prompt><userinput>emxbind wine
</userinput>
302 <para><command>configure
</command> and
<command>make depend
</command> work...
</para>
305 <para><command>make
</command> compiles (with a modified
306 Linux
<filename>mman.h
</filename>), but doesn't
310 <para>signal handling is horrible... (if any)
</para>
313 <para>EMX doesn't support
<function>mmap
</function> (and
314 related), SysV IPC and
<function>stafs()
</function></para>
318 XFree86/OS2
3.2 doesn't support
319 <function>XShmQueryExtension()
</function> and
320 <function>XShmPixmapFormat()
</function> due to the same
327 What needs to be redone:
332 <para>LDT (using
<function>DosAllocSeg
</function> in
333 <filename>memory/ldt.c
</filename>) *
</para>
336 <para>Implement
<function>mmap()
</function> and SysV IPC in EMX *
</para>
339 <para>File functions,
</para>
342 <para>I/O access (do it!),
</para>
345 <para>Communication (modem),
</para>
348 <para>Interrupt (if int unknown, call current RealMode one...),
</para>
352 Verify that everything is thread safe (how does Win95/NT handle multi-thread?),
357 Move X functions in some files (and make a wrapper, to use PM instead latter),
361 <para>Return right CPU type,
</para>
364 <para>Make winsock work
</para>
374 <para>OS/
2 have DOS interrupts
</para>
377 <para>OS/
2 have I/O port access
</para>
380 <para>OS/
2 have multi-thread
</para>
383 <para>Merlin have Open32 (to be used later...)
</para>
390 <!-- Keep this comment at the end of the file
393 sgml-parent-document:("wine-doc.sgml" "set" "book" "part" "chapter" "")