If you need a particular version of wine to run a particular windows programme, you may well need to build wine from source. Most windows programmes need 32-bit wine so you can't simply build the package from source on your 64-bit installation of debian. The multi-arch feature of debian has matured a lot however there are still packages which can't have the 32-bit and 64-bit versions simultaneously installed. Because of this, you will need to build the 32-bit wine packages inside some kind of chroot environment. I am going to show you a fairly straightforward way of doing this with the help of lxc (Linux Containers).
Install build dependencies, possibly substituting package versions if you're not running debian unstable.
Build 64-bit wine as normal.
Set up a 32-bit container, install build dependencies and build wine in it.
Find the version of wine you require at http://snapshot.debian.org/package/wine-unstable/ and download the three files that make up the make up the source package. There should be an orig.tar.bz2, a .dsg and an .xz. For example, wine-unstable_1.7.17-1.debian.tar.xz, wine-unstable_1.7.17-1.dsc and wine-unstable_1.7.17.orig.tar.bz2. For the rest of this post I shall use 1.7.17 as an example, but feel free to substitute any particular version of wine that you might prefer.
The version of wine in debian stable at the time of writing is 1.4 and the build dependencies have changed somewhat between that package and recent versions of wine-unstable. If you do "apt-get build-dep wine" it will install a lot of the build dependencies of wine-unstable but it won't get all of them, so you will have to install some manually. (If you are running debian unstable then you can probably just do apt-get build-dep wine-unstable and get all of them directly, but if you're running debian unstable I would question why you need help from this article!)
To find out the packages that are required to build wine-unstable, you can unpack the archive and look for the Build-Depends line in debian/control, or you can just attempt to build the package and wait for any error message!
$ dpkg-source -x wine-unstable_1.7.17-1.dsc $ cd wine-unstable-1.7.17 $ dpkg-buildpackage dpkg-buildpackage: source package wine-unstable dpkg-buildpackage: source version 1.7.17-1 dpkg-buildpackage: source changed by Michael Gilbert <firstname.lastname@example.org> dpkg-buildpackage: host architecture amd64 dpkg-source --before-build wine-unstable-1.7.17 dpkg-checkbuilddeps: Unmet build dependencies: libgphoto2-dev libfreetype6-dev (>= 2.5.1) libgstreamer-plugins-base1.0-dev dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting dpkg-buildpackage: warning: (Use -d flag to override.)
The build dependencies may vary from version to version of wine so I can't give you exact instructions here. In this case, none of the three packages exist in the version of debian that I have installed. I substituted libgphoto2-2-dev, an earlier version (2.4.9) of libfreetype6-dev, and libgstreamer-plugins-base0.10-dev. Close enough. Remember the packages you install here as you will also be installing them to build the 32-bit version of wine.
Unfortunately, having the 64-bit wine packages aren't enough as most windows programmes are compiled against 32-bit windows, so you will need to build the 32-bit packages. You can set up a chroot environment by hand with debootstrap and do this, or you can use lxc to set up a container for you. Containers are somewhere between a chroot and a virtual machine. The advantage of using lxc is that it takes exactly one command to set it up:
sudo lxc-create -n32bitwine -t debian -- --arch i386
This will set up a basic 32-bit debian environment in /var/lib/lxc/32bitwine/rootfs. Copy the 3 wine source packages to the location within this environment that you will build them - for example the /root folder. Then enter the container:
sudo lxc-start -n32bitwine
You will see a basic debian system booting, and you will be able to login as root with the password that was displayed at the end of the lxc-create command output. Set up your 32-bit build environment by addding a deb-src line to /etc/apt/sources.list and running apt-get update.
You may need to run "dpkg-reconfigure locale" if you see a lot of errors about LC_ALL like this:
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_GB:en", LC_ALL = (unset), LC_TIME = "en_GB.utf8", LANG = "en_GB.utf8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
You will need to set up your 32-bit build dependencies as before. So I would recommend running "apt-get build-dep wine" to get most of the dependencies installed, then install 32-bit versions of the same packages that you had to install to get 64-bit wine built.
Then extract the source archives (that you previously copied into the container) and build the package:
$ dpkg-source -x wine-unstable_1.7.17-1.dsc $ cd wine-unstable-1.7.17 $ dpkg-buildpackage -n
If all has gone well, you can shut down the container with "sudo lxc-stop -n32bitwine" then copy the 32-bit packages out of your container filesystem. The 32-bit packages you need to install are wine32-unstable and libwine-unstable, while the 64-bit packages you need are wine-unstable, wine64-unstable and libwine-unstable.
Install those packages along with the 64-bit wine packages manually and you are good to go!
sudo dpkg -i libwine-unstable_1.7.17-1_amd64.deb libwine-unstable_1.7.17-1_i386.deb wine32-unstable_1.7.17-1_i386.deb wine64-unstable_1.7.17-1_amd64.deb wine-unstable_1.7.17-1_amd64.deb