Difference between revisions of "Cross Compiling FileZilla 3 for Windows under Ubuntu or Debian GNU/Linux"

From FileZilla Wiki
Jump to navigationJump to search
Line 13: Line 13:
  
 
As root, execute:
 
As root, execute:
  dpkg --add-architecture i386 # If using a 64bit distribution ('''64bit is recommended''')
+
  dpkg --add-architecture i386
  apt-get update
+
  apt update
  apt-get install bzip2 ca-certificates gcc gettext lzip m4 mingw-w64 pkg-config wx-common wine wine32
+
  apt install automake autoconf libtool make gettext lzip
 
+
apt install mingw-w64 pkg-config wx-common wine wine32 subversion git
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:
 
Back as normal user, execute:
  export PATH="$HOME/prefix-win32/bin:$PATH"
+
mkdir ~/prefix
  export CPPFLAGS="-I$HOME/prefix-win32/include"
+
mkdir ~/src
export LDFLAGS="-L$HOME/prefix-win32/lib"
+
  export PATH="$HOME/prefix/bin:$PATH"
  export PKG_CONFIG_PATH="$HOME/prefix-win32/lib/pkgconfig"
+
  export LD_LIBRARY_PATH="-L$HOME/prefix/lib:$LD_LIBRARY_PATH"
 +
  export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
  
  
 +
<!--
 
<p style="font-size:150%;color:#ff0000">'''Beware:''' You need to patch your MinGW runtime!</p>
 
<p style="font-size:150%;color:#ff0000">'''Beware:''' You need to patch your MinGW runtime!</p>
 
Note: This does not affect mingw-w64 >= v4.0.6, mingw-w64 v4.0.6 is available in Ubuntu 16.10.
 
Note: This does not affect mingw-w64 >= v4.0.6, mingw-w64 v4.0.6 is available in Ubuntu 16.10.
Line 35: Line 35:
  
 
Without these patches, FileZilla will not work properly and will fail in obscure ways.
 
Without these patches, FileZilla will not work properly and will fail in obscure ways.
 +
-->
  
 
== GMP ==
 
== GMP ==
Line 40: Line 41:
 
  cd ~/src
 
  cd ~/src
 
  wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz
 
  wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz
  tar xvf gmp-6.1.2.tar.lz
+
  tar xf gmp-6.1.2.tar.lz
 
  cd gmp-6.1.2
 
  cd gmp-6.1.2
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --enable-fat
+
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --disable-static --enable-fat
 
  make
 
  make
 
  make install
 
  make install
Line 50: Line 51:
 
  cd ~/src
 
  cd ~/src
 
  wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.tar.gz
 
  wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.tar.gz
  tar xvf nettle-3.4.tar.gz
+
  tar xf nettle-3.4.tar.gz
 
  cd nettle-3.4
 
  cd nettle-3.4
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --enable-fat
+
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix' --enable-shared --disable-static --enable-fat LDFLAGS="-L$HOME/prefix/lib" CPPFLAGS="-I$HOME/prefix/include"
 
  make
 
  make
 
  make install
 
  make install
Line 59: Line 60:
  
 
  cd ~/src
 
  cd ~/src
  wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5/gnutls-3.5.17.tar.xz
+
  wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.5/gnutls-3.5.19.tar.xz
  tar xvf gnutls-3.5.17.tar.xz
+
  tar xvf gnutls-3.5.19.tar.xz
  cd gnutls-3.5.17
+
  cd gnutls-3.5.19
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --with-included-libtasn1 --without-p11-kit --disable-doc --enable-local-libopts --with-included-unistring
+
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --with-included-libtasn1 --without-p11-kit --disable-doc --enable-local-libopts --with-included-unistring GMP_LIBS="-L$HOME/prefix/lib -lgmp" GMP_CFLAGS="-I$HOME/prefix/include"
 
  make
 
  make
 
  make install
 
  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 ==
 
== Compile SQLite ==
  
 
  cd ~/src
 
  cd ~/src
  wget http://sqlite.org/2018/sqlite-autoconf-3220000.tar.gz
+
  wget https://sqlite.org/2018/sqlite-autoconf-3250300.tar.gz
  tar xvzf sqlite-autoconf-3220000.tar.gz
+
  tar xvzf sqlite-autoconf-3250300.tar.gz
  cd sqlite-autoconf-3220000
+
  cd sqlite-autoconf-3250300
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --disable-dynamic-extensions
+
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --disable-dynamic-extensions
 
  make
 
  make
 
  make install
 
  make install
Line 82: Line 80:
  
 
  cd ~/src
 
  cd ~/src
  wget http://prdownloads.sourceforge.net/nsis/nsis-3.0b3-setup.exe
+
  wget https://prdownloads.sourceforge.net/nsis/nsis-3.03-setup.exe
 
  wine nsis-3.0b3-setup.exe /S
 
  wine nsis-3.0b3-setup.exe /S
  
Line 91: Line 89:
  
 
  cd ~/src
 
  cd ~/src
  wget http://sourceforge.net/projects/wxwindows/files/3.0.2/wxWidgets-3.0.2.tar.bz2
+
  git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
tar xvjf wxWidgets-3.0.2.tar.bz2
+
  cd wx3
  cd wxWidgets-3.0.2
+
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared
 
 
  make
 
  make
 
  make install
 
  make install
Line 101: Line 98:
  
 
  cd ~/src
 
  cd ~/src
  wget https://download.filezilla-project.org/libfilezilla/libfilezilla-0.11.2.tar.bz2
+
  svn co https://svn.filezilla-project.org/svn/libfilezilla/tags/0.15.1 lfz
  tar xf libfilezilla-0.11.2.tar.bz2
+
  cd lfz
  cd libfilezilla-0.11.2
+
  autoreconf -i
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared
+
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static
 
  make
 
  make
 
  make install
 
  make install
 +
cp $HOME/prefix/lib/wx*.dll $HOME/prefix/bin
  
 
== Compile FileZilla ==
 
== Compile FileZilla ==
  
 
  cd ~/src
 
  cd ~/src
  wget http://download.filezilla-project.org/client/FileZilla_3.30.0_src.tar.bz2
+
  svn co https://svn.filezilla-project.org/svn/libfilezilla/tags/3.39.0 fz
tar xvjf FileZilla_3.30.0_src.tar.bz2
+
  cd fz
  cd filezilla-3.30.0
+
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --with-pugixml=builtin
  ./configure --host=i686-w64-mingw32 --with-pugixml=builtin LDFLAGS="-static-libgcc -static-libstdc++"
 
 
  make
 
  make
 
  # strip debug symbols
 
  # strip debug symbols
  i686-w64-mingw32-strip src/interface/.libs/filezilla.exe
+
  x86_64-w64-mingw32-strip src/interface/.libs/filezilla.exe
  i686-w64-mingw32-strip src/putty/.libs/fzsftp.exe
+
  x86_64-w64-mingw32-strip src/putty/.libs/fzsftp.exe
  i686-w64-mingw32-strip src/putty/.libs/fzputtygen.exe
+
  x86_64-w64-mingw32-strip src/putty/.libs/fzputtygen.exe
  i686-w64-mingw32-strip src/fzshellext/64/.libs/libfzshellext-0.dll
+
  x86_64-w64-mingw32-strip src/fzshellext/64/.libs/libfzshellext-0.dll
  i686-w64-mingw32-strip src/fzshellext/32/.libs/libfzshellext-0.dll
+
  x86_64-w64-mingw32-strip src/fzshellext/32/.libs/libfzshellext-0.dll
 +
x86_64-w64-mingw32-strip data/dlls/*.dll
 
  cd data
 
  cd data
 
  wine "$HOME/.wine/drive_c/Program Files/NSIS/makensis.exe" install.nsi
 
  wine "$HOME/.wine/drive_c/Program Files/NSIS/makensis.exe" install.nsi
  
 
Voila, there's now FileZilla_3_setup.exe in the current directory.
 
Voila, there's now FileZilla_3_setup.exe in the current directory.

Revision as of 13:35, 6 December 2018

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:

Setting up the build environment

As root, execute:

dpkg --add-architecture i386
apt update
apt install automake autoconf libtool make gettext lzip
apt install mingw-w64 pkg-config wx-common wine wine32 subversion git

Back as normal user, execute:

mkdir ~/prefix
mkdir ~/src
export PATH="$HOME/prefix/bin:$PATH"
export LD_LIBRARY_PATH="-L$HOME/prefix/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig:$PKG_CONFIG_PATH"


GMP

cd ~/src
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz
tar xf gmp-6.1.2.tar.lz
cd gmp-6.1.2
./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --disable-static --enable-fat
make
make install

Nettle

cd ~/src
wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.tar.gz
tar xf nettle-3.4.tar.gz
cd nettle-3.4
./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix' --enable-shared --disable-static --enable-fat LDFLAGS="-L$HOME/prefix/lib" CPPFLAGS="-I$HOME/prefix/include"
make
make install

GnuTLS

cd ~/src
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.5/gnutls-3.5.19.tar.xz
tar xvf gnutls-3.5.19.tar.xz
cd gnutls-3.5.19
./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --with-included-libtasn1 --without-p11-kit --disable-doc --enable-local-libopts --with-included-unistring GMP_LIBS="-L$HOME/prefix/lib -lgmp" GMP_CFLAGS="-I$HOME/prefix/include"
make
make install

Compile SQLite

cd ~/src
wget https://sqlite.org/2018/sqlite-autoconf-3250300.tar.gz
tar xvzf sqlite-autoconf-3250300.tar.gz
cd sqlite-autoconf-3250300
./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --disable-dynamic-extensions
make
make install

NSIS

cd ~/src
wget https://prdownloads.sourceforge.net/nsis/nsis-3.03-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
git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
cd wx3
./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static
make
make install

Compile libfilezilla

cd ~/src
svn co https://svn.filezilla-project.org/svn/libfilezilla/tags/0.15.1 lfz
cd lfz
autoreconf -i
./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static 
make
make install
cp $HOME/prefix/lib/wx*.dll $HOME/prefix/bin

Compile FileZilla

cd ~/src
svn co https://svn.filezilla-project.org/svn/libfilezilla/tags/3.39.0 fz
cd fz
./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --with-pugixml=builtin
make
# strip debug symbols
x86_64-w64-mingw32-strip src/interface/.libs/filezilla.exe
x86_64-w64-mingw32-strip src/putty/.libs/fzsftp.exe
x86_64-w64-mingw32-strip src/putty/.libs/fzputtygen.exe
x86_64-w64-mingw32-strip src/fzshellext/64/.libs/libfzshellext-0.dll
x86_64-w64-mingw32-strip src/fzshellext/32/.libs/libfzshellext-0.dll
x86_64-w64-mingw32-strip data/dlls/*.dll
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.