wiki:BuildingTransmissionQtWindows

Version 3 (modified by rb07, 12 years ago) (diff)

--

Building Transmission Qt for Windows

The following procedure in not the only one possible, it was just the easiest for me.

If you have a MinGW http://mingw.org/ development environment (Qt SDK http://www.qtsoftware.com/downloads/downloads#lgpl installs the basic tools) then you can skip the first part, add as many ported packages as you can find http://sourceforge.net/project/showfiles.php?group_id=2435, and try the 2nd part.

Cross build environment

Using the excellent tools from the Fedora project http://fedoraproject.org/wiki/MinGW we can build Transmission for running on Windows (XP and above).

You don't need to install Fedora 11, I run it under Windows on a virtual machine (VMWare Player http://www.vmware.com/download/player/download.html), the Fedora 11 image is from VMplanet http://vmplanet.net/node/92.

Once you have it, log in, su to root, and install the cross-development tools:

  • yum install mingw32-gcc mingw32-gtk2 mingw32-crossreport mingw32-nsiswrapper wine
  • yum install mingw32-curl
  • yum install mingw32-qt
  • yum install mingw32-gcc-c++

Curl and its dependencies was already ported, so we got that for free. If you are working on MinGW, go to the Curl site, the downloads include libraries and everything ported to Windows. I'm not building a multi-language version, just English, so I'm skipping the step about installing intltool (which is not in the yum repository, you have to build it, and I did for the Gtk version which requires it; not difficult).

Building Transmission library

For MinGW replace mingw32-configure with ./configure, qmake-qt4 with qmake, and i686-pc-mingw32-g++ with g++.

Start by downloading and installing the source in your workspace:

Download the following patch BuildingTransmissionQtWindows/transmission-1.61-Qt-build.diff

Then:

  • cd transmission-1.61
  • patch -p1 < transmission-1.61-Qt-build.diff
  • mingw32-configure --disable-nls --disable-cli --disable-shared --disable-gtk --disable-daemon
  • make CFLAGS="-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mms-bitfields -DSTATICLIB"
  • make install

Build Transmission Qt

  • cd qt
  • export QMAKESPEC=fedora-win32-cross
  • export PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig
  • qmake-qt4 -win32 qtr.pro
  • perl -pi -e 's/-fno-rtti' Makefile.Debug Makefile.Release
  • make clean && make release
  • i686-pc-mingw32-g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug/qtr.exe object_script.qtr.Debug -L"/usr/i686-pc-mingw32/sys-root/mingw/lib" -lmingw32 -lqtmaind debug/qtr_resource_res.o ../libtransmission/libtransmission.a ../third-party/miniupnp/libminiupnp.a ../third-party/libnatpmp/libnatpmp.a ../third-party/libevent/.libs/libevent.a -L/usr/i686-pc-mingw32/sys-root/mingw/lib -lfontconfig -L/usr/i686-pc-mingw32/sys-root/mingw/lib -lcurl -L/usr/i686-pc-mingw32/sys-root/mingw/lib -lssl -lcrypto -lwsock32 -lws2_32 -lgdi32 -lz -lQtGui4 -lQtNetwork4 -lQtCore4 -lintl
  • INSTALL_ROOT=/usr/i686-pc-mingw32/sys-root/mingw make release-install

Note: after 'make release' everything is compiled but linking fails, that's what the line after that does: links with the correct library names, and the two missing libraries.

Make the Windows installer

I had to change the Fedora tool a little, make a backup of /usr/bin/nsiswrapper (i.e. cp /usr/bin/nsiswrapper /usr/bin/nsiswrapper.orig), then apply this patch BuildingTransmissionQtWindows/nsiswrapper.diff Also, since this tool searches in a case sensitive way, it complains about dependencies that it doesn't find... I had to make a little workaround by linking the Qt libraries like this: 'ln -s /usr/i686-pc-mingw32/sys-root/mingw/bin/QtCore4.dll /usr/i686-pc-mingw32/sys-root/mingw/bin/qtcore4.dll'; do the same for !QtGui4.dll and !QtNetwork4.dll .

Finally create the installer:

  • nsiswrapper --run --name "QtTransmission" --outfile QTransmission-1.61_installer.exe --installdir 'C:\Program Files\Transmission-1.61' /usr/i686-pc-mingw32/sys-root/mingw/bin/qtr.exe

That's it, now just copy the installer to Windows, I use ftp but of course I have a ftp server... haven't tried other means but scp (putty or OpenSSH) should work, also using a flash drive, or a Windows/Samba? share.