If you are going to compile Wine (instead of installing binary Wine files), either to use the most recent code possible or to improve it, then the first thing to do is to obtain a copy of the source code. We'll cover how to retrieve and compile the official source releases from the FTP archives, and also how to get the cutting edge up-to-the-minute fresh Wine source code from CVS (Concurrent Versions System).
Once you have downloaded Wine source code according to the instructions below, there are two ways to proceed: If you want to manually install and configure Wine, then go to the Compiling section. If instead you want automatic installation, then go straight to the Configuration section to make use of wineinstall to automatically install and configure Wine.
You may also need to know how to apply a source code patch to your version of Wine. Perhaps you've uncovered a bug in Wine, reported it to the Wine Bugzilla or the Wine mailing list, and received a patch from a developer to hopefully fix the bug. We will show you how to safely apply the patch and revert it if it doesn't work.
The safest way to grab the source is from one of the official FTP archives. An up to date listing is in the ANNOUNCE file in the Wine distribution (which you would have if you already downloaded it). Here is a list of FTP servers carrying Wine:
ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/ALPHA/wine/development/
ftp://ftp.fu-berlin.de/unix/linux/mirrors/sunsite.unc.edu/ALPHA/wine/development/
The official releases are tagged by date with the format "Wine-YYYYMMDD.tar.gz". Your best bet is to grab the latest one.
I'd recommend placing the Wine archive file that you chose into the directory where you intend to extract Wine. In this case, let's just assume that it is your home directory.
Once you have downloaded a Wine archive file, we need to extract the archive file. This is not very hard to do. First switch to the directory containing the file you just downloaded. Then extract the source in a terminal with (e.g.):
$ tar xvzf wine-20030115.tar.gz |
Just in case you happen to get a Wine archive that uses .tar.bz2 extension instead of .tar.gz: Simply use tar xvjf in that case instead.
Since you now have a fully working Wine source tree by having followed the steps above, you're now well-prepared to go to the Wine installation and configuration steps that follow.
This part is intended to be quick and easy, showing the bare minimum of what is needed to download Wine source code via CVS. If you're interested in a very verbose explanation of CVS or advanced CVS topics (configuration settings, CVS mirror servers, other CVS modules on WineHQ, CVSWeb, ...), then please read the full CVS chapter in the Wine Developer's Guide.
First you need to make sure that you have cvs installed. To check whether this is the case, please run in a terminal:
$ cvs |
If this was successful, then you should have gotten a nice CVS "Usage" help output. Otherwise (e.g. an error "cvs: command not found") you still need to install a CVS package for your particular operating system, similar to the instructions given in the chapters for getting and installing a Wine package on various systems.
First, you should do a
$ touch ~/.cvspass |
to create or update the file .cvspass in your home directory, since CVS needs this file (for password and login management) and will complain loudly if it doesn't exist.
Second, we need to create the file .cvsrc in your home directory containing the CVS configuration settings needed for a valid Wine CVS setup (use CVS compression, properly update file and directory information, ...). The content of this file should look like the following:
cvs -z 3 update -PAd diff -u checkout -P |
$ <editor> ~/.cvsrc |
Once CVS is installed and the Wine specific CVS configuration is done, you can now do a login on our CVS server and checkout (download) the Wine source code. First, let's do the server login:
$ cvs -d :pserver:cvs@cvs.winehq.com:/home/wine login |
If cvs successfully connects to the CVS server, then you will get a "CVS password:" prompt. Simply enter "cvs" as the password (the password is case sensitive: no capital letters!).
After login, we are able to download the Wine source code tree. Please make sure that you are in the directory that you want to have the Wine source code in (the Wine source code will use the subdirectory wine/ in this directory, since the subdirectory is named after the CVS module that we want to check out). We assume that your current directory might be your user's home directory. To download the Wine tree into the subdirectory wine/, run:
$ cvs -d :pserver:cvs@cvs.winehq.com:/home/wine checkout wine |
Downloading the CVS tree might take a while (some minutes to few hours), depending on your connection speed. Once the download is finished, you should keep a note of which directory the newly downloaded wine/ directory is in, by running pwd (Print Working Directory):
$ pwd |
Later, you will be able to change to this directory by running:
$ cd <some_dir> |
, where <some_dir> is the directory that pwd gave you. By running
$ cd wine |
, you can now change to the directory of the Wine CVS tree you just downloaded. Since you now have a fully working Wine source tree by having followed the steps above, you're now well-prepared to go to the Wine installation and configuration steps that follow.
After a while, you might want to update your Wine CVS tree to the current version. Before updating the Wine tree, it might also be a good idea to run make uninstall as root in order to uninstall the installation of the previous Wine version.
To proceed with updating Wine, simply cd to the Wine CVS tree directory, then run:
$ make distclean $ cvs -d :pserver:cvs@cvs.winehq.com:/home/wine update |
The make distclean part is optional, but it's a good idea to remove old build and compile configuration files before updating to a newer Wine version. Once the CVS update is finished, you can proceed with installing Wine again as usual.
If you got Wine source code (e.g. via a tar archive file), you have the option of applying patches to the source tree to update to a newer Wine release or to fix bugs and add experimental features. Perhaps you've found a bug, reported it to the Wine mailing list, and received a patch file to fix the bug. You can apply the patch with the patch command, which takes a streamed patch from stdin:
$ cd wine $ patch -p0 <../patch_to_apply.diff |
To remove the patch, use the -R option:
$ patch -p0 -R <../patch_to_apply.diff |
If you want to do a test run to see if the patch will apply successfully (e.g., if the patch was created from an older or newer version of the tree), you can use the --dry-run parameter to run the patch without writing to any files:
$ patch -p0 --dry-run <../patch_to_apply.d iff |
patch is pretty smart about extracting patches from the middle of a file, so if you save an email with an inlined patch to a file on your hard drive, you can invoke patch on it without stripping out the email headers and other text. patch ignores everything that doesn't look like a patch.
The -p0 option to patch tells it to keep the full file name from the patch file. For example, if the file name in the patch file was wine/programs/clock/main.c. Setting the -p0 option would apply the patch to the file of the same name i.e. wine/programs/clock/main.c . Setting the -p1 option would strip off the first part of the file name and apply the patch to programs/clock/main.c. The -p1 option would be useful if you named your top level wine directory differently than the person who sent you the patch. For the -p1 option patch should be run from the top level wine directory.