UPDATE (10th Jan 2013): See here for Wine 1.5.21 using the multiarch approach: http://verahill.blogspot.com.au/2013/01/308-compiling-wine-1521-on-debian.html
. Use the updated build instead of what follows below.
Here's how to build the wine 1.5.5 packages without any errors.
I'm cheating and using the debian rules from dev.carbon-project.org.-- it's a small file and is a better solution than downloading the deb files from there.
Note that you will probably need more packages than the ones listed here.
1. Download the source and debian build patches
sudo apt-get install bzip2 cd ~/tmp mkdir wine-1.5.5_carbon/ cd wine-1.5.5_carbon/ wget http://sourceforge.net/projects/wine/files/Source/wine-1.5.5.tar.bz2 mv wine-1.5.5.tar.bz2 wine-unstable_1.5.5.orig.tar.bz2 tar xvf wine-unstable_1.5.5.orig.tar.bz2 cd wine-1.5.5/ wget http://dev.carbon-project.org/debian/wine-unstable/wine-unstable_1.5.5-0.1.debian.tar.bz2 tar xvf wine-unstable_1.5.5-0.1.debian.tar.bz2 rm wine-unstable_1.5.5-0.1.debian.tar.bz2
2. Edit control, control.in and rules
Allow any version of gcc (this may obviously backfire if your version is no good)
Edit debian/control and control.in
27 gcc-4.5-multilib [amd64 kfreebsd-amd64], gcc-4.5 [amd64 kfreebsd-amd64] 28 g++-4.5 [amd64 kfreebsd-amd64],
so that is says
27 gcc-multilib [amd64 kfreebsd-amd64], gcc [amd64 kfreebsd-amd64], 28 g++ [amd64 kfreebsd-amd64],
Edit debian/rules
53 ifeq ($(DEB_HOST_GNU_CPU),x86_64) 54 CC=gcc-4.5 55 CXX=g++-4.5 56 else 57 CC=gcc 58 CXX=g++
to say
53 ifeq ($(DEB_HOST_GNU_CPU),x86_64) 54 CC=gcc 55 CXX=g++ 56 else 57 CC=gcc 58 CXX=g++
2. Get dependencies
Note that this list is based on a very old post -- some packages may not be needed.
sudo apt-get install ia32-libs ia32-libs-dev bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev opencl-dev lib32opencl1 oss4-dev gettext lib32v4l-dev lib32ncurses5-dev lib32asound2-dev libtiff4-dev libgphoto2-2-dev sudo apt-get install libxkbfile-dev libxxf86dga-dev freeglut3-dev unixodbc-dev gcc-multilib dpkg-dev
Note: I used the following list on debian stable/squeeze.
sudo apt-get install ia32-libs ia32-libs-dev bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev oss4-dev gettext lib32v4l-dev lib32ncurses5-dev lib32asound2-dev libtiff4-dev libgphoto2-2-dev libxkbfile-dev libxxf86dga-dev freeglut3-dev unixodbc-dev gcc-multilib dpkg-dev debhelper libxmu-dev dctrl-tools lzma sharutils lib32z1-dev libgstreamer-plugins-base0.10-dev sudo apt-get install lib32opencl1
Then continue as normal.
If you're on Wheezy/Testing you should be following this post instead anyway.
3. Compile
in wine-1.5.5/:
dpkg-buildpackage -us -ucIf all went well you saw:
dpkg-deb: building package `wine-unstable' in `../wine-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `wine-bin-unstable' in `../wine-bin-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-dbg-unstable' in `../libwine-dbg-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-dev-unstable' in `../libwine-dev-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-unstable' in `../libwine-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-alsa-unstable' in `../libwine-alsa-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-bin-unstable' in `../libwine-bin-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-capi-unstable' in `../libwine-capi-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-cms-unstable' in `../libwine-cms-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-gl-unstable' in `../libwine-gl-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-gphoto2-unstable' in `../libwine-gphoto2-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-ldap-unstable' in `../libwine-ldap-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-openal-unstable' in `../libwine-openal-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-oss-unstable' in `../libwine-oss-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-print-unstable' in `../libwine-print-unstable_1.5.5-0.1_amd64.deb'. dpkg-deb: building package `libwine-sane-unstable' in `../libwine-sane-unstable_1.5.5-0.1_amd64.deb'. [..] dpkg-source: info: using options from wine-1.5.5/debian/source/options: --compression=bzip2 --compression-level=9 dpkg-source: info: unapplying Bug#28201_proposed-fix-modified.patch dpkg-source: info: unapplying Bug#28898_squashed-proposed-patches.patch dpkg-source: info: unapplying fix-winegcc-paths.patch dpkg-source: info: unapplying Bug#29669_proposed-fix.patch dpkg-source: info: unapplying function_grep.patch dpkg-source: info: unapplying readd_xpm.patch dpkg-source: info: unapplying debian-changes-from-1.1.32-1.patch dpkg-buildpackage: full upload (original source is included)
Your packages will be found in the wine-1.5.5_carbon/ directory.
../libwine-alsa-unstable_1.5.5-0.1_amd64.deb ../libwine-bin-unstable_1.5.5-0.1_amd64.deb ../libwine-capi-unstable_1.5.5-0.1_amd64.deb ../libwine-cms-unstable_1.5.5-0.1_amd64.deb ../libwine-dbg-unstable_1.5.5-0.1_amd64.deb ../libwine-dev-unstable_1.5.5-0.1_amd64.deb ../libwine-gl-unstable_1.5.5-0.1_amd64.deb ../libwine-gphoto2-unstable_1.5.5-0.1_amd64.deb ../libwine-ldap-unstable_1.5.5-0.1_amd64.deb ../libwine-openal-unstable_1.5.5-0.1_amd64.deb ../libwine-oss-unstable_1.5.5-0.1_amd64.deb ../libwine-print-unstable_1.5.5-0.1_amd64.deb ../libwine-sane-unstable_1.5.5-0.1_amd64.deb ../libwine-unstable_1.5.5-0.1_amd64.deb ../wine-bin-unstable_1.5.5-0.1_amd64.deb ../wine-unstable_1.5.5-0.1_amd64.deb
If something went wrong, it's probably because of a missing dependency.
To install just run
sudo dpkg -i *.deb in the wine-1.5.5_carbon/ directory.