Cross Compiling FileZilla 3 for Windows under Ubuntu or Debian GNU/Linux
This documentation explains how to setup a build environment for FileZilla 3 for Windows and how to compile it under Ubuntu or Debian using Mingw-w64. It will take less time and is more simple than Compiling FileZilla 3 under Windows.
OS version
Any recent Linux should do the trick. For the sake of simplicity, this guide focuses on Debian(-based) distributions.
Known-good Debian(-based) distributions:
- Debian 8 (Jessie) or later (recommended)
- Ubuntu 14.04 LTS or later
Setting up the build environment
As root, execute:
dpkg --add-architecture i386 # If using a 64bit distribution (64bit is recommended) apt-get update apt-get install bzip2 ca-certificates gcc gettext lzip m4 mingw-w64 pkg-config wx-common wine wine32
If you want to work with wxWidgets and FileZilla development sources, also execute this as root:
apt-get install autoconf libtool subversion
Back as normal user, execute:
export PATH="$HOME/prefix-win32/bin:$PATH" export CPPFLAGS="-I$HOME/prefix-win32/include" export LDFLAGS="-L$HOME/prefix-win32/lib" export PKG_CONFIG_PATH="$HOME/prefix-win32/lib/pkgconfig"
Beware: You need to patch your MinGW runtime!
The version of the MinGW runtime ships with Debian based distributions has broken string conversion functions. You need to fetch the source of the mingw-64 packet and apply the following two patches:
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/2474f3904a1fbce19d96383a9633e6c2eeb427ea/ https://sourceforge.net/p/mingw-w64/mingw-w64/ci/bca09678e3bfd67b2d445127280ee5a1d9d0453a/
Without these patches, FileZilla will not work properly and will fail in obscure ways.
GMP
cd ~/src wget https://gmplib.org/download/gmp/gmp-6.1.1.tar.lz tar xvf gmp-6.1.1.tar.lz cd gmp-6.1.1 ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --enable-fat make make install
Nettle
cd ~/src wget https://ftp.gnu.org/gnu/nettle/nettle-3.3.tar.gz tar xvf nettle-3.3.tar.gz cd nettle-3.3 ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --enable-fat make make install
GnuTLS
cd ~/src wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4/gnutls-3.4.16.tar.lz tar xvf gnutls-3.4.16.tar.lz cd gnutls-3.4.16 ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --with-included-libtasn1 --without-p11-kit --disable-doc --enable-local-libopts make make install # The __declspec(dllimport) is needed for DLLs, but we're linking statically. It thus results in undefined references. Remove it. sed -i 's/__declspec(dllimport)//' "$HOME/prefix-win32/include/gnutls/gnutls.h"
Compile SQLite
cd ~/src wget http://sqlite.org/2016/sqlite-autoconf-3150000.tar.gz tar xvzf sqlite-autoconf-3150000.tar.gz cd sqlite-autoconf-3150000 ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --disable-dynamic-extensions make make install
NSIS
cd ~/src wget http://prdownloads.sourceforge.net/nsis/nsis-3.0b3-setup.exe wine nsis-3.0b3-setup.exe /S
The above may print a lot of errors and warnings. Ignore them, check for success this way:
[ -f "$HOME/.wine/drive_c/Program Files/NSIS/makensis.exe" ] && echo "Success!"
Compile wxWidgets
cd ~/src wget http://sourceforge.net/projects/wxwindows/files/3.0.2/wxWidgets-3.0.2.tar.bz2 tar xvjf wxWidgets-3.0.2.tar.bz2 cd wxWidgets-3.0.2 ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared make make install
Compile libfilezilla
cd ~/src wget https://download.filezilla-project.org/libfilezilla/libfilezilla-0.8.0.tar.bz2 tar xf libfilezilla-0.8.0.tar.bz2 cd libfilezilla-0.8.0 ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared make make install
Compile FileZilla
cd ~/src wget http://download.filezilla-project.org/client/FileZilla_3.16.1_src.tar.bz2 tar xvjf FileZilla_3.16.1_src.tar.bz2 cd filezilla-3.16.1 ./configure --host=i686-w64-mingw32 --with-pugixml=builtin make cd data wine "$HOME/.wine/drive_c/Program Files/NSIS/makensis.exe" install.nsi
Voila, there's now FileZilla_3_setup.exe in the current directory.