Generate BEGIN_INTERFACE,END_INTERFACE macros instead of
[wine/wine64.git] / documentation / PACKAGING
blobba4d4f4ecba756098b686081b6273e5a936564aa
1 INTRODUCTION
2 ~~~~~~~~~~~~
4 This document attempts to establish guidelines for people making binary 
5 packages of Wine.
7 It expresses the basic principles that the Wine developers have agreed 
8 should be used when building Wine. It also attempts to highlight the areas
9 where there are different approaches to packaging Wine, so that the packager
10 can understand the different alternatives that have been considered and their 
11 rationales.
13 TERMS
14 ~~~~~
16 There are several terms and paths used in this document as place holders 
17 for configurable values. Those terms are described here.
18     * WINEPREFIX: is the user's Wine configuration directory.
19         This is almost always ~/.wine, but can be overridden by
20         the user by setting the WINEPREFIX environment variable.
22     * PREFIX: is the prefix used when selecting an installation target.
23         The current default is /usr/local. This results in binary 
24         installation into /usr/local/bin,  library installation into 
25         /usr/local/wine/lib, and so forth.
26         This value can be overridden by the packager. In fact, FHS 2.2
27         (http://www.pathname.com/fhs/) specifications suggest that a better
28         prefix is /opt/wine.  Ideally, a packager would also allow the 
29         installer to override this value.
31     * ETCDIR: is the prefix that Wine uses to find the global 
32         configuration directory. This can be changed by the configure 
33         option sysconfdir.  The current default is $PREFIX/etc.
35     * WINDOWSDIR: is an important concept to Wine.  This directory specifies
36         what directory corresponds to the root Windows directory
37         (e.g. C:\WINDOWS). This directory is specified by the user, in
38         the user's configuration file.  Generally speaking, this directory 
39         is either set to point at an empty directory, or it is set to point 
40         at a Windows partition that has been mounted through the vfat driver.
41         NOTE:   It is extremely important that the packager understand the 
42                 importance of WINDOWSDIR and convey this information and 
43                 choice to the end user.
45 DEPENDENCIES
46 ~~~~~~~~~~~~
48 There are two types of dependencies: hard and soft dependencies.
50 A hard dependency must be available at runtime for Wine to function,
51 if  compiled into the code. Soft dependencies on the other hand
52 will degrade gracefully at runtime if unavailable on the runtime system.
53 Ideally, we should eliminate all hard dependencies in favour of
54 soft dependencies.
56 To enable a soft dependency, it must be available at compile time.
57 As a packager, please do your best to make sure that as many soft 
58 dependencies  are available during compilation. Failing to have a 
59 soft dependency available means that users cannot benefit
60 from a Wine capability.
62 Here is a list of the soft dependencies. We suggest packagers
63 install each and every last of those before building the package. 
64 These libraries are not dependencies in the RPM sense. In DEB packages, 
65 they should appear as "Suggests" or "Recommends", as the case may be.
66     * FreeType: http://www.freetype.org
67       This library is used for direct rendering of fonts. It provides 
68       better support of fonts than using the X11 fonts engine. It is 
69       only needed for the X11 back end engine. Used from GDI.
71     * Alsa: "http://sourceforge.net/projects/alsa (Linux only)
72       This library gives sound support to the Windows environment.
74     * JACK: http://jackit.sourceforge.net
75       Similar to Alsa, it allow Wine to use the JACK audio server.
77     * CUPS: http://www.cups.org
78       This library allows Windows to see CUPS defined printers.
80     * OpenGL
81       This is used for both OpenGL and Direct3D (and some other 
82       DirectX functions as well) support in Wine. There are many many 
83       libraries for providing this functionality. It is enough for one
84       of them to be available when compiling Wine. Wine can work with 
85       any other library during runtime.
86       If no library is available, packagers are encouraged to compile 
87       Wine with Mesa3D (http://www.mesa3d.org), which requires no 
88       hardware support to install.
90 GOALS
91 ~~~~~
93 An installation from a Wine package should:
94     * Install quickly and simply:
95         The initial installation should require no user input.  An 
96                 'rpm -i wine.rpm' or 'apt-get install wine'
97         should suffice for initial installation.
98                 
99     * Work quickly and simply:
100         The user should be able to launch Solitaire
101         within minutes of downloading the Wine package.
102               
103     * Comply with Filesystem Hierarchy Standard
104         A Wine installation should, as much as possible, comply
105         with the FHS standard (http://www.pathname.com/fhs/).
106                 
107     * Preserve flexibility
108         None of the flexibility built into Wine should
109         be hidden from the end user.
111     * Easy configuration
112         Come as preconfigured as possible, so the user does
113         not need to change any configuration files.
115     * Small footprint
116         Use only as much diskspace as needed per user.
118     * Reduce support requirements.
119         A packaged version of Wine should be sufficiently easy to use and
120         have quick and easy access to FAQs and documentation such that 
121         requests to the newsgroup and development group go down.
122         Further, it should be easy for users to capture good bug reports.
124 REQUIREMENTS
125 ~~~~~~~~~~~~
127 Successfully installing Wine requires:
128     * Much thought and work from the packager (1x)
130     * A configuration file
131         Wine will not run without a configuration file.  Wine provides a
132         a sample config file and it can be found in documentation/samples.
133         Some packagers may attempt to provide (or dynamically generate) a 
134         default configuration file. Some packagers may wish to rely on 
135         winesetup to generate the configuration file.
137     * A writeable C drive
138         A writeable C:\ directory structure on a per-user basis. 
139         Applications do dump .ini file into C:\WINDOWS, installer
140         dump .exe/.dll/etc. files into C:\WINDOWS or C:\Program Files.
142     * An initial set of registry entries.
143         For custom changes to the default registry, tools/wine.inf
144         can be modified as needed. The current preferred method of 
145         configuring/installing Wine is to run /tools/wineinstall.  
146         There are several other choices that could be made; registries 
147         can be imported from a Windows partition.  At this time, Wine 
148         does not completely support a complex multi-user installation 
149         ala Windows NT, but it could fairly readily.
151      * Special files
152         Some special .dll and .exe files in the C:\WINDOWS\SYSTEM
153         directory, since applications directly check for their presence.
155 WINE COMPONENTS
156 ~~~~~~~~~~~~~~~
158    * Executable Files
159         - notepad : The windows Notepad replacement.
160         - progman : A Program Manager replacement.
161         - regedit : A graphical tool to edit your registry or for 
162                 important a windows registry to Wine.
163         - regsvr32 : A program to register/unregister .DLL's and .OCX files. 
164                 Only works on those dlls that can self-register.
165         - taskmgr : A clone of the windows taskmgr, used for debugging and
166                 managing running Windows and Winlib processes.
167         - uninstaller: A program to uninstall installed Windows programs. 
168                 Like the Add/Remove Program in the windows control panel.
169         - wcmd :  Wine's command line interpreter, a cmd.exe replacement.
170         - widl : Wine IDL compiler compiles (MS-RPC and DCOM) Interface 
171                 Definition Language files.
172         - wine :  The main Wine executable. This program will load a Windows 
173                 binary and run it, relying upon the Wine shared object libraries.
174         - wineboot : This program is executed on startup of the first wine 
175                 process of a particular user.wineboot won't automatically run 
176                 when needed.  Currently you have to manually run it after you 
177                 install something.
178         - winebuild : Winebuild is a tool used for building Winelib applications 
179                 (and by Wine itself) to allow a developer to compile a .spec file 
180                 into a .spec.c file.
181         - wineclipserv : The Wine Clipboard Server is a standalone XLib application
182                 whose purpose is to manage the X selection when Wine exits.
183         - wineconsole : Render the output of CUI programs.
184         - winedbg : A application making use of the debugging API to allow 
185                 debugging of Wine or Winelib applications as well as Wine itself 
186                 (kernel and all DLLs).
187         - winedump : Dumps the imports and exports of NE and PE files.
188         - winefile : A clone of the win3x filemanager.
189         - winegcc/wineg++: Wrappers for gcc/g++ respectively, to make them behave 
190                 as MinGW's gcc. Used for porting apps over to Winelib.
191         - winemaker : Winemaker is a perl script which is designed to help you 
192                 bootstrap the conversion of your Windows projects to Winelib. 
193         - winemine :  A clone of "Windows Minesweeper" a demo WineLib app.
194         - winepath :  A tool for converting between Windows paths and Unix paths 
195         - wineserver : The Wine server is the process that manages resources, 
196                 coordinates threads, and provides synchronization and interprocess 
197                 communication primitives to Wine processes.
198         - wineshelllink : This shell script can be called by Wine in order to 
199                 propagate Desktop icon and menu creation requests out to a 
200                 GNOME or KDE (or other Window Managers).
201         - winewrap : Takes care of linking winelib applications. Linking with 
202                 Winelib is a complex process, winewrap makes it simple.
203         - winhelp : A Windows Help replacement.
204         - wmc : Wine Message Compiler it allows Windows message files to be 
205                 compiled into a format usable by Wine.
206         - wrc : the Wine Resource Compiler. A clone of Microsoft's rc.
208     * Shared Object Library Files
209         To obtain a current list of DLLs, run:
210                 ls dlls/*.so
211         it the root of the Wine _build_ tree, after a successful build.
213     * Man Pages
214         To obtain a current list of man files that need to be installed, run:
215                 find . -name "*.man"
216         it the root of the Wine _build_ tree, after you have run ./configure.
218     * Include Files
219         An up to date list of includes can be found in the include/Makefile.in file.
221     * Documentation files
222         After building the documentation with:
223                 cd documentation; make html
224         install all the files from: wine-user/, wine-devel/ and winelib-user/.
226      * Dynamic Wine Files
227         Wine also generates and depends on a number of dynamic
228         files, including user configuration files and registry files.
230         At the time of this writing, there was not a clear
231         consensus of where these files should be located, and how
232         they should be handled.  This section attempts
233         to explain the alternatives clearly.
235         - WINEPREFIX/config
236             This file is the user local Wine configuration file.
237             At the time of this writing, if this file exists,
238             then no other configuration file is loaded.
240         - ETCDIR/wine.conf
241             This is the global Wine configuration file. It is only used
242             if the user running Wine has no local configuration file.
243             Global wine configuration is currently not possible;
244             this might get reenabled at some time.
245             Some packagers feel that this file should not be supplied, 
246             and that only a wine.conf.default should be given here.
247             Other packagers feel that this file should be the predominant
248             file used, and that users should only shift to a local 
249             configuration file if they need to.  An argument has been
250             made that the local configuration file should inherit the 
251             global configuration file.  At this time, Wine does not do this;
252             please refer to the WineHQ discussion archives for the debate 
253             concerning this.
254             This debate is addressed more completely below, in the
255             'Packaging Strategy' section.
257     * Registry Files
258             In order to replicate the Windows registry system,
259             Wine stores registry entries in a series of files.
261             For an excellent overview of this issue, read this
262             http://www.winehq.org/News/2000-25.html#FTR
263             Wine Weekly News feature.
265             The bottom line is that, at Wine server startup,
266             Wine loads all registry entries into memory
267             to create an in memory image of the registry.
268             The order of files which Wine uses to load
269             registry entries is extremely important,
270             as it affects what registry entries are
271             actually present.  The order is roughly that
272             .dat files from a Windows partion are loaded,
273             then global registry settings from ETCDIR,
274             and then finally local registry settings are
275             loaded from WINEPREFIX.  As each set are loaded,
276             they can override the prior entries.  Thus,
277             the local registry files take precedence.
279             Then, at exit (or at periodic intervals),
280             Wine will write either all registry entries
281             (or, with the default setting) changed
282             registry entries to files in the WINEPREFIX.
284             - WINEPREFIX/system.reg
285                 This file contains the user's local copy of the 
286                 HKEY_LOCAL_MACHINE registry hive.  In general use, it will
287                 contain only changes made to the default registry values.
289             - WINEPREFIX/user.reg
290                 This file contains the user's local copy of the 
291                 HKEY_CURRENT_MACHINE registry hive.  In general use, it will
292                 contain only changes made to the default registry values.
294             - WINEPREFIX/userdef.reg
295                 This file contains the user's local copy of the 
296                 HKEY_USERS\.Default registry hive.  In general use, it will
297                 contain only changes made to the default registry values.
299             - WINEPREFIX/cachedmetrics.[display]
300                 This file contains font metrics for the given X display.
301                 Generally, this cache is generated once at Wine start time.
302                 cachedmetrics can be generated if absent. 
303                 You should note this can take a long time.
305             - ETCDIR/wine.systemreg 
306                 This file contains the global values for HKEY_LOCAL_MACHINE. 
307                 The values in this file can be overridden by the user's 
308                 local settings. The location of this directory is hardcoded 
309                 within wine, generally to /etc. 
311             - ETCDIR/wine.userreg
312                 This file contains the global values for HKEY_USERS.  
313                 The values in this file can be overridden by the user's 
314                 local settings.  This file is likely to be deprecated in
315                 favor of a global wine.userdef.reg that will only contain 
316                 HKEY_USERS/.Default.
318     * Important Files from a Windows Partition
319         Wine has the ability to use files from an installation of the
320         actual Microsoft Windows operating system.  Generally these
321         files are loaded on a VFAT partition that is mounted under Linux.
323         This is probably the most important configuration detail.
324         The use of Windows registry and DLL files dramatically alters the 
325         behaviour of Wine. If nothing else, pacakager have to make this 
326         distinction clear to the end user, so that they can intelligently
327         choose their configuration.
329         - WINDOWSDIR/system32/system.dat
330         - WINDOWSDIR/system32/user.dat
331         - WINDOWSDIR/win.ini
333     * Windows Dynamic Link Libraries (WINDOWSDIR/system32/*.dll)
334         Wine has the ability to use the actual Windows DLL files
335         when running an application.  An end user can configure
336         Wine so that Wine uses some or all of these DLL files
337         when running a given application.
339 PACKAGING STRATEGIES
340 ~~~~~~~~~~~~~~~~~~~~
342 There has recently been a lot of discussion on the Wine
343 development mailing list about the best way to build Wine packages.
345 There was a lot of discussion, and several diverging points of view.
346 This section of the document attempts to present the areas of common 
347 agreement, and also to present the different approaches advocated on 
348 the mailing list.
350     * Distribution of Wine into packages
351         The most basic question to ask is given the Wine CVS tree,
352         what physical files are you, the packager, going to produce?
353         Are you going to produce only a wine.rpm (as Marcus has done),
354         or are you going to produce 6 Debian files (libwine, libwine-dev,
355         wine, wine-doc, wine-utils and winesetuptk) as Ove has done?
356         At this point, common practice is to adopt to the conventions
357         of the targeted distribution. 
359     * Where to install files
360         This question is not really contested.  It will vary
361         by distribution, and is really up to the packager.
362         As a guideline, the current 'make install' process
363         seems to behave such that if we pick a single PREFIX then:
364             - binary files go into PREFIX/bin
365             - library files go into PREFIX/lib/wine
366             - include files go into PREFIX/include/wine
367             - man pages go into PREFIX/share/man
368             - documentation files go into PREFIX/share/doc/wine-VERSION
370         You might also want to use the wine wrapper script winelauncher
371         that can be found in tools/ directory, as it has several important
372         advantages over directly invoking the wine binary.
373         See the Executable Files section for details.
375     * The question of /opt/wine
376         The FHS 2.2 specification suggests that Wine as a package
377         should be installed to /opt/wine.  None of the existing packages 
378         follow this guideline (today; check again tomorrow).
380     * What files to create
381         After installing the static and shareable files, the next
382         question the packager needs to ask is how much dynamic
383         configuration will be done, and what configuration
384         files should be created.
385         There are several approaches to this:
386             - Rely completely on user file space - install nothing
387                 This approach relies upon the new winesetup utility
388                 and the new ability of Wine to launch winesetup if no
389                 configuration file is found.  The basic concept is
390                 that no global configuration files are created at
391                 install time.  Instead, Wine configuration files are
392                 created on the fly by the winesetup program when Wine
393                 is invoked.  Further, winesetup creates default
394                 Windows directories and paths that are stored
395                 completely in the user's WINEPREFIX.  This approach
396                 has the benefit of simplicity in that all Wine files
397                 are either stored under /opt/wine or under ~/.wine.
398                 Further, there is only ever one Wine configuration
399                 file.  This approach, however, adds another level of
400                 complexity.  It does not allow Wine to run Solitaire
401                 'out of the box'; the user must run the configuration
402                 program first.  Further, winesetup requires Tcl/Tk, a
403                 requirement not beloved by some.  Additionally, this
404                 approach closes the door on multi user configurations
405                 and presumes a single user approach.
407             - Build a reasonable set of defaults for the global wine.conf,
408               facilitate creation of a user's local Wine configuration.
409                 This approach, best shown by Marcus, causes the
410                 installation process to auto scan the system,
411                 and generate a global wine.conf file with best
412                 guess defaults.  The OpenLinux packages follow
413                 this behaviour.
414                 The keys to this approach are always putting
415                 an existing Windows partition into the
416                 path, and being able to run Solitaire
417                 right out of the box.
418                 Another good thing that Marcus does is he
419                 detects a first time installation and
420                 does some clever things to improve the
421                 user's Wine experience.
422                 A flaw with this approach, however, is it doesn't
423                 give the user an obvious way to choose not to
424                 use a Windows partition.
426             - Build a reasonable set of defaults for the global wine.conf,
427               and ask the user if possible
428                 This approach, demonstrated by Ove, causes the
429                 installation process to auto scan the system,
430                 and generate a global wine.conf file with best
431                 guess defaults.  Because Ove built a Debian
432                 package, he was able to further query debconf and
433                 get permission to ask the user some questions,
434                 allowing the user to decide whether or not to
435                 use a Windows partition.
437 IMPLEMENTATION
438 ~~~~~~~~~~~~~~
440 This section discusses the implementation of a Red Hat 8.0 .spec file.
441 For a current .spec file, please refer to any one of the existing SRPMs.
443 1. Building the package
445 Wine is configured the usual way (depending on your build environment). 
446 The PREFIX is chosen using your application placement policy
447 (/usr/, /usr/X11R6/, /opt/wine/, or similar).  The configuration files
448 (wine.conf, wine.userreg, wine.systemreg) are targeted for /etc/wine/
449 (rationale: FHS 2.2, multiple readonly configuration files of a package).
451 Example (split this into %build and %install section for rpm:
454         CFLAGS=$RPM_OPT_FLAGS ./configure --prefix=/usr/X11R6 --sysconfdir=/etc/wine/ --enable-dll
455         make
456         BR=$RPM_BUILD_ROOT
457         make install prefix=$BR/usr/X11R6/ sysconfdir=$BR/etc/wine/
458         install -d $BR/etc/wine/
459         install -m 644 wine.ini $BR/etc/wine/wine.conf
461         # Put all our DLLs in a separate directory. (this works only if you have a buildroot)
462         install -d $BR/usr/X11R6/lib/wine
463         mv $BR/usr/X11R6/lib/lib* $BR/usr/X11R6/lib/wine/
465         # the clipboard server is started on demand.
466         install -m 755 dlls/x11drv/wineclipsrv $BR/usr/X11R6/bin/
468         # The Wine server is needed.
469         install -m 755 server/wineserver $BR/usr/X11R6/bin/
472 There are now a lot of libraries generated by the build process, so a 
473 separate library directory should be used.
475         install -d 755 $BR/usr/X11R6/lib/
476         mv $BR/
477         
478 You will need to package the files:
480         $prefix/bin/wine, $prefix/bin/dosmod, $prefix/lib/wine/*
481         $prefix/man/man1/wine.1, $prefix/include/wine/*,
482         $prefix/bin/wineserver, $prefix/bin/wineclipsrv
484         %config /etc/wine/*
485         %doc ... choose from the toplevel directory and documentation/
487 The post-install script:
489         if ! grep /usr/X11R6/lib/wine /etc/ld.so.conf >/dev/null; then
490             echo "/usr/X11R6/lib/wine" >> /etc/ld.so.conf
491         fi
492         /sbin/ldconfig
494 The post-uninstall script:
496         if [ "$1" = 0 ]; then
497             perl -ni -e 'print unless m:/usr/X11R6/lib/wine:;' /etc/ld.so.conf
498         fi
499         /sbin/ldconfig
501 2. Creating a good default configuration file. 
503 For the rationales of needing as less input from the user as possible arises 
504 the need for a very good configuration file. The one supplied with Wine is 
505 currently lacking. We need:
507     * [Drive X]: 
508         - A for the floppy. Specify your distribution's default floppy mountpoint.
509                 Path=/auto/floppy
510         - C for the C:\ directory. Here we use the user's home directory, for most
511           applications do see C:\ as root-writeable directory of every windows
512           installation and this basically is it in the UNIX-user context.
513           Don't forget to identify environment variables as DOS ones (ie, surrounded by '%').
514                 Path=%HOME%
515         - R for the CD-Rom drive. Specify your distribution's default CD-ROM mountpoint.
516                 Path=/auto/cdrom
517         - T for temporary storage. We do use /tmp/ (rationale: between process 
518           temporary data belongs to /tmp/ , FHS 2.0)
519                 Path=/tmp/
520         - W for the original Windows installation. This drive points to the
521           WINDOWSDIR subdirectory of the original windows installation.
522           This avoids problems with renamed WINDOWSDIR directories (as for 
523           instance lose95, win or sys\win95). During compile/package/install
524           we leave this to be / , it has to be configured after the package install.
525         - Z for the UNIX Root directory. This avoids any roblems with 
526           "could not find drive for current directory" users occasionally complain
527           about in the newsgroup and the irc channel. It also makes the whole 
528           directory structure browseable. The type of Z should be network,
529           so applications expect it to be readonly.
530                 Path=/
531           
532     * [wine]:
533         Windows=c:\windows\             (the windows/ subdirectory in the user's
534                                  home directory)
535         System=c:\windows\system\       (the windows/system subdirectory in the user's
536                                          home directory)
537         Path=c:\windows;c:\windows\system;c:\windows\system32;w:\;w:\system;w:\system32;
538         ; Using this trick we have in fact two windows installations in one, we
539         ; get the stuff from the readonly installation and can write to our own.
540         Temp=t:\                        (the TEMP directory)
542     * Possibly modify the [spooler], [serialports] and [parallelports] sections.
543       FIXME: possibly more, including printer stuff.
545 Add this prepared configuration file to the package.
547 3. Installing Wine for the system administrator
548                 
549 Install the package using the usual packager 'rpm -i wine.rpm'.
550 You may edit /etc/wine/wine.conf , [Drive W], to point to a
551 possible Windows installation right after the install. That's it.
553 Note that on Linux you should somehow try to add the unhide mount optioni
554 (see 'man mount') to the CD-ROM entry in /etc/fstab during package install,
555 as several stupid Windows programs mark some setup (!) files as hidden 
556 (ISO9660) on CD-ROMs, which will greatly confuse users as they won't find 
557 their setup files on the CD-ROMs as they were used on Windows systems when
558 unhide is not set ;-\ And of course the setup program will complain
559 that setup.ins or some other mess is missing... If you choose to do so, 
560 then please make this change verbose to the admin.
562 Also make sure that the kernel you use includes the Joliet CD-ROM support, 
563 for the very same reasons as given above (no long filenames due to missing 
564 Joliet, files not found).
565               
566 4. Installing Wine for the user
568 The user will need to run a setup script before the first invocation of Wine. 
569 This script should:
570     * Copy /etc/wine/wine.conf for user modification.
571     * Allow specification of the original windows installation to use
572       (which modifies the copied wine.conf file).
573     * Create the windows directory structure (c:\windows, c:\windows\system,
574       c:\windows\Start Menu\Programs, c:\Program Files, c:\Desktop, etc.)
575     * Symlink all .dll and .exe files from the original windows installation
576       to the windows directory. Why? Some programs reference 
577       "%windowsdir%/file.dll" or "%systemdir%/file.dll" directly and fail
578       if they are not present.  This will give a huge number of symlinks, yes.
579       However, if an installer later overwrites one of those files, it will 
580       overwrite the symlink (so that the file now lies in the windows/
581       subdirectory). FIXME: Not sure this is needed for all files.
582     * On later invocation the script might want to compare regular files in 
583       the user's windows directories and in the global windows directories
584       and replace same files by symlinks (to avoid diskspace problems).
585     
586 AUTHORS
587 ~~~~~~~
589 Written in 1999 by Marcus Meissner <marcus@jet.franken.de>
590 Updated in 2000 by Jeremy White <jwhite@codeweavers.com>
591 Updated in 2002 by Andreas Mohr <andi@rhlx01.fht-esslingen.de>
592 Updated in 2003 by Tom Wickline <twickline2@triad.rr.com>
593 Updated in 2003 by Dimitrie O. Paun <dpaun@rogers.com>