Define _WIN32_WINNT and _WIN32_IE versions for MS_VC Build.
[wine/wine64.git] / documentation / PACKAGING
bloba1eb1ef6104428f222fe82ae5bbb539f1da08607
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         - wineconsole : Render the output of CUI programs.
182         - winedbg : A application making use of the debugging API to allow 
183                 debugging of Wine or Winelib applications as well as Wine itself 
184                 (kernel and all DLLs).
185         - winedump : Dumps the imports and exports of NE and PE files.
186         - winefile : A clone of the win3x filemanager.
187         - winegcc/wineg++: Wrappers for gcc/g++ respectively, to make them behave 
188                 as MinGW's gcc. Used for porting apps over to Winelib.
189         - winemaker : Winemaker is a perl script which is designed to help you 
190                 bootstrap the conversion of your Windows projects to Winelib. 
191         - winemine :  A clone of "Windows Minesweeper" a demo WineLib app.
192         - winepath :  A tool for converting between Windows paths and Unix paths 
193         - wineserver : The Wine server is the process that manages resources, 
194                 coordinates threads, and provides synchronization and interprocess 
195                 communication primitives to Wine processes.
196         - wineshelllink : This shell script can be called by Wine in order to 
197                 propagate Desktop icon and menu creation requests out to a 
198                 GNOME or KDE (or other Window Managers).
199         - winewrap : Takes care of linking winelib applications. Linking with 
200                 Winelib is a complex process, winewrap makes it simple.
201         - winhelp : A Windows Help replacement.
202         - wmc : Wine Message Compiler it allows Windows message files to be 
203                 compiled into a format usable by Wine.
204         - wrc : the Wine Resource Compiler. A clone of Microsoft's rc.
206     * Shared Object Library Files
207         To obtain a current list of DLLs, run:
208                 ls dlls/*.so
209         it the root of the Wine _build_ tree, after a successful build.
211     * Man Pages
212         To obtain a current list of man files that need to be installed, run:
213                 find . -name "*.man"
214         it the root of the Wine _build_ tree, after you have run ./configure.
216     * Include Files
217         An up to date list of includes can be found in the include/Makefile.in file.
219     * Documentation files
220         After building the documentation with:
221                 cd documentation; make html
222         install all the files from: wine-user/, wine-devel/ and winelib-user/.
224      * Dynamic Wine Files
225         Wine also generates and depends on a number of dynamic
226         files, including user configuration files and registry files.
228         At the time of this writing, there was not a clear
229         consensus of where these files should be located, and how
230         they should be handled.  This section attempts
231         to explain the alternatives clearly.
233         - WINEPREFIX/config
234             This file is the user local Wine configuration file.
235             At the time of this writing, if this file exists,
236             then no other configuration file is loaded.
238         - ETCDIR/wine.conf
239             This is the global Wine configuration file. It is only used
240             if the user running Wine has no local configuration file.
241             Global wine configuration is currently not possible;
242             this might get reenabled at some time.
243             Some packagers feel that this file should not be supplied, 
244             and that only a wine.conf.default should be given here.
245             Other packagers feel that this file should be the predominant
246             file used, and that users should only shift to a local 
247             configuration file if they need to.  An argument has been
248             made that the local configuration file should inherit the 
249             global configuration file.  At this time, Wine does not do this;
250             please refer to the WineHQ discussion archives for the debate 
251             concerning this.
252             This debate is addressed more completely below, in the
253             'Packaging Strategy' section.
255     * Registry Files
256             In order to replicate the Windows registry system,
257             Wine stores registry entries in a series of files.
259             For an excellent overview of this issue, read this
260             http://www.winehq.org/News/2000-25.html#FTR
261             Wine Weekly News feature.
263             The bottom line is that, at Wine server startup,
264             Wine loads all registry entries into memory
265             to create an in memory image of the registry.
266             The order of files which Wine uses to load
267             registry entries is extremely important,
268             as it affects what registry entries are
269             actually present.  The order is roughly that
270             .dat files from a Windows partion are loaded,
271             then global registry settings from ETCDIR,
272             and then finally local registry settings are
273             loaded from WINEPREFIX.  As each set are loaded,
274             they can override the prior entries.  Thus,
275             the local registry files take precedence.
277             Then, at exit (or at periodic intervals),
278             Wine will write either all registry entries
279             (or, with the default setting) changed
280             registry entries to files in the WINEPREFIX.
282             - WINEPREFIX/system.reg
283                 This file contains the user's local copy of the 
284                 HKEY_LOCAL_MACHINE registry hive.  In general use, it will
285                 contain only changes made to the default registry values.
287             - WINEPREFIX/user.reg
288                 This file contains the user's local copy of the 
289                 HKEY_CURRENT_MACHINE registry hive.  In general use, it will
290                 contain only changes made to the default registry values.
292             - WINEPREFIX/userdef.reg
293                 This file contains the user's local copy of the 
294                 HKEY_USERS\.Default registry hive.  In general use, it will
295                 contain only changes made to the default registry values.
297             - WINEPREFIX/cachedmetrics.[display]
298                 This file contains font metrics for the given X display.
299                 Generally, this cache is generated once at Wine start time.
300                 cachedmetrics can be generated if absent. 
301                 You should note this can take a long time.
303             - ETCDIR/wine.systemreg 
304                 This file contains the global values for HKEY_LOCAL_MACHINE. 
305                 The values in this file can be overridden by the user's 
306                 local settings. The location of this directory is hardcoded 
307                 within wine, generally to /etc. 
309             - ETCDIR/wine.userreg
310                 This file contains the global values for HKEY_USERS.  
311                 The values in this file can be overridden by the user's 
312                 local settings.  This file is likely to be deprecated in
313                 favor of a global wine.userdef.reg that will only contain 
314                 HKEY_USERS/.Default.
316     * Important Files from a Windows Partition
317         Wine has the ability to use files from an installation of the
318         actual Microsoft Windows operating system.  Generally these
319         files are loaded on a VFAT partition that is mounted under Linux.
321         This is probably the most important configuration detail.
322         The use of Windows registry and DLL files dramatically alters the 
323         behaviour of Wine. If nothing else, pacakager have to make this 
324         distinction clear to the end user, so that they can intelligently
325         choose their configuration.
327         - WINDOWSDIR/system32/system.dat
328         - WINDOWSDIR/system32/user.dat
329         - WINDOWSDIR/win.ini
331     * Windows Dynamic Link Libraries (WINDOWSDIR/system32/*.dll)
332         Wine has the ability to use the actual Windows DLL files
333         when running an application.  An end user can configure
334         Wine so that Wine uses some or all of these DLL files
335         when running a given application.
337 PACKAGING STRATEGIES
338 ~~~~~~~~~~~~~~~~~~~~
340 There has recently been a lot of discussion on the Wine
341 development mailing list about the best way to build Wine packages.
343 There was a lot of discussion, and several diverging points of view.
344 This section of the document attempts to present the areas of common 
345 agreement, and also to present the different approaches advocated on 
346 the mailing list.
348     * Distribution of Wine into packages
349         The most basic question to ask is given the Wine CVS tree,
350         what physical files are you, the packager, going to produce?
351         Are you going to produce only a wine.rpm (as Marcus has done),
352         or are you going to produce 6 Debian files (libwine, libwine-dev,
353         wine, wine-doc, wine-utils and winesetuptk) as Ove has done?
354         At this point, common practice is to adopt to the conventions
355         of the targeted distribution. 
357     * Where to install files
358         This question is not really contested.  It will vary
359         by distribution, and is really up to the packager.
360         As a guideline, the current 'make install' process
361         seems to behave such that if we pick a single PREFIX then:
362             - binary files go into PREFIX/bin
363             - library files go into PREFIX/lib/wine
364             - include files go into PREFIX/include/wine
365             - man pages go into PREFIX/share/man
366             - documentation files go into PREFIX/share/doc/wine-VERSION
368         You might also want to use the wine wrapper script winelauncher
369         that can be found in tools/ directory, as it has several important
370         advantages over directly invoking the wine binary.
371         See the Executable Files section for details.
373     * The question of /opt/wine
374         The FHS 2.2 specification suggests that Wine as a package
375         should be installed to /opt/wine.  None of the existing packages 
376         follow this guideline (today; check again tomorrow).
378     * What files to create
379         After installing the static and shareable files, the next
380         question the packager needs to ask is how much dynamic
381         configuration will be done, and what configuration
382         files should be created.
383         There are several approaches to this:
384             - Rely completely on user file space - install nothing
385                 This approach relies upon the new winesetup utility
386                 and the new ability of Wine to launch winesetup if no
387                 configuration file is found.  The basic concept is
388                 that no global configuration files are created at
389                 install time.  Instead, Wine configuration files are
390                 created on the fly by the winesetup program when Wine
391                 is invoked.  Further, winesetup creates default
392                 Windows directories and paths that are stored
393                 completely in the user's WINEPREFIX.  This approach
394                 has the benefit of simplicity in that all Wine files
395                 are either stored under /opt/wine or under ~/.wine.
396                 Further, there is only ever one Wine configuration
397                 file.  This approach, however, adds another level of
398                 complexity.  It does not allow Wine to run Solitaire
399                 'out of the box'; the user must run the configuration
400                 program first.  Further, winesetup requires Tcl/Tk, a
401                 requirement not beloved by some.  Additionally, this
402                 approach closes the door on multi user configurations
403                 and presumes a single user approach.
405             - Build a reasonable set of defaults for the global wine.conf,
406               facilitate creation of a user's local Wine configuration.
407                 This approach, best shown by Marcus, causes the
408                 installation process to auto scan the system,
409                 and generate a global wine.conf file with best
410                 guess defaults.  The OpenLinux packages follow
411                 this behaviour.
412                 The keys to this approach are always putting
413                 an existing Windows partition into the
414                 path, and being able to run Solitaire
415                 right out of the box.
416                 Another good thing that Marcus does is he
417                 detects a first time installation and
418                 does some clever things to improve the
419                 user's Wine experience.
420                 A flaw with this approach, however, is it doesn't
421                 give the user an obvious way to choose not to
422                 use a Windows partition.
424             - Build a reasonable set of defaults for the global wine.conf,
425               and ask the user if possible
426                 This approach, demonstrated by Ove, causes the
427                 installation process to auto scan the system,
428                 and generate a global wine.conf file with best
429                 guess defaults.  Because Ove built a Debian
430                 package, he was able to further query debconf and
431                 get permission to ask the user some questions,
432                 allowing the user to decide whether or not to
433                 use a Windows partition.
435 IMPLEMENTATION
436 ~~~~~~~~~~~~~~
438 This section discusses the implementation of a Red Hat 8.0 .spec file.
439 For a current .spec file, please refer to any one of the existing SRPMs.
441 1. Building the package
443 Wine is configured the usual way (depending on your build environment). 
444 The PREFIX is chosen using your application placement policy
445 (/usr/, /usr/X11R6/, /opt/wine/, or similar).  The configuration files
446 (wine.conf, wine.userreg, wine.systemreg) are targeted for /etc/wine/
447 (rationale: FHS 2.2, multiple readonly configuration files of a package).
449 Example (split this into %build and %install section for rpm:
452         CFLAGS=$RPM_OPT_FLAGS ./configure --prefix=/usr/X11R6 --sysconfdir=/etc/wine/ --enable-dll
453         make
454         BR=$RPM_BUILD_ROOT
455         make install prefix=$BR/usr/X11R6/ sysconfdir=$BR/etc/wine/
456         install -d $BR/etc/wine/
457         install -m 644 wine.ini $BR/etc/wine/wine.conf
459         # Put all our DLLs in a separate directory. (this works only if you have a buildroot)
460         install -d $BR/usr/X11R6/lib/wine
461         mv $BR/usr/X11R6/lib/lib* $BR/usr/X11R6/lib/wine/
463         # The Wine server is needed.
464         install -m 755 server/wineserver $BR/usr/X11R6/bin/
467 There are now a lot of libraries generated by the build process, so a 
468 separate library directory should be used.
470         install -d 755 $BR/usr/X11R6/lib/
471         mv $BR/
472         
473 You will need to package the files:
475         $prefix/bin/wine, $prefix/lib/wine/*
476         $prefix/man/man1/wine.1, $prefix/include/wine/*,
477         $prefix/bin/wineserver
479         %config /etc/wine/*
480         %doc ... choose from the toplevel directory and documentation/
482 The post-install script:
484         if ! grep /usr/X11R6/lib/wine /etc/ld.so.conf >/dev/null; then
485             echo "/usr/X11R6/lib/wine" >> /etc/ld.so.conf
486         fi
487         /sbin/ldconfig
489 The post-uninstall script:
491         if [ "$1" = 0 ]; then
492             perl -ni -e 'print unless m:/usr/X11R6/lib/wine:;' /etc/ld.so.conf
493         fi
494         /sbin/ldconfig
496 2. Creating a good default configuration file. 
498 For the rationales of needing as less input from the user as possible arises 
499 the need for a very good configuration file. The one supplied with Wine is 
500 currently lacking. We need:
502     * [Drive X]: 
503         - A for the floppy. Specify your distribution's default floppy mountpoint.
504                 Path=/auto/floppy
505         - C for the C:\ directory. Here we use the user's home directory, for most
506           applications do see C:\ as root-writeable directory of every windows
507           installation and this basically is it in the UNIX-user context.
508           Don't forget to identify environment variables as DOS ones (ie, surrounded by '%').
509                 Path=%HOME%
510         - R for the CD-Rom drive. Specify your distribution's default CD-ROM mountpoint.
511                 Path=/auto/cdrom
512         - T for temporary storage. We do use /tmp/ (rationale: between process 
513           temporary data belongs to /tmp/ , FHS 2.0)
514                 Path=/tmp/
515         - W for the original Windows installation. This drive points to the
516           WINDOWSDIR subdirectory of the original windows installation.
517           This avoids problems with renamed WINDOWSDIR directories (as for 
518           instance lose95, win or sys\win95). During compile/package/install
519           we leave this to be / , it has to be configured after the package install.
520         - Z for the UNIX Root directory. This avoids any roblems with 
521           "could not find drive for current directory" users occasionally complain
522           about in the newsgroup and the irc channel. It also makes the whole 
523           directory structure browseable. The type of Z should be network,
524           so applications expect it to be readonly.
525                 Path=/
526           
527     * [wine]:
528         Windows=c:\windows\             (the windows/ subdirectory in the user's
529                                  home directory)
530         System=c:\windows\system\       (the windows/system subdirectory in the user's
531                                          home directory)
532         Path=c:\windows;c:\windows\system;c:\windows\system32;w:\;w:\system;w:\system32;
533         ; Using this trick we have in fact two windows installations in one, we
534         ; get the stuff from the readonly installation and can write to our own.
535         Temp=t:\                        (the TEMP directory)
537     * Possibly modify the [spooler], [serialports] and [parallelports] sections.
538       FIXME: possibly more, including printer stuff.
540 Add this prepared configuration file to the package.
542 3. Installing Wine for the system administrator
543                 
544 Install the package using the usual packager 'rpm -i wine.rpm'.
545 You may edit /etc/wine/wine.conf , [Drive W], to point to a
546 possible Windows installation right after the install. That's it.
548 Note that on Linux you should somehow try to add the unhide mount optioni
549 (see 'man mount') to the CD-ROM entry in /etc/fstab during package install,
550 as several stupid Windows programs mark some setup (!) files as hidden 
551 (ISO9660) on CD-ROMs, which will greatly confuse users as they won't find 
552 their setup files on the CD-ROMs as they were used on Windows systems when
553 unhide is not set ;-\ And of course the setup program will complain
554 that setup.ins or some other mess is missing... If you choose to do so, 
555 then please make this change verbose to the admin.
557 Also make sure that the kernel you use includes the Joliet CD-ROM support, 
558 for the very same reasons as given above (no long filenames due to missing 
559 Joliet, files not found).
560               
561 4. Installing Wine for the user
563 The user will need to run a setup script before the first invocation of Wine. 
564 This script should:
565     * Copy /etc/wine/wine.conf for user modification.
566     * Allow specification of the original windows installation to use
567       (which modifies the copied wine.conf file).
568     * Create the windows directory structure (c:\windows, c:\windows\system,
569       c:\windows\Start Menu\Programs, c:\Program Files, c:\Desktop, etc.)
570     * Symlink all .dll and .exe files from the original windows installation
571       to the windows directory. Why? Some programs reference 
572       "%windowsdir%/file.dll" or "%systemdir%/file.dll" directly and fail
573       if they are not present.  This will give a huge number of symlinks, yes.
574       However, if an installer later overwrites one of those files, it will 
575       overwrite the symlink (so that the file now lies in the windows/
576       subdirectory). FIXME: Not sure this is needed for all files.
577     * On later invocation the script might want to compare regular files in 
578       the user's windows directories and in the global windows directories
579       and replace same files by symlinks (to avoid diskspace problems).
580     
581 AUTHORS
582 ~~~~~~~
584 Written in 1999 by Marcus Meissner <marcus@jet.franken.de>
585 Updated in 2000 by Jeremy White <jwhite@codeweavers.com>
586 Updated in 2002 by Andreas Mohr <andi@rhlx01.fht-esslingen.de>
587 Updated in 2003 by Tom Wickline <twickline2@triad.rr.com>
588 Updated in 2003 by Dimitrie O. Paun <dpaun@rogers.com>