Compiling FileZilla 3 under Windows

From FileZilla Wiki

Jump to: navigation, search

This documentation explains how to setup a build environment for FileZilla 3 and how to compile it under Windows using MinGW. It will take some time to get everything working, but you will be able to use the build environment for other programs too.

For this guide we assume c:\dev as root directory where we install everything into.

Contents


[edit] Setting up the build environment

This includes the compiler and the required tools to build FileZilla 3 and its dependancies. For all packages we download, you will have to download the binary version, not the source version.

[edit] MinGW

Download latest MinGW version and install it: http://downloads.sf.net/mingw/MinGW-5.0.3.exe Choose c:\dev\mingw as installation directory. Select "candidate" package version and check the g++ option on the packages list.

[edit] MSYS

Download latest MSYS and install it: http://prdownloads.sourceforge.net/mingw/MSYS-1.0.11-2004.04.30-1.exe?download Chose c:\dev\msys as installation directory. Leave all other options unchanged. During the postinstall script, please carefully answer all questions. Important: Do not skip questions with enter.

[edit] MSYS Developer Toolkit

Download and install MSYS Developer Toolkit executable: http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe Install to c:\dev\msys as well.

[edit] Compilation flags

Start msys. Type in the following commands:

echo "export LDFLAGS=-L/local/lib" > ~/.profile
echo "export CPPFLAGS=-I/local/include" >> ~/.profile
exit

[edit] Autotools

[edit] Downloading

Download the following files to c:\dev\download: http://ftp.gnu.org/gnu/libtool/libtool-1.5.22.tar.gz ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.gz ftp://ftp.gnu.org/gnu/automake/automake-1.10.tar.gz

Start msys again and enter the following commands:

mkdir /usr/src

[edit] Libtool

Start msys and enter the following commands:

cd /usr/src
tar -xvzf /c/dev/download/libtool-1.5.22.tar.gz
cd libtool-1.5.22
./configure --prefix=
make -j3
make install

[edit] Autoconf

Enter the following commands:

cd /usr/src
tar -xvzf /c/dev/download/autoconf-2.61.tar.gz
cd autoconf-2.61
./configure --prefix=
make
make install

[edit] Automake

Enter the following commands:

cd /usr/src
tar -xvzf /c/dev/download/automake-1.10.tar.gz
cd automake-1.10
./configure --prefix=
make
make install

[edit] Libiconv

Compile and install libiconv. Download from ftp://ftp.gnu.org/gnu/libiconv/libiconv-1.11.tar.gz to c:\dev\download

cd /usr/src
tar -xvzf /c/dev/download/libiconv-1.11.tar.gz
cd libiconv-1.11
./configure --disable-shared --enable-static
make -j3
make install

[edit] Libidn

Download ftp://alpha.gnu.org/gnu/libidn/libidn-0.6.9.tar.gz to c:\dev\download. Type the following inside msys:

cd /usr/src
tar -xvzf /c/dev/download/libidn-0.6.9.tar.gz
cd libidn-0.6.9
./configure --disable-shared --enable-static
make -j3
make install

[edit] gettext

Download ftp://ftp.gnu.org/gnu/gettext/gettext-0.16.1.tar.gz to c:\dev\download. Download http://cvs.savannah.gnu.org/viewvc/gettext/gettext-runtime/intl/localename.c?root=gettext&r1=1.15&r2=1.16&view=patch to c:\dev\download\localename.c.patch Type the following inside msys:

cd /usr/src
tar -xvzf /c/dev/download/gettext-0.16.1.tar.gz
cd gettext-0.16.1/gettext-runtime/intl
patch -i /c/dev/download/localename.c.patch
cd ../..
./configure --disable-shared --enable-static
make -j3
make install

[edit] Libgpg and gettext patch

Download ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.5.tar.bz2 and http://filezilla-project.org/codesquid/w32-gettext.c.patch to c:\dev\download. Type the following inside msys:

cd /usr/src
tar -xvjf /c/dev/download/libgpg-error-1.5.tar.bz2
cd libgpg-error-1.5
patch -i /c/dev/download/w32-gettext.c.patch -p0
./configure --disable-shared --enable-static --disable-nls
make -j3
make install

[edit] Libgcrypt

Download ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/libgcrypt-1.3.1.tar.bz2 to c:\dev\download. Type the following inside msys:

cd /usr/src
tar -xvjf /c/dev/download/libgcrypt-1.3.1.tar.bz2
cd libgcrypt-1.3.1
./configure --disable-shared --enable-static --disable-nls --disable-asm
make
make install

[edit] GnuTLS

Download ftp://ftp.gnutls.org/pub/gnutls/devel/gnutls-2.1.6.tar.bz2 and http://filezilla-project.org/codesquid/gnutls.patch to c:\dev\download. Type the following inside msys:

cd /usr/src
tar -xvjf /c/dev/download/gnutls-2.1.6.tar.bz2
cd gnutls-2.1.6
patch -p0 -i /c/dev/download/gnutls.patch
./configure --disable-shared --enable-static --disable-nls --disable-cxx
touch lib/libgnutls-25.def
echo > lgl/vasprintf.c
echo > lgl/vasnprintf.c
make
make install

[edit] Cleanup

cd /
rm -rf /usr/src

And now you're done, you've successfully setup a build environment which can be used to compile FileZilla 3. Only dependency missing is wxWidgets, which is the topic for the next section.

[edit] Installing wxWidgets

[edit] Downloading

Download latest wxWidgets version from http://www.wxwidgets.org

[edit] Installing

We might upgrade wxWidgets often, so we will install it into it's own prefix:

mkdir -p /opt/wxWidgets
mkdir ~/source
cd ~/source
tar -xvjf /c/dev/download/wxWidgets-2.8.6.tar.bz2
cd wxWidgets-2.8.6
mkdir compile
cd compile
../configure --prefix=/opt/wxWidgets --enable-unicode --disable-shared
make
make install

Remark: If you want to run FZ3 on Windows ME or older, you have to replace --enable-unicode with --disable-unicode. But there is no guarantee that FileZilla will work properly without unicode support.

[edit] Setting environment variables

Type the following inside msys:

echo 'export PATH="$PATH:/opt/wxWidgets/bin"' >> ~/.profile
echo 'export LD_LIBRARY_PATH=/opt/wxWidgets/lib' >> ~/.profile
source ~/.profile 

And that finishes the wxWidgets installation. Lets move on to installing NSIS.

[edit] Installing NSIS

Download and install NSIS from [1]. Follow their instructions.

[edit] Installing Subversion

Download http://subversion.tigris.org/downloads/1.4.5-win32/apache-2.0/svn-win32-1.4.5.zip

Extract the archive using Explorer to c:\dev\download

Copy the contents of c:\dev\download\svn-win32-1.4.5 to c:\dev\msys

Use the following command inside msys to check if it's working:

svn --version

[edit] Compiling FileZilla 3

[edit] Download FZ3 from SVN

Type the following inside msys:

cd ~/source
svn co http://filezilla.svn.sourceforge.net/svnroot/filezilla/FileZilla3/trunk FileZilla3

[edit] Generate configure

Type the following inside msys:

cd FileZilla3
./autogen.sh

[edit] Compile FileZilla 3

Type the following inside msys:

mkdir compile
cd compile
../configure --prefix=/opt/FileZilla3
make

The resulting executable will be quite big due to debugging information. You can remove the debug info with the strip command:

strip src/interface/filezilla.exe
strip src/putty/fzsftp.exe

[edit] Generate installer

Rightclick compile/data/install.nsi in Explorer and use "Compile NSIS Script" from context menu.

[edit] Troubleshooting

If you run into problems, please make sure you've followed each step exactly how it is explained and that you haven't missed any steps along the way.

Personal tools