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

From FileZilla Wiki
Jump to navigationJump to search
(19 intermediate revisions by 4 users not shown)
Line 5: Line 5:
 
Any recent Linux should do the trick. For the sake of simplicity, this guide focuses on Debian(-based) distributions.
 
Any recent Linux should do the trick. For the sake of simplicity, this guide focuses on Debian(-based) distributions.
  
We stronly recommend to use [http://debian.org Debian '''9''' (Stretch)] or later ('''recommended''')
+
We strongly recommend to use [http://debian.org Debian '''10''' (Buster)] or later ('''recommended''')
  
 
== Setting up the build environment ==
 
== Setting up the build environment ==
Line 13: Line 13:
 
  apt update
 
  apt update
 
  apt install automake autoconf libtool make gettext lzip
 
  apt install automake autoconf libtool make gettext lzip
  apt install mingw-w64 pkg-config wx-common wine wine32 subversion git
+
  apt install mingw-w64 pkg-config wx-common wine wine32 wine-binfmt subversion git
  
 
Back as normal user, execute:
 
Back as normal user, execute:
Line 21: Line 21:
 
  export LD_LIBRARY_PATH="$HOME/prefix/lib:$LD_LIBRARY_PATH"
 
  export LD_LIBRARY_PATH="$HOME/prefix/lib:$LD_LIBRARY_PATH"
 
  export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
 
  export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
 +
export TARGET_HOST=x86_64-w64-mingw32
  
 +
wine reg add HKCU\\Environment /f /v PATH /d "`x86_64-w64-mingw32-g++ -print-search-dirs | grep ^libraries | sed 's/^libraries: =//' | sed 's/:/;z:/g' | sed 's/^\\//z:\\\\\\\\/' | sed 's/\\//\\\\/g'`"
  
 
<!--
 
<!--
Line 40: Line 42:
 
  tar xf 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=x86_64-w64-mingw32 --prefix="$HOME/prefix" --disable-static --enable-fat
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --disable-static --enable-shared --enable-fat
 
  make
 
  make
 
  make install
 
  make install
Line 47: Line 49:
  
 
  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.1.tar.gz
  tar xf nettle-3.4.tar.gz
+
  tar xf nettle-3.4.1.tar.gz
  cd nettle-3.4
+
  cd nettle-3.4.1
  ./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"
+
  ./configure --host=$TARGET_HOST --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 57: Line 59:
  
 
  cd ~/src
 
  cd ~/src
  wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.5/gnutls-3.5.19.tar.xz
+
  wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.8.tar.xz
  tar xvf gnutls-3.5.19.tar.xz
+
  tar xvf gnutls-3.6.8.tar.xz
  cd gnutls-3.5.19
+
  cd gnutls-3.6.8
  ./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"
+
  ./configure --host=$TARGET_HOST --enable-shared --disable-static --without-p11-kit --with-included-libtasn1 --with-included-unistring --enable-local-libopts --disable-srp-authentication --disable-dtls-srtp-support --disable-heartbeat-support --disable-psk-authentication --disable-anon-authentication --disable-openssl-compatibility --without-tpm --disable-cxx
 
  make
 
  make
 
  make install
 
  make install
+
 
 
== Compile SQLite ==
 
== Compile SQLite ==
  
 
  cd ~/src
 
  cd ~/src
  wget https://sqlite.org/2018/sqlite-autoconf-3250300.tar.gz
+
  wget https://sqlite.org/2018/sqlite-autoconf-32600-00.tar.gz
  tar xvzf sqlite-autoconf-3250300.tar.gz
+
  tar xvzf sqlite-autoconf-3260000.tar.gz
  cd sqlite-autoconf-3250300
+
  cd sqlite-autoconf-3260000
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --disable-dynamic-extensions
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --disable-dynamic-extensions
 
  make
 
  make
 
  make install
 
  make install
Line 77: Line 79:
  
 
  cd ~/src
 
  cd ~/src
  wget https://prdownloads.sourceforge.net/nsis/nsis-3.03-setup.exe
+
  wget https://prdownloads.sourceforge.net/nsis/nsis-3.04-setup.exe
  wine nsis-3.03-setup.exe /S
+
  wine nsis-3.04-setup.exe /S
  
 
The above may print a lot of errors and warnings. Ignore them, check for success this way:
 
The above may print a lot of errors and warnings. Ignore them, check for success this way:
Line 88: Line 90:
 
  git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
 
  git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
 
  cd wx3
 
  cd wx3
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static
 
  make
 
  make
 
  make install
 
  make install
Line 98: Line 100:
 
  cd lfz
 
  cd lfz
 
  autoreconf -i
 
  autoreconf -i
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static  
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static  
 
  make
 
  make
 
  make install
 
  make install
Line 106: Line 108:
  
 
  cd ~/src
 
  cd ~/src
  svn co https://svn.filezilla-project.org/svn/libfilezilla/tags/3.39.0 fz
+
  svn co https://svn.filezilla-project.org/svn/FileZilla3/tags/3.40.0/ fz
 
  cd fz
 
  cd fz
  ./configure --host=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --with-pugixml=builtin
+
autoreconf -i
 +
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --with-pugixml=builtin
 
  make
 
  make
 
  # strip debug symbols
 
  # strip debug symbols
  x86_64-w64-mingw32-strip src/interface/.libs/filezilla.exe
+
  $TARGET_HOST-strip src/interface/.libs/filezilla.exe
  x86_64-w64-mingw32-strip src/putty/.libs/fzsftp.exe
+
  $TARGET_HOST-strip src/putty/.libs/fzsftp.exe
  x86_64-w64-mingw32-strip src/putty/.libs/fzputtygen.exe
+
  $TARGET_HOST-strip src/putty/.libs/fzputtygen.exe
  x86_64-w64-mingw32-strip src/fzshellext/64/.libs/libfzshellext-0.dll
+
  $TARGET_HOST-strip src/fzshellext/64/.libs/libfzshellext-0.dll
  x86_64-w64-mingw32-strip src/fzshellext/32/.libs/libfzshellext-0.dll
+
  $TARGET_HOST-strip src/fzshellext/32/.libs/libfzshellext-0.dll
  x86_64-w64-mingw32-strip data/dlls/*.dll
+
  $TARGET_HOST-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 09:04, 19 June 2019

This documentation explains how to setup a build environment for FileZilla 3 for Windows and how to compile it under 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.

We strongly recommend to use Debian 10 (Buster) or later (recommended)

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 wine-binfmt subversion git

Back as normal user, execute:

mkdir ~/prefix
mkdir ~/src
export PATH="$HOME/prefix/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/prefix/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
export TARGET_HOST=x86_64-w64-mingw32
wine reg add HKCU\\Environment /f /v PATH /d "`x86_64-w64-mingw32-g++ -print-search-dirs | grep ^libraries | sed 's/^libraries: =//' | sed 's/:/;z:/g' | sed 's/^\\//z:\\\\\\\\/' | sed 's/\\//\\\\/g'`"


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=$TARGET_HOST --prefix="$HOME/prefix" --disable-static --enable-shared --enable-fat
make
make install

Nettle

cd ~/src
wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz
tar xf nettle-3.4.1.tar.gz
cd nettle-3.4.1
./configure --host=$TARGET_HOST --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.6/gnutls-3.6.8.tar.xz
tar xvf gnutls-3.6.8.tar.xz
cd gnutls-3.6.8
./configure --host=$TARGET_HOST --enable-shared --disable-static --without-p11-kit --with-included-libtasn1 --with-included-unistring --enable-local-libopts --disable-srp-authentication --disable-dtls-srtp-support --disable-heartbeat-support --disable-psk-authentication --disable-anon-authentication --disable-openssl-compatibility --without-tpm --disable-cxx
make
make install

Compile SQLite

cd ~/src
wget https://sqlite.org/2018/sqlite-autoconf-32600-00.tar.gz
tar xvzf sqlite-autoconf-3260000.tar.gz
cd sqlite-autoconf-3260000
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --disable-dynamic-extensions
make
make install

NSIS

cd ~/src
wget https://prdownloads.sourceforge.net/nsis/nsis-3.04-setup.exe
wine nsis-3.04-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=$TARGET_HOST --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=$TARGET_HOST --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/FileZilla3/tags/3.40.0/ fz
cd fz
autoreconf -i
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --with-pugixml=builtin
make
# strip debug symbols
$TARGET_HOST-strip src/interface/.libs/filezilla.exe
$TARGET_HOST-strip src/putty/.libs/fzsftp.exe
$TARGET_HOST-strip src/putty/.libs/fzputtygen.exe
$TARGET_HOST-strip src/fzshellext/64/.libs/libfzshellext-0.dll
$TARGET_HOST-strip src/fzshellext/32/.libs/libfzshellext-0.dll
$TARGET_HOST-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.