Removed chdir("/") until we have proper Unix cwd management.
[wine/multimedia.git] / documentation / packaging.sgml
blob1f8fb56ef4c3a80e2ffa4f14e70a79fe2c5e365b
1 <chapter id="packaging">
2 <title>Packaging Wine</title>
4 <sect1 id="distributing">
5 <title>A Small WINE Distribution Guide</title>
7 <para>
8 written by Marcus Meissner &lt;Marcus.Meissner@caldera.de>
9 </para>
10 <para>
11 (Extracted from <filename>wine/documentation/distributors</filename>)
12 </para>
14 <para>
15 While packaging WINE for one of the Linux distributions I came
16 across several points which have not been clarified yet.
17 Particularly a how-to for WINE packaging distributors is
18 missing. This document tries to give a brief overview over the
19 rationales I thought up and how I tried to implement it.
20 (While the examples use <command>rpm</command> most of this
21 stuff can be applied to other packagers too.)
22 </para>
24 <note>
25 <para>
26 YOU SHOULD RECHECK THIS FILE EVERY TWO MONTHS OR SO
27 (<command>diff -uN</command> comes to my mind here...).
28 We'll be adding stuff constantly here in order to improve
29 the Wine environment !
30 </para>
31 </note>
33 <orderedlist>
34 <listitem>
36 <para>Rationales</para>
37 <para>
38 A WINE install should:
39 </para>
40 <itemizedlist>
41 <listitem>
42 <para>Not have a world writeable directory (-tree).</para>
43 </listitem>
44 <listitem>
45 <para>
46 Require only as much user input as needed. It would be
47 very good if it would not require any at all. Just let
48 the system administrator do <command>rpm -i
49 wine.rpm</command> and let any user be able to run
50 <command>wine sol.exe</command> instantly.
51 </para>
52 </listitem>
53 <listitem>
54 <para>
55 Give the user as much flexibility as possible to
56 install his own applications, do his own configuring
57 etc.
58 </para>
59 </listitem>
60 <listitem>
61 <para>
62 Come as preconfigured as possible, so the user does
63 not need to change any configuration files.
64 </para>
65 </listitem>
66 <listitem>
67 <para>Use only as much diskspace as needed per user.</para>
68 </listitem>
69 </itemizedlist>
71 <para>
72 A WINE install needs:
73 </para>
75 <itemizedlist>
76 <listitem>
77 <para>
78 A writeable <filename>C:\</filename> directory
79 structure on a per user basis. Applications do dump
80 <filename>.ini</filename> files into
81 <filename>c:\windows</filename>, installers dump
82 <filename>.exe</filename>, <filename>.dll</filename>
83 and more into <filename>c:\windows\</filename> and
84 subdirectories or into <filename>C:\Program
85 Files\</filename>.
86 </para>
87 </listitem>
88 <listitem>
89 <para>
90 The <filename>.exe</filename> and
91 <filename>.dll</filename> from a global read-only
92 Windows installation to be found by applications.
93 </para>
94 </listitem>
95 <listitem>
96 <para>
97 Some special <filename>.dll</filename> and
98 <filename>.exe</filename> files in the
99 <filename>windows\system</filename> directory, since
100 applications directly check for their presence.
101 </para>
102 </listitem>
103 <listitem>
104 <para>Some special program environment.</para>
105 </listitem>
106 </itemizedlist>
107 </listitem>
109 <listitem>
110 <para>Implementation</para>
112 <orderedlist inheritnum="inherit">
113 <listitem>
114 <para>Building the package</para>
115 <para>
116 WINE is configured the usual way (depending on your
117 build environment). The "prefix" is chosen using your
118 application placement policy
119 (<filename>/usr/</filename>,
120 <filename>/usr/X11R6/</filename>,
121 <filename>/opt/wine/</filename> or similar). The
122 configuration files (<filename>wine.conf</filename>,
123 <filename>wine.userreg</filename>,
124 <filename>wine.systemreg</filename>) are targeted for
125 <filename>/etc/wine/</filename> (rationale: FHS 2.0,
126 multiple readonly configuration files of a package).
127 </para>
128 <para>
129 Example (split this into <literal>%build</literal> and
130 <literal>%install</literal> section for
131 <command>rpm</command>):
132 </para>
133 <screen>
134 CFLAGS=$RPM_OPT_FLAGS \
135 ./configure --prefix=/usr/X11R6 --sysconfdir=/etc/wine/ --enable-dll
136 make
137 BR=$RPM_BUILD_ROOT
138 make install prefix=$BR/usr/X11R6/ sysconfdir=$BR/etc/wine/
139 install -d $BR/etc/wine/
140 install -m 644 wine.ini $BR/etc/wine/wine.conf
142 # Put all our dlls in a seperate directory. (this works only if
143 # you have a buildroot)
144 install -d $BR/usr/X11R6/lib/wine
145 mv $BR/usr/X11R6/lib/lib* $BR/usr/X11R6/lib/wine/
147 # the clipboard server is started on demand.
148 install -m 755 windows/x11drv/wineclipsrv $BR/usr/X11R6/bin/
150 # The WINE server is needed.
151 install -m 755 server/wineserver $BR/usr/X11R6/bin/
152 </screen>
153 <para>
154 Here we unfortunately do need to create
155 <filename>wineuser.reg</filename> and
156 <filename>winesystem.reg</filename> from the WINE
157 distributed <filename>winedefault.reg</filename>. This
158 can be done using <command>./regapi</command> once for
159 one example user and then reusing his
160 <filename>.wine/user.reg</filename> and
161 <filename>.wine/system.reg</filename> files.
162 <note>
163 <title>FIXME</title>
164 <para>this needs to be done better</para>
165 </note>
166 </para>
167 <screen>
168 install -m 644 wine.sytemreg $BR/etc/wine/
169 install -m 644 wine.userreg $BR/etc/wine/
170 </screen>
171 <para>
172 There are now a lot of libraries generated by the
173 build process, so a seperate library directory should
174 be used.
175 </para>
176 <screen>
177 install -d 755 $BR/usr/X11R6/lib/
178 mv $BR/
179 </screen>
180 <para>
181 You will need to package the files:
182 </para>
183 <screen>
184 $prefix/bin/wine, $prefix/bin/dosmod, $prefix/lib/wine/*
185 $prefix/man/man1/wine.1, $prefix/include/wine/*,
186 $prefix/bin/wineserver, $prefix/bin/wineclipsrv
188 %config /etc/wine/*
189 %doc ... choose from the toplevel directory and documentation/
190 </screen>
191 <para>
192 The post-install script:
193 </para>
194 <screen>
195 if ! grep -q /usr/X11R6/lib/wine /etc/ld.so.conf; then
196 echo "/usr/X11R6/lib/wine" &gt;&gt; /etc/ld.so.conf
198 /sbin/ldconfig
199 </screen>
200 <para>
201 The post-uninstall script:
202 </para>
203 <screen>
204 if [ "$1" = 0 ]; then
205 perl -ni -e 'print unless m:/usr/X11R6/lib/wine:;' /etc/ld.so.conf
207 /sbin/ldconfig
208 </screen>
209 </listitem>
210 <listitem>
211 <para>Creating a good default configuration file</para>
212 <para>
213 For the rationales of needing as less input from the
214 user as possible arises the need for a very good
215 configuration file. The one supplied with WINE is
216 currently lacking. We need:
217 </para>
218 <itemizedlist>
219 <listitem>
220 <para>
221 [Drive X]:
222 </para>
223 <itemizedlist>
224 <listitem>
225 <para>
226 A for the floppy. Specify your distributions
227 default floppy mountpoint here.
228 </para>
229 <programlisting>
230 Path=/auto/floppy
231 </programlisting>
232 </listitem>
233 <listitem>
234 <para>
235 C for the <filename>C:\</filename> directory.
236 Here we use the users homedirectory, for most
237 applications do see <filename>C:\</filename>
238 as root-writeable directory of every windows
239 installation and this basically is it in the
240 UNIX-user context.
241 </para>
242 <programlisting>
243 Path=${HOME}
244 </programlisting>
245 </listitem>
246 <listitem>
247 <para>
248 R for the CD-Rom drive. Specify your
249 distributions default CD-ROM drives mountpoint
250 here.
251 </para>
252 <programlisting>
253 Path=/auto/cdrom
254 </programlisting>
255 </listitem>
256 <listitem>
257 <para>
258 T for temporary storage. We do use
259 <filename>/tmp/</filename> (rationale: between
260 process temporary data belongs to
261 <filename>/tmp/</filename>, FHS 2.0)
262 </para>
263 </listitem>
264 <listitem>
265 <para>
266 W for the original Windows installation. This
267 drive points to the
268 <filename>windows\</filename> subdirectory of
269 the original windows installation. This avoids
270 problems with renamed
271 <filename>windows</filename> directories (as
272 for instance <filename>lose95</filename>,
273 <filename>win</filename> or
274 <filename>sys\win95</filename>). During
275 compile/package/install we leave this to be
276 <filename>/</filename>, it has to be
277 configured after the package install.
278 </para>
279 </listitem>
280 <listitem>
281 <para>
282 Z for the UNIX Root directory. This avoids any
283 problems with "could not find drive for
284 current directory" users occasionaly complain
285 about in the newsgroup and the ircchannel. It
286 also makes the whole directory structure
287 browseable. The type of Z should be network,
288 so applications expect it to be readonly.
289 </para>
290 <programlisting>
291 Path=/
292 </programlisting>
293 </listitem>
294 </itemizedlist>
295 </listitem>
296 <listitem>
297 <para>
298 [wine]:
299 </para>
300 <screen>
301 Windows=c:\windows\ (the windows/ subdirectory in the users
302 homedirectory)
303 System=c:\windows\system\ (the windows/system subdirectory in the users
304 homedirectory)
305 Path=c:\windows;c:\windows\system;c:\windows\system32;w:\;w:\system;w:\system32;
306 ; Using this trick we have in fact two windows installations in one, we
307 ; get the stuff from the readonly installation and can write to our own.
308 Temp=t:\ (the TEMP directory)
309 </screen>
310 </listitem>
311 <listitem>
312 <para>[Tweak.Layout]</para>
313 <screen>
314 WineLook=win95 (just the coolest look ;)
315 </screen>
316 </listitem>
317 <listitem>
318 <para>
319 Possibly modify the [spooler], [serialports] and
320 [parallelports] sections.
321 </para>
322 <note>
323 <title>FIXME</title>
324 <para>possibly more, including printer stuff.</para>
325 </note>
326 </listitem>
327 </itemizedlist>
329 <para>Add this prepared configuration file to the package.</para>
330 </listitem>
331 <listitem>
332 <para>Installing WINE for the system administrator</para>
333 <para>
334 Install the package using the usual packager
335 <command>rpm -i wine.rpm</command>. You may edit
336 <filename>/etc/wine/wine.conf</filename>, [Drive W],
337 to point to a possible windows installation right
338 after the install. That's it.
339 </para>
340 <para>
341 Note that on Linux you should somehow try to add the
342 <option>unhide</option> mount option (see <command>man
343 mount</command>) to the CD-ROM entry in
344 <filename>/etc/fstab</filename> during package
345 install, as several stupid Windows programs mark some
346 setup (!) files as hidden (ISO9660) on CD-ROMs, which
347 will greatly confuse users as they won't find their
348 setup files on the CD-ROMs as they were used on
349 Windows systems when <option>unhide</option> is not
350 set ;-\ And of course the setup program will complain
351 that <filename>setup.ins</filename> or some other mess
352 is missing... If you choose to do so, then please make
353 this change verbose to the admin.
354 </para>
355 </listitem>
356 <listitem>
357 <para>Installing WINE for the user</para>
358 <para>
359 The user will need to run a setup script before the
360 first invocation of WINE. This script should:
361 </para>
362 <itemizedlist>
363 <listitem>
364 <para>
365 Copy <filename>/etc/wine/wine.conf</filename> for
366 user modification.
367 </para>
368 </listitem>
369 <listitem>
370 <para>
371 Allow specification of the original windows
372 installation to use (which modifies the copied
373 <filename>wine.conf</filename> file).
374 </para>
375 </listitem>
376 <listitem>
377 <para>
378 Create the windows directory structure
379 (<filename>c:\windows</filename>,
380 <filename>c:\windows\system</filename>,
381 <filename>c:\windows\Start Menu\Programs</filename>,
382 <filename>c:\Program Files</filename>,
383 <filename>c:\Desktop</filename>, etc.)
384 </para>
385 </listitem>
386 <listitem>
387 <para>
388 Symlink all <filename>.dll</filename> and
389 <filename>.exe</filename> files from the original
390 windows installation to the
391 <filename>windows</filename> directory. Why? Some
392 programs reference "%windowsdir%/file.dll" or
393 "%systemdir%/file.dll" directly and fail if they
394 are not present.
395 </para>
396 <para>
397 This will give a huge number of symlinks, yes.
398 However, if an installer later overwrites on of
399 those files, it will overwrite the symlink (so
400 that the file now lies in the
401 <filename>windows/</filename> subdirectory).
402 </para>
403 <note>
404 <title>FIXME</title>
405 <para>Not sure this is needed for all files.</para>
406 </note>
407 </listitem>
408 <listitem>
409 <para>
410 On later invocation the script might want to
411 compare regular files in the users windows
412 directories and in the global windows directories
413 and replace same files by symlinks (to avoid
414 diskspace problems).
415 </para>
416 </listitem>
417 </itemizedlist>
418 </listitem>
419 </orderedlist>
420 </listitem>
421 </orderedlist>
423 <para>Done.</para>
425 <para>
426 This procedure requires:
427 </para>
429 <itemizedlist>
430 <listitem>
431 <para>Much thought and work from the packager (1x)</para>
432 </listitem>
433 <listitem>
434 <para>
435 No work for the sysadmin. Well except one <command>rpm
436 -i</command> and possible one edit of the configuration
437 file.
438 </para>
439 </listitem>
440 <listitem>
441 <para>
442 Some or no work from the user, except running the per-user
443 setup script once.
444 </para>
445 </listitem>
446 <listitem>
447 <para>It scales well and suffices most of the rationales.</para>
448 </listitem>
449 </itemizedlist>
452 <bridgehead>Sample <filename>wine.ini</filename> for OpenLinux 2.x:</bridgehead>
454 <programlisting>
456 ;; MS-DOS drives configuration
458 ;; Each section has the following format:
459 ;; [Drive X]
460 ;; Path=xxx (Unix path for drive root)
461 ;; Type=xxx (supported types are 'floppy', 'hd', 'cdrom' and 'network')
462 ;; Label=xxx (drive label, at most 11 characters)
463 ;; Serial=xxx (serial number, 8 characters hexadecimal number)
464 ;; Filesystem=xxx (supported types are 'msdos'/'dos'/'fat', 'win95'/'vfat', 'unix')
465 ;; This is the FS Wine is supposed to emulate on a certain
466 ;; directory structure.
467 ;; Recommended:
468 ;; - "win95" for ext2fs, VFAT and FAT32
469 ;; - "msdos" for FAT16 (ugly, upgrading to VFAT driver strongly recommended)
470 ;; DON'T use "unix" unless you intend to port programs using Winelib !
471 ;; Device=/dev/xx (only if you want to allow raw device access)
476 ; Floppy 'A' and 'B'
478 ; OpenLinux uses an automounter under /auto/, so we use that too.
480 [Drive A]
481 Path=/auto/floppy/
482 Type=floppy
483 Label=Floppy
484 Serial=87654321
485 Device=/dev/fd0
486 Filesystem=win95
489 ; Comment in ONLY if you have a second floppy or the automounter hangs
490 ; for 5 minutes.
492 ;[Drive B]
493 ;Path=/auto/floppy2/
494 ;Type=floppy
495 ;Label=Floppy
496 ;Serial=87654321
497 ;Device=/dev/fd1
498 ;Filesystem=win95
502 ; Drive 'C' links to the users homedirectory.
504 ; This must point to a writeable directory structure (not your readonly
505 ; mounted DOS partitions!) since programs want to dump stuff into
506 ; "Program Files/" "Programme/", "windows/", "windows/system/" etc.
508 ; The basic structure is set up using the config script.
510 [Drive C]
511 Path=${HOME}
512 Type=hd
513 Label=MS-DOS
514 Filesystem=win95
517 ; /tmp/ directory
519 ; The temp drive (and directory) points to /tmp/. Windows programs fill it
520 ; with junk, so it is approbiate.
522 [Drive T]
523 Path=/tmp
524 Type=hd
525 Label=Tmp Drive
526 Filesystem=win95
529 ; 'U'ser homedirectory
531 ; Just in case you want C:\ elsewhere.
533 [Drive U]
534 Path=${HOME}
535 Type=hd
536 Label=Home
537 Filesystem=win95
540 ; CD-'R'OM drive (automounted)
542 ; The default cdrom drive.
544 ; If an application (or game) wants a specific CD-ROM you might have to
545 ; temporary change the Label to the one of the CD itself.
547 ; How to read them is described in /usr/doc/wine-cvs-xxxxx/cdrom-labels.
549 [Drive R]
550 Path=/auto/cdrom
551 Type=cdrom
552 Label=CD-Rom
553 Filesystem=win95
556 ; The drive where the old windows installation resides (it points to the
557 ; windows/ subdirectory).
559 ; The Path is modified by the winesetup script.
561 [Drive W]
562 Path=/
563 Type=network
564 Label=Windows
565 Filesystem=win95
567 ; The UNIX Root directory, so all other programs and directories are reachable.
569 ; type network is used to tell programs to not write here.
571 [Drive Z]
572 Path=/
573 Type=network
574 Label=ROOT
575 Filesystem=win95
578 ; Standard Windows path entries. WINE will not work if they are incorrect.
580 [wine]
582 ; The windows/ directory. It must be writeable, for programs write into it.
584 Windows=c:\windows
586 ; The windows/system/ directory. It must be writeable, for especially setup
587 ; programs install dlls in there.
589 System=c:\windows\system
591 ; The temp directory. Should be cleaned regulary, since install programs leave
592 ; junk without end in there.
594 Temp=t:\
596 ; The dll search path. It should contain at least:
597 ; - the windows and the windows/system directory of the user.
598 ; - the global windows and windows/system directory (from a possible readonly
599 ; windows installation either on msdos filesystems or somewhere in the UNIX
600 ; directory tree)
601 ; - any other windows style directories you want to add.
603 Path=c:\windows;c:\windows\system;c:\windows\system32;t:\;w:\;w:\system;w:\system32
605 ; Outdated and no longer used. (but needs to be present).
607 SymbolTableFile=./wine.sym
609 # &lt;wineconf&gt;
612 ; Dll loadorder defaults. No need to modify.
614 [DllDefaults]
615 EXTRA_LD_LIBRARY_PATH=${HOME}/wine/cvs/lib
616 DefaultLoadOrder = native, elfdll, so, builtin
619 ; What 32/16 dlls belong to each other (context wise). No need to modify.
621 [DllPairs]
622 kernel = kernel32
623 gdi = gdi32
624 user = user32
625 commdlg = comdlg32
626 commctrl= comctl32
627 ver = version
628 shell = shell32
629 lzexpand= lz32
630 mmsystem= winmm
631 msvideo = msvfw32
632 winsock = wsock32
635 ; What type of dll to use in their respective loadorder.
637 [DllOverrides]
638 kernel32, gdi32, user32 = builtin
639 kernel, gdi, user = builtin
640 toolhelp = builtin
641 comdlg32, commdlg = elfdll, builtin, native
642 version, ver = elfdll, builtin, native
643 shell32, shell = builtin, native
644 lz32, lzexpand = builtin, native
645 commctrl, comctl32 = builtin, native
646 wsock32, winsock = builtin
647 advapi32, crtdll, ntdll = builtin, native
648 mpr, winspool = builtin, native
649 ddraw, dinput, dsound = builtin, native
650 winmm, mmsystem = builtin
651 msvideo, msvfw32 = builtin, native
652 mcicda.drv, mciseq.drv = builtin, native
653 mciwave.drv = builtin, native
654 mciavi.drv, mcianim.drv = native, builtin
655 w32skrnl = builtin
656 wnaspi32, wow32 = builtin
657 system, display, wprocs = builtin
658 wineps = builtin
661 ; Options section. Does not need to be edited.
663 [options]
664 ; allocate how much system colors on startup. No need to modify.
665 AllocSystemColors=100
668 ; Font specification. You usually do not need to edit this section.
670 ; Read documentation/fonts before adding aliases
672 [fonts]
673 ; The resolution defines what fonts to use (usually either 75 or 100 dpi fonts,
674 ; or nearest match).
675 Resolution = 96
676 ; Default font
677 Default = -adobe-times-
680 ; serial ports used by "COM1" "COM2" "COM3" "COM4". Useful for applications
681 ; that try to access serial ports.
683 [serialports]
684 Com1=/dev/ttyS0
685 Com2=/dev/ttyS1
686 Com3=/dev/modem,38400
687 Com4=/dev/modem
690 ; parallel port(s) used by "LPT1" etc. Useful for applications that try to
691 ; access these ports.
693 [parallelports]
694 Lpt1=/dev/lp0
697 ; What spooling program to use on printing.
698 ; Use "|program" or "filename", where the output will be dumped into.
700 [spooler]
701 LPT1:=|lpr
702 LPT2:=|gs -sDEVICE=bj200 -sOutputFile=/tmp/fred -q -
703 LPT3:=/dev/lp3
706 ; Allow port access to WINE started by the root user. Useful for some
707 ; supported devices, but it can make the system unstable.
708 ; Read /usr/doc/wine-cvs-xxxxx/ioport-trace-hints.
710 [ports]
711 ;read=0x779,0x379,0x280-0x2a0
712 ;write=0x779,0x379,0x280-0x2a0
714 ; debugging, not need to be modified.
715 [spy]
716 Exclude=WM_SIZE;WM_TIMER;
719 ; What names for the registry datafiles, no need to modify.
721 [Registry]
722 ; Paths must be given in /dir/dir/file.reg format.
723 ; Wine will not understand dos file names here...
724 ;UserFileName=xxx ; alternate registry file name (user.reg)
725 ;LocalMachineFileName=xxx ; (system.reg)
728 ; Layout/Look modifications. Here you can switch with a single line between
729 ; windows 3.1 and windows 95 style.
730 ; This does not change WINE behaviour or reported versions, just the look!
732 [Tweak.Layout]
733 ;; WineLook=xxx (supported styles are 'Win31'(default), 'Win95', 'Win98')
734 WineLook=Win95
737 ; What programs to start on WINE startup. (you should probably leave it empty)
739 [programs]
740 Default=
741 Startup=
743 ; defunct section.
744 [Console]
745 ;XtermProg=nxterm
746 ;InitialRows=25
747 ;InitialColumns=80
748 ;TerminalType=nxterm
750 # &lt;/wineconf&gt;
751 </programlisting>
752 </sect1>
753 </chapter>
755 <!-- Keep this comment at the end of the file
756 Local variables:
757 mode: sgml
758 sgml-parent-document:("wine-doc.sgml" "book" "part" "chapter" "")
759 End: