Windows下编译FileZilla 3
Compiling FileZilla 3 under Windows
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 [hide]
|
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.
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.
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.
Download and install MSYS Developer Toolkit executable: http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe Install to c:\dev\msys as well.
Start msys. Type in the following commands:
echo "export LDFLAGS=-L/local/lib" > ~/.profile
echo "export CPPFLAGS=-I/local/include" >> ~/.profile
exit
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
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
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
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
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
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
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
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
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
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
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.
Download latest wxWidgets version from http://www.wxwidgets.org
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.
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.
Download and install NSIS from [1]. Follow their instructions.
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
Type the following inside msys:
cd ~/source
svn co http://filezilla.svn.sourceforge.net/svnroot/filezilla/FileZilla3/trunk FileZilla3
Type the following inside msys:
cd FileZilla3
./autogen.sh
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/interface/putty/fzsftp.exe
Rightclick compile/data/install.nsi in Explorer and use "Compile NSIS Script" from context menu.
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.