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:
25 How to port Wine to your favorite operating system
30 Why you probably shouldn't use
<symbol>#ifdef MyOS
</symbol>
41 This document does not say a thing about how to port Wine to
42 non-
386 operating systems, though. You would need a CPU
43 emulator. Let's get Wine into a better shape on
386 first,
49 <title>Why
<symbol>#ifdef MyOS
</symbol> is probably a mistake.
</title>
52 Operating systems change. Maybe yours doesn't have the
53 <filename>foo.h
</filename> header, but maybe a future
54 version will have it. If you want to
<symbol>#include
55 <foo.h
></symbol>, it doesn't matter what operating
56 system you are using; it only matters whether
57 <filename>foo.h
</filename> is there.
60 Furthermore, operating systems change names or
"fork" into
61 several ones. An
<symbol>#ifdef MyOs
</symbol> will break
65 If you use the feature of
<command>autoconf
</command> -- the
66 Gnu auto-configuration utility -- wisely, you will help
67 future porters automatically because your changes will test
68 for
<emphasis>features
</emphasis>, not names of operating
69 systems. A feature can be many things:
75 existence of a header file
80 existence of a library function
85 existence of libraries
90 bugs in header files, library functions, the compiler, ...
100 You will need Gnu Autoconf, which you can get from your
101 friendly Gnu mirror. This program takes Wine's
102 <filename>configure.in
</filename> file and produces a
103 <filename>configure
</filename> shell script that users use
104 to configure Wine to their system.
107 There
<emphasis>are
</emphasis> exceptions to the
"avoid
108 <symbol>#ifdef MyOS</symbol>" rule. Wine, for example, needs
109 the internals of the signal stack -- that cannot easily be
110 described in terms of features.
113 Let's now turn to specific porting problems and how to solve
119 <title>MyOS doesn't have the
<filename>foo.h
</filename> header!
</title>
122 This first step is to make
<command>autoconf
</command> check
123 for this header. In
<filename>configure.in
</filename> you
124 add a segment like this in the section that checks for
125 header files (search for
"header files"):
128 AC_CHECK_HEADER(foo.h, AC_DEFINE(HAVE_FOO_H))
131 If your operating system supports a header file with the
132 same contents but a different name, say
133 <filename>bar.h
</filename>, add a check for that also.
139 #include
<foo.h
>
146 #include
<foo.h
>
147 #elif defined (HAVE_BAR_H)
148 #include
<bar.h
>
152 If your system doesn't have a corresponding header file even
153 though it has the library functions being used, you might
154 have to add an
<symbol>#else
</symbol> section to the
155 conditional. Avoid this if you can.
158 You will also need to add
<symbol>#undef HAVE_FOO_H
</symbol>
159 (etc.) to
<filename>include/config.h.in
</filename>
162 Finish up with
<command>make configure
</command> and
163 <command>./configure
</command>.
168 <title>MyOS doesn't have the
<function>bar
</function> function!
</title>
171 A typical example of this is the
172 <function>memmove
</function> function. To solve this
173 problem you would add
<function>memmove
</function> to the
174 list of functions that
<command>autoconf
</command> checks
175 for. In
<filename>configure.in
</filename> you search for
176 <function>AC_CHECK_FUNCS
</function> and add
177 <function>memmove
</function>. (You will notice that someone
178 already did this for this particular function.)
181 Secondly, you will also need to add
<symbol>#undef
183 <filename>include/config.h.in
</filename>
186 The next step depends on the nature of the missing function.
194 It's easy to write a complete implementation of the
195 function. (
<function>memmove
</function> belongs to
199 You add your implementation in
200 <filename>misc/port.c
</filename> surrounded by
201 <symbol>#ifndef HAVE_MEMMOVE
</symbol> and
202 <symbol>#endif
</symbol>.
205 You might have to add a prototype for your function.
206 If so,
<filename>include/miscemu.h
</filename> might be the place. Don't
207 forget to protect that definition by
<symbol>#ifndef
208 HAVE_MEMMOVE
</symbol> and
<symbol>#endif
</symbol> also!
216 A general implementation is hard, but Wine is only
217 using a special case.
220 An example is the various
<function>wait
</function>
221 calls used in
<function>SIGNAL_child
</function> from
222 <filename>loader/signal.c
</filename>. Here we have a
223 multi-branch case on features:
228 #elif defined (HAVE_THAT)
230 #elif defined (HAVE_SOMETHING_ELSE)
235 Note that this is very different from testing on
236 operating systems. If a new version of your operating
237 systems comes out and adds a new function, this code
238 will magically start using it.
244 Finish up with
<command>make configure
</command> and
245 <command>./configure
</command>.
251 <sect1 id=
"os2-wine">
252 <title>Running & Compiling Wine in OS/
2</title>
255 Written by &name-robert-pouliot;
<email>&email-robert-pouliot;
</email>,
259 (Extracted from
<filename>wine/documentation/wine_os2
</filename>)
263 If you want to help the port of Wine to OS/
2, send me a
264 message at
<email>krynos@clic.net
</email> I currently don't
265 want beta testers. It must work before we can test it.
268 Here is what you need to (try to) compile Wine for OS/
2:
279 XFree86
3.2 OS/
2 (with development libraries)
284 <command>bash
</command>, gnu
<command>make
</command>,
285 <command>grep
</command>,
<command>tar
</command>,
286 <command>bison
</command>,
<command>flex
</command>
291 <command>sed
</command> (a working copy of)
296 <command>diff
</command> and
<command>patch
</command>
302 Lots of disk space (about
40-
50 megs after EMX and XFree installed)
312 <prompt>$
</prompt><userinput>sh
</userinput>
313 <prompt>$
</prompt><userinput>tools/make_os2.sh
</userinput>
314 <prompt>$
</prompt><userinput>make depend
</userinput>
315 <prompt>$
</prompt><userinput>make
</userinput>
316 <prompt>$
</prompt><userinput>emxbind wine
</userinput>
326 <command>configure
</command> and
<command>make depend
</command> work...
331 <command>make
</command> compiles (with a modified
332 Linux
<filename>mman.h
</filename>), but doesn't
338 signal handling is horrible... (if any)
343 EMX doesn't support
<function>mmap
</function> (and
344 related), SysV IPC and
<function>stafs()
</function>
349 XFree86/OS2
3.2 doesn't support
350 <function>XShmQueryExtension()
</function> and
351 <function>XShmPixmapFormat()
</function> due to the same
358 What needs to be redone:
364 LDT (using
<function>DosAllocSeg
</function> in
365 <filename>memory/ldt.c
</filename>) *
370 Implement
<function>mmap()
</function> and SysV IPC in EMX *
385 Communication (modem),
390 Interrupt (if int unknown, call current RealMode one...),
395 Verify that everything is thread safe (how does Win95/NT handle multi-thread?),
400 Move X functions in some files (and make a wrapper, to use PM instead latter),
405 Return right CPU type,
422 OS/
2 have DOS interrupts
427 OS/
2 have I/O port access
432 OS/
2 have multi-thread
437 Merlin have Open32 (to be used later...)
445 <!-- Keep this comment at the end of the file
448 sgml-parent-document:("wine-devel.sgml" "set" "book" "part" "chapter" "")