Compiling FileZilla 3 under Windows: Difference between revisions

From FileZilla Wiki
Jump to navigationJump to search
 
(131 intermediate revisions by 27 users not shown)
Line 1: Line 1:
This documentation explains how to setup a build environment for [[FileZilla 3]] and how to compile it under Windows using [http://msys2.github.io/ msys2]. Msys2 is a cygwin environment.
This documentation explains how to setup a build environment for [[FileZilla 3]] and how to compile it under Windows using [http://msys2.github.io/ msys2]. Msys2 is a cygwin environment. These instructions require you to run a 64bit Windows.


It will take some time to get everything working, but you will be able to use the build environment for other programs too.
It will take some time to get everything working, but you will be able to use the build environment for other programs too.
For complete MSYS2 system and all needed dependencies installed, you will need 7GiB free space on your disk.


'''Note to wiki contributors: Do not change version numbers on your own. The build process is somewhat fragile and does break if you change things'''
'''Note to wiki contributors: Do not change version numbers on your own. The build process is somewhat fragile and does break if you change things'''


__TOC__
__TOC__


=Installing the MSYS2 environment=
=Installing the MSYS2 environment=


[http://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-x86_64-20150202.exe msys2-x86_64-20150202.exe]
Download the 64bit MSYS2 installer and install it in a convenient location: [https://repo.msys2.org/distrib/x86_64/msys2-x86_64-20230318.exe msys2-x86_64-20230318.exe]
 
Install this to '''c:\msys64''' or '''D:\msys64''' depending on how you installed msys2


=Installing the compiler toolchain=
=Installing the compiler toolchain=
Line 20: Line 19:
==  Tools and compiler ==
==  Tools and compiler ==


start MSYS2 shell, execute the following command:
===First update===
Start the MSYS2 MinGW 64-bit shell
pacman -Syu
close MSYS2 shell. Repeat until there are no more updates.
 
===Install tools and compiler toolchain===
 
Start MSYS2 MinGW 64-bit shell, execute the following command to install the necessary packages:
 
pacman -S autoconf automake libtool make mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git svn
 
Execute the following to work around some most-annoying bugs in the toolchain
 
# Fix missing platform prefix for windres
[ -f /mingw64/bin/x86_64-w64-mingw32-windres.exe ] || ln -s /mingw64/bin/windres.exe /mingw64/bin/x86_64-w64-mingw32-windres.exe
[ -f /mingw32/bin/i686-w64-mingw32-windres.exe  ] || ln -s /mingw32/bin/windres.exe /mingw32/bin/i686-w64-mingw32-windres.exe
 
== Setting up the environment==
 
Execute the following commands:
mkdir ~/prefix
echo 'export PATH="$HOME/prefix/bin:$HOME/prefix/lib:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.profile
echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.profile
echo 'export PATH="$HOME/prefix/bin:$HOME/prefix/lib:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.bash_profile
echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.bash_profile
echo 'export LC_ALL=C' >> ~/.bash_profile


pacman -Syu base-devel msys2-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
Restart the MSYS2 MINGW64 shell.
pacman -S svn git


=Downloading dependencies=
=Building dependencies=


==download GMP==
==Building GMP==


  cd ~
  cd ~
  curl -O https://gmplib.org/download/gmp/gmp-6.0.0a.tar.xz
  curl -O https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
tar xf gmp-6.2.1.tar.xz
cd gmp-6.2.1
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
make && make install


==Download Nettle==
==Building Nettle==


  cd ~
  cd ~
  wget http://www.lysator.liu.se/~nisse/archive/nettle-2.7.1.tar.gz
  wget https://ftp.gnu.org/gnu/nettle/nettle-3.7.3.tar.gz
tar xf nettle-3.7.3.tar.gz
cd nettle-3.7.3
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
make && make install


==Download GnuTLS==
==Building zlib==


  cd ~
  cd ~
  wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.13.tar.xz
  wget https://zlib.net/fossils/zlib-1.2.13.tar.gz
tar xf zlib-1.2.13.tar.gz
cd zlib-1.2.13
LDSHAREDLIBC='' ./configure --prefix="$HOME/prefix" -u=GNU
make && make install


==Download SQLite==
==Building GnuTLS==


  cd ~
  cd ~
  wget http://sqlite.org/2015/sqlite-autoconf-3080803.tar.gz
  wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.7/gnutls-3.7.2.tar.xz
tar xf gnutls-3.7.2.tar.xz
cd gnutls-3.7.2
./configure --prefix="$HOME/prefix" --enable-shared --disable-static --build=x86_64-w64-mingw32 --with-included-libtasn1 --disable-doc --disable-guile --without-p11-kit --enable-local-libopts --disable-nls --with-included-unistring --disable-tests
make && make install


==Download wxWidgets==
==Building SQLite==


  cd ~
  cd ~
  svn co https://github.com/wxWidgets/wxWidgets/branches/WX_3_0_BRANCH wx3
  wget https://sqlite.org/2018/sqlite-autoconf-3250300.tar.gz
tar xf sqlite-autoconf-3250300.tar.gz
cd sqlite-autoconf-3250300
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static
make && make install


==Download FileZilla==
==Building wxWidgets==


  cd ~
  cd ~
  svn co https://svn.filezilla-project.org/svn/FileZilla3/trunk filezilla
  git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
cd wx3
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-unicode --enable-printfposparam --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin
make && make install


=Build Filezilla=
==Building libfilezilla==


==Fetch patch and build script==
cd ~
svn co https://svn.filezilla-project.org/svn/libfilezilla/trunk libfilezilla
cd libfilezilla
autoreconf -i
./configure --prefix="$HOME/prefix" --enable-shared --disable-static
make && make install


git clone https://github.com/rexdf/build_filezilla_on_msys2.git
=Building Filezilla=
cp build_filezilla_on_msys2/*.patch ~
cp build_filezilla_on_msys2/build.sh ~


==Build a static only zlib==
==Download FileZilla==


  git clone https://github.com/Alexpux/MINGW-packages.git
  cd ~
cd MINGW-packages
svn co https://svn.filezilla-project.org/svn/FileZilla3/trunk filezilla
git apply ../mingw-w64-zlib.patch
cd mingw-w64-zlib
makepkg-mingw -sLf
cp mingw-w64-i686-zlib-1.2.8-6-any.pkg.tar.xz ~/


==Build dependencies and filezilla==
==Building FileZilla==


===Build===
cd ~/filezilla
autoreconf -i
./configure --with-pugixml=builtin
make


./build.sh
==Stripping debug symbols==


=== Generate installer ===
strip src/interface/.libs/filezilla.exe
strip src/putty/.libs/fzsftp.exe
strip src/putty/.libs/fzputtygen.exe
strip src/fzshellext/64/.libs/libfzshellext-0.dll
strip src/fzshellext/32/.libs/libfzshellext-0.dll
strip data/dlls/*.dll


==== Installing NSIS ====
==Building the installer==


Download and install Unicode NSIS from http://www.scratchpaper.com
=== Installing NSIS ===


Make sure you get the Unicode version and not the ANSI one.
Download and install NSIS '''3''' from http://nsis.sourceforge.net/


==== Compile the installer script ====
=== Compile the installer script ===


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


== Troubleshooting ==
= 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.
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.

Latest revision as of 05:56, 15 August 2024

This documentation explains how to setup a build environment for FileZilla 3 and how to compile it under Windows using msys2. Msys2 is a cygwin environment. These instructions require you to run a 64bit Windows.

It will take some time to get everything working, but you will be able to use the build environment for other programs too.

For complete MSYS2 system and all needed dependencies installed, you will need 7GiB free space on your disk.

Note to wiki contributors: Do not change version numbers on your own. The build process is somewhat fragile and does break if you change things

Installing the MSYS2 environment[edit]

Download the 64bit MSYS2 installer and install it in a convenient location: msys2-x86_64-20230318.exe

Installing the compiler toolchain[edit]

FileZilla's shell extension needs to be build both for 32bit as well as 64bit, hence we're going to need compilers for both 32bit and 64bit.

Tools and compiler[edit]

First update[edit]

Start the MSYS2 MinGW 64-bit shell

pacman -Syu

close MSYS2 shell. Repeat until there are no more updates.

Install tools and compiler toolchain[edit]

Start MSYS2 MinGW 64-bit shell, execute the following command to install the necessary packages:

pacman -S autoconf automake libtool make mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git svn

Execute the following to work around some most-annoying bugs in the toolchain

# Fix missing platform prefix for windres
[ -f /mingw64/bin/x86_64-w64-mingw32-windres.exe ] || ln -s /mingw64/bin/windres.exe /mingw64/bin/x86_64-w64-mingw32-windres.exe
[ -f /mingw32/bin/i686-w64-mingw32-windres.exe  ] || ln -s /mingw32/bin/windres.exe /mingw32/bin/i686-w64-mingw32-windres.exe

Setting up the environment[edit]

Execute the following commands:

mkdir ~/prefix
echo 'export PATH="$HOME/prefix/bin:$HOME/prefix/lib:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.profile
echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.profile
echo 'export PATH="$HOME/prefix/bin:$HOME/prefix/lib:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.bash_profile
echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.bash_profile
echo 'export LC_ALL=C' >> ~/.bash_profile

Restart the MSYS2 MINGW64 shell.

Building dependencies[edit]

Building GMP[edit]

cd ~
curl -O https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
tar xf gmp-6.2.1.tar.xz
cd gmp-6.2.1
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
make && make install

Building Nettle[edit]

cd ~
wget https://ftp.gnu.org/gnu/nettle/nettle-3.7.3.tar.gz
tar xf nettle-3.7.3.tar.gz
cd nettle-3.7.3
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
make && make install

Building zlib[edit]

cd ~
wget https://zlib.net/fossils/zlib-1.2.13.tar.gz
tar xf zlib-1.2.13.tar.gz
cd zlib-1.2.13
LDSHAREDLIBC= ./configure --prefix="$HOME/prefix" -u=GNU
make && make install

Building GnuTLS[edit]

cd ~
wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.7/gnutls-3.7.2.tar.xz
tar xf gnutls-3.7.2.tar.xz
cd gnutls-3.7.2
./configure --prefix="$HOME/prefix" --enable-shared --disable-static --build=x86_64-w64-mingw32 --with-included-libtasn1 --disable-doc --disable-guile --without-p11-kit --enable-local-libopts --disable-nls --with-included-unistring --disable-tests
make && make install

Building SQLite[edit]

cd ~
wget https://sqlite.org/2018/sqlite-autoconf-3250300.tar.gz
tar xf sqlite-autoconf-3250300.tar.gz
cd sqlite-autoconf-3250300
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static
make && make install

Building wxWidgets[edit]

cd ~
git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
cd wx3
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-unicode --enable-printfposparam --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin
make && make install

Building libfilezilla[edit]

cd ~
svn co https://svn.filezilla-project.org/svn/libfilezilla/trunk libfilezilla
cd libfilezilla
autoreconf -i 
./configure --prefix="$HOME/prefix" --enable-shared --disable-static
make && make install

Building Filezilla[edit]

Download FileZilla[edit]

cd ~
svn co https://svn.filezilla-project.org/svn/FileZilla3/trunk filezilla

Building FileZilla[edit]

cd ~/filezilla
autoreconf -i
./configure --with-pugixml=builtin
make

Stripping debug symbols[edit]

strip src/interface/.libs/filezilla.exe
strip src/putty/.libs/fzsftp.exe
strip src/putty/.libs/fzputtygen.exe
strip src/fzshellext/64/.libs/libfzshellext-0.dll
strip src/fzshellext/32/.libs/libfzshellext-0.dll
strip data/dlls/*.dll

Building the installer[edit]

Installing NSIS[edit]

Download and install NSIS 3 from http://nsis.sourceforge.net/

Compile the installer script[edit]

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

Troubleshooting[edit]

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.