blob: 1f8fb56ef4c3a80e2ffa4f14e70a79fe2c5e365b [file] [log] [blame]
John R. Sheets1e8e5ba2000-08-08 01:24:00 +00001 <chapter id="packaging">
2 <title>Packaging Wine</title>
3
4 <sect1 id="distributing">
5 <title>A Small WINE Distribution Guide</title>
6
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>
13
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>
23
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>
32
33 <orderedlist>
34 <listitem>
35
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>
70
71 <para>
72 A WINE install needs:
73 </para>
74
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>
108
109 <listitem>
110 <para>Implementation</para>
111
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>
134CFLAGS=$RPM_OPT_FLAGS \
135./configure --prefix=/usr/X11R6 --sysconfdir=/etc/wine/ --enable-dll
136make
137BR=$RPM_BUILD_ROOT
138make install prefix=$BR/usr/X11R6/ sysconfdir=$BR/etc/wine/
139install -d $BR/etc/wine/
140install -m 644 wine.ini $BR/etc/wine/wine.conf
141
142# Put all our dlls in a seperate directory. (this works only if
143# you have a buildroot)
144install -d $BR/usr/X11R6/lib/wine
145mv $BR/usr/X11R6/lib/lib* $BR/usr/X11R6/lib/wine/
146
147# the clipboard server is started on demand.
148install -m 755 windows/x11drv/wineclipsrv $BR/usr/X11R6/bin/
149
150# The WINE server is needed.
151install -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>
168install -m 644 wine.sytemreg $BR/etc/wine/
169install -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>
177install -d 755 $BR/usr/X11R6/lib/
178mv $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
187
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>
195if ! grep -q /usr/X11R6/lib/wine /etc/ld.so.conf; then
196 echo "/usr/X11R6/lib/wine" &gt;&gt; /etc/ld.so.conf
197fi
198/sbin/ldconfig
199 </screen>
200 <para>
201 The post-uninstall script:
202 </para>
203 <screen>
204if [ "$1" = 0 ]; then
205 perl -ni -e 'print unless m:/usr/X11R6/lib/wine:;' /etc/ld.so.conf
206fi
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>
230Path=/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>
243Path=${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>
253Path=/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>
291Path=/
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>
328
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>
422
423 <para>Done.</para>
424
425 <para>
426 This procedure requires:
427 </para>
428
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>
450
451
452 <bridgehead>Sample <filename>wine.ini</filename> for OpenLinux 2.x:</bridgehead>
453
454 <programlisting>
455;;
456;; MS-DOS drives configuration
457;;
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)
472;;
473
474;
475;
476; Floppy 'A' and 'B'
477;
478; OpenLinux uses an automounter under /auto/, so we use that too.
479;
480[Drive A]
481Path=/auto/floppy/
482Type=floppy
483Label=Floppy
484Serial=87654321
485Device=/dev/fd0
486Filesystem=win95
487
488;
489; Comment in ONLY if you have a second floppy or the automounter hangs
490; for 5 minutes.
491;
492;[Drive B]
493;Path=/auto/floppy2/
494;Type=floppy
495;Label=Floppy
496;Serial=87654321
497;Device=/dev/fd1
498;Filesystem=win95
499
500
501;
502; Drive 'C' links to the users homedirectory.
503;
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.
507;
508; The basic structure is set up using the config script.
509;
510[Drive C]
511Path=${HOME}
512Type=hd
513Label=MS-DOS
514Filesystem=win95
515
516;
517; /tmp/ directory
518;
519; The temp drive (and directory) points to /tmp/. Windows programs fill it
520; with junk, so it is approbiate.
521;
522[Drive T]
523Path=/tmp
524Type=hd
525Label=Tmp Drive
526Filesystem=win95
527
528;
529; 'U'ser homedirectory
530;
531; Just in case you want C:\ elsewhere.
532;
533[Drive U]
534Path=${HOME}
535Type=hd
536Label=Home
537Filesystem=win95
538
539;
540; CD-'R'OM drive (automounted)
541;
542; The default cdrom drive.
543;
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.
546;
547; How to read them is described in /usr/doc/wine-cvs-xxxxx/cdrom-labels.
548;
549[Drive R]
550Path=/auto/cdrom
551Type=cdrom
552Label=CD-Rom
553Filesystem=win95
554
555;
556; The drive where the old windows installation resides (it points to the
557; windows/ subdirectory).
558;
559; The Path is modified by the winesetup script.
560;
561[Drive W]
562Path=/
563Type=network
564Label=Windows
565Filesystem=win95
566;
567; The UNIX Root directory, so all other programs and directories are reachable.
568;
569; type network is used to tell programs to not write here.
570;
571[Drive Z]
572Path=/
573Type=network
574Label=ROOT
575Filesystem=win95
576
577;
578; Standard Windows path entries. WINE will not work if they are incorrect.
579;
580[wine]
581;
582; The windows/ directory. It must be writeable, for programs write into it.
583;
584Windows=c:\windows
585;
586; The windows/system/ directory. It must be writeable, for especially setup
587; programs install dlls in there.
588;
589System=c:\windows\system
590;
591; The temp directory. Should be cleaned regulary, since install programs leave
592; junk without end in there.
593;
594Temp=t:\
595;
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.
602;
603Path=c:\windows;c:\windows\system;c:\windows\system32;t:\;w:\;w:\system;w:\system32
604;
605; Outdated and no longer used. (but needs to be present).
606;
607SymbolTableFile=./wine.sym
608
609# &lt;wineconf&gt;
610
611;
612; Dll loadorder defaults. No need to modify.
613;
614[DllDefaults]
615EXTRA_LD_LIBRARY_PATH=${HOME}/wine/cvs/lib
616DefaultLoadOrder = native, elfdll, so, builtin
617
618;
619; What 32/16 dlls belong to each other (context wise). No need to modify.
620;
621[DllPairs]
622kernel = kernel32
623gdi = gdi32
624user = user32
625commdlg = comdlg32
626commctrl= comctl32
627ver = version
628shell = shell32
629lzexpand= lz32
630mmsystem= winmm
631msvideo = msvfw32
632winsock = wsock32
633
634;
635; What type of dll to use in their respective loadorder.
636;
637[DllOverrides]
638kernel32, gdi32, user32 = builtin
639kernel, gdi, user = builtin
640toolhelp = builtin
641comdlg32, commdlg = elfdll, builtin, native
642version, ver = elfdll, builtin, native
643shell32, shell = builtin, native
644lz32, lzexpand = builtin, native
645commctrl, comctl32 = builtin, native
646wsock32, winsock = builtin
647advapi32, crtdll, ntdll = builtin, native
648mpr, winspool = builtin, native
649ddraw, dinput, dsound = builtin, native
650winmm, mmsystem = builtin
651msvideo, msvfw32 = builtin, native
652mcicda.drv, mciseq.drv = builtin, native
653mciwave.drv = builtin, native
654mciavi.drv, mcianim.drv = native, builtin
655w32skrnl = builtin
656wnaspi32, wow32 = builtin
657system, display, wprocs = builtin
658wineps = builtin
659
660;
661; Options section. Does not need to be edited.
662;
663[options]
664; allocate how much system colors on startup. No need to modify.
665AllocSystemColors=100
666
667;;
668; Font specification. You usually do not need to edit this section.
669;
670; Read documentation/fonts before adding aliases
671;
672[fonts]
673; The resolution defines what fonts to use (usually either 75 or 100 dpi fonts,
674; or nearest match).
675Resolution = 96
676; Default font
677Default = -adobe-times-
678
679;
680; serial ports used by "COM1" "COM2" "COM3" "COM4". Useful for applications
681; that try to access serial ports.
682;
683[serialports]
684Com1=/dev/ttyS0
685Com2=/dev/ttyS1
686Com3=/dev/modem,38400
687Com4=/dev/modem
688
689;
690; parallel port(s) used by "LPT1" etc. Useful for applications that try to
691; access these ports.
692;
693[parallelports]
694Lpt1=/dev/lp0
695
696;
697; What spooling program to use on printing.
698; Use "|program" or "filename", where the output will be dumped into.
699;
700[spooler]
701LPT1:=|lpr
702LPT2:=|gs -sDEVICE=bj200 -sOutputFile=/tmp/fred -q -
703LPT3:=/dev/lp3
704
705;
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.
709;
710[ports]
711;read=0x779,0x379,0x280-0x2a0
712;write=0x779,0x379,0x280-0x2a0
713
714; debugging, not need to be modified.
715[spy]
716Exclude=WM_SIZE;WM_TIMER;
717
718;
719; What names for the registry datafiles, no need to modify.
720;
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)
726
727;
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!
731;
732[Tweak.Layout]
733;; WineLook=xxx (supported styles are 'Win31'(default), 'Win95', 'Win98')
734WineLook=Win95
735
736;
737; What programs to start on WINE startup. (you should probably leave it empty)
738;
739[programs]
740Default=
741Startup=
742
743; defunct section.
744[Console]
745;XtermProg=nxterm
746;InitialRows=25
747;InitialColumns=80
748;TerminalType=nxterm
749
750# &lt;/wineconf&gt;
751 </programlisting>
752 </sect1>
753 </chapter>
754
755<!-- Keep this comment at the end of the file
756Local variables:
757mode: sgml
758sgml-parent-document:("wine-doc.sgml" "book" "part" "chapter" "")
759End:
760-->