Sweden-Number/documentation/distributors

485 lines
14 KiB
Plaintext

A small WINE distribution guide.
While packaging WINE for one of the Linux distributions I came across
several points which have been clarified yet. Particular a how-to for WINE
packaging distributors is missing. This document tries to give a brief
overview over the rationales I thought up and how I tried to implement it.
(While the examples use "rpm" most of this stuff can be applied to other
packagers too.)
1. Rationales
A WINE install should:
a. Not have a world writeable directory (-tree).
b. Require only as much user input as possible. It would be very good if it
would not require any at all. Just let the system administrator do "rpm
-i wine.rpm" and let any user be able to run "wine sol.exe" instantly.
c. Give the user as much flexibility to install his own applications, do
his own configuring etc.
d. Come as preconfigured as possible, so the user does not need to change
any configuration files.
e. Use only as much diskspace as needed per user.
A WINE install needs:
f. A writeable C:\ directory structure on a per user basis. Applications do
dump .ini files into c:\windows, installers dump .exe, .dll and more into
c:\windows\ and subdirectories or into C:\Program Files\.
g. The .exe and .dll from a global read-only Windows installation to be
found by applications.
h. Some special .dll and .exe files in the windows\system directory, since
applications directly check for their presence.
2. Implementation
2.1 Building the package
WINE is configured the usual way (depending on your buildenvironment).
The "prefix" is chosen using your application placement policy
(/usr/,/usr/X11R6/, /opt/wine/ or similar). The configuration files
(wine.conf, wine.userreg, wine.systemreg) are targeted for /etc/wine/
(rationale: FHS 2.0, multiple readonly configuration files of a package).
Example (split this into %build and %install section for rpm):
CFLAGS=$RPM_OPT_FLAGS \
./configure --prefix=/usr/X11R6 --sysconfdir=/etc/wine/ --enable-dll
make
BR=$RPM_BUILD_ROOT
make install prefix=$BR/usr/X11R6/ sysconfdir=$BR/etc/wine/
install -d $BR/etc/wine/
install -m 644 wine.ini $BR/etc/wine/wine.conf
# Put all our dlls in a seperate directory. (this works only if
# you have a buildroot)
install -d $BR/usr/X11R6/lib/wine
mv $BR/usr/X11R6/lib/lib* $BR/usr/X11R6/lib/wine/
# the clipboard server is started on demand.
install -m 755 windows/x11drv/wineclipsrv $BR/usr/X11R6/bin/
# The WINE server is needed.
install -m 755 server/wineserver $BR/usr/X11R6/bin/
Here we unfortunately do need to create wineuser.reg and winesystem.reg
from the WINE distributed winedefault.reg. This can be done using
./regapi once for one example user and the reusing his .wine/user.reg
and .wine/system.reg files. [FIXME: this needs to be done better]
install -m 644 wine.sytemreg $BR/etc/wine/
install -m 644 wine.userreg $BR/etc/wine/
There are now a lot of libraries generated by the build process, so a
seperate library directory should be used.
install -d 755 $BR/usr/X11R6/lib/
mv $BR/
You will need to package the files:
$prefix/bin/wine, $prefix/bin/dosmod, $prefix/lib/wine/*
$prefix/man/man1/wine.1, $prefix/include/wine/*,
$prefix/bin/wineserver, $prefix/bin/wineclipsrv
%config /etc/wine/*
%doc ... choose from the toplevel directory and documentation/
The Post install script:
if ! grep -q /usr/X11R6/lib/wine /etc/ld.so.conf; then
echo "/usr/X11R6/lib/wine" >> /etc/ld.so.conf
fi
/sbin/ldconfig
The post uninstall script:
if [ "$1" = 0 ]; then
perl -ni -e 'print unless m:/usr/X11R6/lib/wine:;' /etc/ld.so.conf
fi
/sbin/ldconfig
2.2 Creating a good default configuration file
For the rationales of needing as less input from the user as possible
arises the need for a very good configuration file. The one supplied
with WINE is currently lacking. We need:
- [Drive X]:
+ A for the floppy. Specify your distributions default floppy mountpoint
here. (Path=/auto/floppy)
+ C for the C:\ directory. Here we use the users homedirectory, for most
applications do see C:\ as root-writeable directory of every windows
installation and this basically is it in the UNIX-user context.
(Path=${HOME})
+ R for the CD-Rom drive. Specify your distributions default CD-ROM drives
mountpoint here. (Path=/auto/cdrom)
+ T for temporary storage. We do use /tmp/ (rationale: between process
temporary data belongs to /tmp/, FHS 2.0)
+ W for the original Windows installation. This drive points to the
windows\ subdirectory of the original windows installation. This avoids
problems with renamed 'windows' directories (as for instance 'lose95',
'win' or 'sys\win95'). During compile/package/install we leave this
to be '/', it has to be configured after the package install.
+ Z for the UNIX Root directory (Path=/). This avoids any problems with
"could not find drive for current directory" users occasionaly complain
about in the newsgroup and the ircchannel. It also makes the whole
directory structure browseable. The type of Z should be network, so
applications expect it to be readonly.
- [wine]:
Windows=c:\windows\ (the windows/ subdirectory in the users
homedirectory)
System=c:\windows\system\ (the windows/system subdirectory in the users
homedirectory)
Path=c:\windows;c:\windows\system;c:\windows\system32;w:\;w:\system;w:\system32;
; Using this trick we have in fact two windows installations in one, we
; get the stuff from the readonly installation and can write to our own.
Temp=t:\ (the TEMP directory)
- [Tweak.Layout]
WineLook=win95 (just the coolest look ;)
- Possibly modify the [spooler], [serialports] and [parallelports] sections.
(FIXME: possibly more, including printer stuff)
Add this prepared configuration file to the package.
2.3 Installing WINE for the system administrator
Install the package using the usual packager "rpm -i wine.rpm".
You may edit /etc/wine/wine.conf, [Drive W], to point to a possible windows
installation right after the install. Thats it.
2.4 Installing WINE for the user
The user will need to run a setup script before the first invocation of
WINE. This script should:
- Copy /etc/wine/wine.conf for user modification.
- Allow specification of the original windows installation to use (which
modifies the copied wine.conf file).
- Create the windows directory structure (c:\windows,c:\windows\system,
c:\windows\Start Menu\Programs,c:\Program Files,c:\Desktop,...)
(FIXME: Not sure this is needed for all files:)
- Symlink all .dll and .exe files from the original windows installation to
the windows directory. Why? Some program reference "%windowsdir%/file.dll"
or "%systemdir%/file.dll" directly and fail if there are not present.
This will give a huge number of symlinks, yes. However, if an installer
later overwrites on of those files, it will overwrite the symlink (so
that the file now lies in the windows/ subdirectory).
- On later invocation the script might want to compare regular files in
the users windows directories and in the global windows directories and
replace same files by symlinks (to avoid diskspace problems).
Done.
This procedure requires:
- Much thought and work from the packager (1x)
- No work for the sysadmin. Well except one "rpm -i" and possible one edit
of the configuration file.
- Some or no work from the user, except running the per-user setup script
once.
=> It scales well and suffices most of the rationales.
Marcus Meissner <Marcus.Meissner@caldera.de>
----------------------------------------------------------------
Sample wine.ini for OpenLinux 2.x:
;;
;; MS-DOS drives configuration
;;
;; Each section has the following format:
;; [Drive X]
;; Path=xxx (Unix path for drive root)
;; Type=xxx (supported types are 'floppy', 'hd', 'cdrom' and 'network')
;; Label=xxx (drive label, at most 11 characters)
;; Serial=xxx (serial number, 8 characters hexadecimal number)
;; Filesystem=xxx (supported types are 'msdos'/'dos'/'fat', 'win95'/'vfat', 'unix')
;; This is the FS Wine is supposed to emulate on a certain
;; directory structure.
;; Recommended:
;; - "win95" for ext2fs, VFAT and FAT32
;; - "msdos" for FAT16 (ugly, upgrading to VFAT driver strongly recommended)
;; DON'T use "unix" unless you intend to port programs using Winelib !
;; Device=/dev/xx (only if you want to allow raw device access)
;;
;
;
; Floppy 'A' and 'B'
;
; OpenLinux uses an automounter under /auto/, so we use that too.
;
[Drive A]
Path=/auto/floppy/
Type=floppy
Label=Floppy
Serial=87654321
Device=/dev/fd0
Filesystem=win95
;
; Comment in ONLY if you have a second floppy or the automounter hangs
; for 5 minutes.
;
;[Drive B]
;Path=/auto/floppy2/
;Type=floppy
;Label=Floppy
;Serial=87654321
;Device=/dev/fd1
;Filesystem=win95
;
; Drive 'C' links to the users homedirectory.
;
; This must point to a writeable directory structure (not your readonly
; mounted DOS partitions!) since programs want to dump stuff into
; "Program Files/" "Programme/", "windows/", "windows/system/" etc.
;
; The basic structure is set up using the config script.
;
[Drive C]
Path=${HOME}
Type=hd
Label=MS-DOS
Filesystem=win95
;
; /tmp/ directory
;
; The temp drive (and directory) points to /tmp/. Windows programs fill it
; with junk, so it is approbiate.
;
[Drive T]
Path=/tmp
Type=hd
Label=Tmp Drive
Filesystem=win95
;
; 'U'ser homedirectory
;
; Just in case you want C:\ elsewhere.
;
[Drive U]
Path=${HOME}
Type=hd
Label=Home
Filesystem=win95
;
; CD-'R'OM drive (automounted)
;
; The default cdrom drive.
;
; If an application (or game) wants a specific CD-ROM you might have to
; temporary change the Label to the one of the CD itself.
;
; How to read them is described in /usr/doc/wine-cvs-xxxxx/cdrom-labels.
;
[Drive R]
Path=/auto/cdrom
Type=cdrom
Label=CD-Rom
Filesystem=win95
;
; The drive where the old windows installation resides (it points to the
; windows/ subdirectory).
;
; The Path is modified by the winesetup script.
;
[Drive W]
Path=/
Type=network
Label=Windows
Filesystem=win95
;
; The UNIX Root directory, so all other programs and directories are reachable.
;
; type network is used to tell programs to not write here.
;
[Drive Z]
Path=/
Type=network
Label=ROOT
Filesystem=win95
;
; Standard Windows path entries. WINE will not work if they are incorrect.
;
[wine]
;
; The windows/ directory. It must be writeable, for programs write into it.
;
Windows=c:\windows
;
; The windows/system/ directory. It must be writeable, for especially setup
; programs install dlls in there.
;
System=c:\windows\system
;
; The temp directory. Should be cleaned regulary, since install programs leave
; junk without end in there.
;
Temp=t:\
;
; The dll search path. It should contain at least:
; - the windows and the windows/system directory of the user.
; - the global windows and windows/system directory (from a possible readonly
; windows installation either on msdos filesystems or somewhere in the UNIX
; directory tree)
; - any other windows style directories you want to add.
;
Path=c:\windows;c:\windows\system;c:\windows\system32;t:\;w:\;w:\system;w:\system32
;
; Outdated and no longer used. (but needs to be present).
;
SymbolTableFile=./wine.sym
# <wineconf>
;
; Dll loadorder defaults. No need to modify.
;
[DllDefaults]
EXTRA_LD_LIBRARY_PATH=${HOME}/wine/cvs/lib
DefaultLoadOrder = native, elfdll, so, builtin
;
; What 32/16 dlls belong to each other (context wise). No need to modify.
;
[DllPairs]
kernel = kernel32
gdi = gdi32
user = user32
commdlg = comdlg32
commctrl= comctl32
ver = version
shell = shell32
lzexpand= lz32
mmsystem= winmm
msvideo = msvfw32
winsock = wsock32
;
; What type of dll to use in their respective loadorder.
;
[DllOverrides]
kernel32, gdi32, user32 = builtin
kernel, gdi, user = builtin
toolhelp = builtin
comdlg32, commdlg = elfdll, builtin, native
version, ver = elfdll, builtin, native
shell32, shell = builtin, native
lz32, lzexpand = builtin, native
commctrl, comctl32 = builtin, native
wsock32, winsock = builtin
advapi32, crtdll, ntdll = builtin, native
mpr, winspool = builtin, native
ddraw, dinput, dsound = builtin, native
winmm, mmsystem = builtin
msvideo, msvfw32 = builtin, native
mcicda.drv, mciseq.drv = builtin, native
mciwave.drv = builtin, native
mciavi.drv, mcianim.drv = native, builtin
w32skrnl = builtin
wnaspi32, wow32 = builtin
system, display, wprocs = builtin
wineps = builtin
;
; Options section. Does not need to be edited.
;
[options]
; allocate how much system colors on startup. No need to modify.
AllocSystemColors=100
;;
; Font specification. You usually do not need to edit this section.
;
; Read documentation/fonts before adding aliases
;
[fonts]
; The resolution defines what fonts to use (usually either 75 or 100 dpi fonts,
; or nearest match).
Resolution = 96
; Default font
Default = -adobe-times-
;
; serial ports used by "COM1" "COM2" "COM3" "COM4". Useful for applications
; that try to access serial ports.
;
[serialports]
Com1=/dev/ttyS0
Com2=/dev/ttyS1
Com3=/dev/modem,38400
Com4=/dev/modem
;
; parallel port(s) used by "LPT1" etc. Useful for applications that try to
; access these ports.
;
[parallelports]
Lpt1=/dev/lp0
;
; What spooling program to use on printing.
; Use "|program" or "filename", where the output will be dumped into.
;
[spooler]
LPT1:=|lpr
LPT2:=|gs -sDEVICE=bj200 -sOutputFile=/tmp/fred -q -
LPT3:=/dev/lp3
;
; Allow port access to WINE started by the root user. Useful for some
; supported devices, but it can make the system unstable.
; Read /usr/doc/wine-cvs-xxxxx/ioport-trace-hints.
;
[ports]
;read=0x779,0x379,0x280-0x2a0
;write=0x779,0x379,0x280-0x2a0
; debugging, not need to be modified.
[spy]
Exclude=WM_SIZE;WM_TIMER;
;
; What names for the registry datafiles, no need to modify.
;
[Registry]
; Paths must be given in /dir/dir/file.reg format.
; Wine will not understand dos file names here...
;UserFileName=xxx ; alternate registry file name (user.reg)
;LocalMachineFileName=xxx ; (system.reg)
;
; Layout/Look modifications. Here you can switch with a single line between
; windows 3.1 and windows 95 style.
; This does not change WINE behaviour or reported versions, just the look!
;
[Tweak.Layout]
;; WineLook=xxx (supported styles are 'Win31'(default), 'Win95', 'Win98')
WineLook=Win95
;
; What programs to start on WINE startup. (you should probably leave it empty)
;
[programs]
Default=
Startup=
; defunct section.
[Console]
;XtermProg=nxterm
;InitialRows=25
;InitialColumns=80
;TerminalType=nxterm
# </wineconf>