Cross Compiling FileZilla 3 for Windows under Ubuntu or Debian GNU/Linux

From FileZilla Wiki
Revision as of 04:26, 15 January 2010 by 124.170.170.91 (talk)
Jump to navigationJump to search

This documentation explains how to setup a build environment for FileZilla 3 for Windows and how to compile it under Debian using MinGW. It will take less time and simple than Compiling FileZilla 3 under Windows.

Debian version

Setting up the build environment

Do works as root

su -

Required packages

apt-get install -y mingw32 make g\+\+ libtool bzip2 automake gettext wx-common

Patch mingw32-runtime

Because the version of mingw32-runtime in Debian 5 is broken - Thanks CodeSquid, patch mingw32-runtime package.

Get source package

cd /tmp
apt-get install dpkg-dev debhelper
apt-get source mingw32-runtime
cd mingw32-runtime-3.13/
debian/rules unpack-stamp

Patch snprintf bug

pushd build_dir/src/mingw-runtime-3.13-20070825-1/mingwex/gdtoa/
diff -u mingw_snprintf.c.org mingw_snprintf.c
--- mingw_snprintf.c.org        2009-09-21 02:41:31.000000000 +0000
+++ mingw_snprintf.c    2009-09-21 02:41:54.000000000 +0000
@@ -465,7 +465,7 @@
                                    len = LEN_LL;
                                  }
                                else
-                                 len = LEN_LL;
+                                 len = LEN_L;
                                goto fmtloop;
                        case 'L':
                                flag_ld++;
@@ -617,6 +617,7 @@
                                        break;
                                  case LEN_S:
                                        *(short*)ip = c;
+                                       break;
                                  case LEN_LL:
                                        *(long long*) ip = c;
                                        break;
popd

Build & Install

debian/rules build
debian/rules install

Copy new library

mv /usr/i586-mingw32msvc/lib/libmingwex.a /usr/i586-mingw32msvc/lib/libmingwex.a.old
cp debian/mingw32-runtime/usr/i586-mingw32msvc/lib/libmingwex.a /usr/i586-mingw32msvc/lib/

Make libraries

Do works as normal user

exit

Make working & install directory

Check available space of storage.

mkdir ~/mingw32
mkdir /tmp/fz3
cd /tmp/fz3

Setting up environment variables

export CFGPRE=~/mingw32
export CFGOPT="--prefix=$CFGPRE --host=i586-mingw32msvc --disable-shared --enable-static"

iconv

wget ftp://ftp.gnu.org/gnu/libiconv/libiconv-1.13.tar.gz
tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13
./configure $CFGOPT
make install clean
cd ..

libidn

wget ftp://alpha.gnu.org/gnu/libidn/libidn-0.6.9.tar.gz
tar zxvf libidn-0.6.9.tar.gz
cd libidn-0.6.9
./configure $CFGOPT
make install clean
cd ..

libgpg-error

wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.7.tar.bz2
tar jxvf libgpg-error-1.7.tar.bz2
cd libgpg-error-1.7
./configure $CFGOPT --disable-nls
make install clean
cd ..

libgcrypt

wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.4.4.tar.bz2
tar jxvf libgcrypt-1.4.4.tar.bz2
cd libgcrypt-1.4.4
./configure $CFGOPT --disable-nls --disable-asm --with-gpg-error-prefix=$CFGPRE
make install clean
cd ..

GnuTLS

wget ftp://ftp.gnutls.org/pub/gnutls/gnutls-2.8.3.tar.bz2
tar jxvf gnutls-2.8.3.tar.bz2
cd gnutls-2.8.3
./configure $CFGOPT --disable-nls --disable-cxx --with-libgcrypt-prefix=$CFGPRE
make install clean
cd ..

wxWidgets

wget http://downloads.sourceforge.net/wxwindows/wxWidgets-2.8.10.tar.bz2
tar jxvf wxWidgets-2.8.10.tar.bz2
cd wxWidgets-2.8.10
mkdir compile
cd compile
../configure $CFGOPT --enable-unicode
make install clean
cd ../..

Compiling FileZilla 3

wget http://downloads.sourceforge.net/filezilla/FileZilla_3.2.7.1_src.tar.bz2
tar jxvf FileZilla_3.2.7.1_src.tar.bz2

cd filezilla-3.2.7.1
./autogen.sh
mkdir compile
cd compile

autogen.sh of FileZilla 3 use old libgnutls-config.

cat << EOF > $CFGPRE/bin/libgnutls-config
#!/bin/sh
echo "-L$CFGPRE/lib -lgnutls -lgcrypt -lgpg-error"
EOF
chmod +x $CFGPRE/bin/libgnutls-config
CFLAGS="-I$CFGPRE/include" CXXFLAGS="-I$CFGPRE/include" LDFLAGS="-L$CFGPRE/lib" ../configure $CFGOPT --with-wx-prefix=$CFGPRE --with-libgnutls-prefix=$CFGPRE

make
strip src/interface/filezilla.exe