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

From FileZilla Wiki
Jump to navigationJump to search
 
(92 intermediate revisions by 10 users not shown)
Line 1: Line 1:
This documentation explains how to setup a build environment for [[FileZilla 3]] '''for Windows''' and how to compile it under [http://ubuntu.com Ubuntu] or [http://debian.org Debian] using [http://mingw-w64.sourceforge.net/ Mingw-w64]. It will take less time and is more simple than [[Compiling FileZilla 3 under Windows]].
+
This documentation explains how to setup a build environment for [[FileZilla 3]] '''for Windows''' and how to compile it under [https://debian.org Debian] using [https://mingw-w64.org/ Mingw-w64]. It will take less time and is more simple than [[Compiling FileZilla 3 under Windows]].
  
 
== OS version ==
 
== OS version ==
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.
  
Known-good Debian(-based) distributions:
+
We strongly recommend to use [http://debian.org Debian '''12''' (Bookworkm)] or later ('''recommended''')
 
 
* [http://debian.org Debian '''8''' (Jessie)] or later ('''recommended''')
 
* [http://ubuntu.com Ubuntu] 14.04 LTS or later
 
  
 
== Setting up the build environment ==
 
== Setting up the build environment ==
  
 
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 xz-utils
 
+
apt install mingw-w64 pkg-config wx-common wine wine64 wine32 wine-binfmt 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 LDFLAGS="-L$HOME/prefix/lib:$LDFLAGS"
 +
  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'`"
  
 +
<!--
 
<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.
  
 
The version of the MinGW runtime ships with Debian based distributions has broken string conversion functions. You need to fetch the source of the mingw-64 packet and apply the following two patches:
 
The version of the MinGW runtime ships with Debian based distributions has broken string conversion functions. You need to fetch the source of the mingw-64 packet and apply the following two patches:
Line 34: 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 ==
  
 
  cd ~/src
 
  cd ~/src
  wget https://gmplib.org/download/gmp/gmp-6.1.1.tar.lz
+
  wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.lz
  tar xvf gmp-6.1.1.tar.lz
+
  tar xf gmp-6.3.0.tar.lz
  cd gmp-6.1.1
+
  cd gmp-6.3.0
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --enable-fat
+
  CC_FOR_BUILD=gcc ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --disable-static --enable-shared --enable-fat
 
  make
 
  make
 
  make install
 
  make install
Line 48: Line 50:
  
 
  cd ~/src
 
  cd ~/src
  wget https://ftp.gnu.org/gnu/nettle/nettle-3.2.tar.gz
+
  wget https://ftp.gnu.org/gnu/nettle/nettle-3.9.1.tar.gz
  tar xvf nettle-3.2.tar.gz
+
  tar xf nettle-3.9.1.tar.gz
  cd nettle-3.2
+
  cd nettle-3.9.1
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --enable-fat
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
 
  make
 
  make
 
  make install
 
  make install
Line 58: Line 60:
  
 
  cd ~/src
 
  cd ~/src
  wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4/gnutls-3.4.16.tar.lz
+
  wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.1.tar.xz
  tar xvf gnutls-3.4.16.tar.lz
+
  tar xvf gnutls-3.8.1.tar.xz
  cd gnutls-3.4.16
+
  cd gnutls-3.8.1
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --with-included-libtasn1 --without-p11-kit --disable-doc --enable-local-libopts
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --without-p11-kit --with-included-libtasn1 --with-included-unistring --disable-srp-authentication --disable-dtls-srtp-support --disable-heartbeat-support --disable-psk-authentication --disable-anon-authentication --disable-openssl-compatibility --without-tpm --without-brotli --disable-cxx --disable-doc --enable-threads=windows --disable-tools
 
  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/2016/sqlite-autoconf-3110100.tar.gz
+
  wget https://sqlite.org/2018/sqlite-autoconf-32600-00.tar.gz
  tar xvzf sqlite-autoconf-3110100.tar.gz
+
  tar xvzf sqlite-autoconf-3260000.tar.gz
  cd sqlite-autoconf-3110100
+
  cd sqlite-autoconf-3260000
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared --disable-dynamic-extensions
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --disable-dynamic-extensions
 
  make
 
  make
 
  make install
 
  make install
Line 81: 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.09-setup.exe
  wine nsis-3.0b3-setup.exe /S
+
  wine nsis-3.09-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 90: 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=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared
 
 
  make
 
  make
 
  make install
 
  make install
 +
cp $HOME/prefix/lib/wx*.dll $HOME/prefix/bin
  
 
== Compile libfilezilla ==
 
== Compile libfilezilla ==
  
 
  cd ~/src
 
  cd ~/src
  wget https://download.filezilla-project.org/libfilezilla/libfilezilla-0.4.0.1.tar.bz2
+
  svn co https://svn.filezilla-project.org/svn/libfilezilla/tags/0.33.0 lfz
  tar xf libfilezilla-0.4.0.1.tar.bz2
+
  cd lfz
  cd libfilezilla-0.4.0.1
+
  autoreconf -i
  ./configure --host=i686-w64-mingw32 --prefix="$HOME/prefix-win32" --disable-shared
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static
 
  make
 
  make
 
  make install
 
  make install
 +
 +
== Compile Boost Regex ==
 +
 +
cd ~/src
 +
wget https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.tar.bz2
 +
tar xf boost_1_85_0.tar.bz2
 +
cd boost_1_85_0
 +
echo "using gcc :  : x86_64-w64-mingw32-g++ ;" > user-config.jam
 +
./bootstrap-sh
 +
./b2 --user-config=./user-config.jam --build-type=minimal --with-regex --prefix=$HOME/prefix install
  
 
== Compile FileZilla ==
 
== Compile FileZilla ==
  
 
  cd ~/src
 
  cd ~/src
  wget http://download.filezilla-project.org/client/FileZilla_3.16.1_src.tar.bz2
+
  svn co https://svn.filezilla-project.org/svn/FileZilla3/tags/3.56.0/ fz
  tar xvjf FileZilla_3.16.1_src.tar.bz2
+
  cd fz
  cd filezilla-3.16.1
+
  autoreconf -i
  ./configure --host=i686-w64-mingw32 --with-pugixml=builtin
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --with-pugixml=builtin
 
  make
 
  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
 
  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.

Latest revision as of 11:34, 8 May 2024

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[edit]

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 12 (Bookworkm) or later (recommended)

Setting up the build environment[edit]

As root, execute:

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

Back as normal user, execute:

mkdir ~/prefix
mkdir ~/src
export PATH="$HOME/prefix/bin:$PATH"
export LDFLAGS="-L$HOME/prefix/lib:$LDFLAGS"
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[edit]

cd ~/src
wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.lz
tar xf gmp-6.3.0.tar.lz
cd gmp-6.3.0
CC_FOR_BUILD=gcc ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --disable-static --enable-shared --enable-fat
make
make install

Nettle[edit]

cd ~/src
wget https://ftp.gnu.org/gnu/nettle/nettle-3.9.1.tar.gz
tar xf nettle-3.9.1.tar.gz
cd nettle-3.9.1
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
make
make install

GnuTLS[edit]

cd ~/src
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.1.tar.xz
tar xvf gnutls-3.8.1.tar.xz
cd gnutls-3.8.1
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --without-p11-kit --with-included-libtasn1 --with-included-unistring --disable-srp-authentication --disable-dtls-srtp-support --disable-heartbeat-support --disable-psk-authentication --disable-anon-authentication --disable-openssl-compatibility --without-tpm --without-brotli --disable-cxx --disable-doc --enable-threads=windows --disable-tools
make
make install

Compile SQLite[edit]

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[edit]

cd ~/src
wget https://prdownloads.sourceforge.net/nsis/nsis-3.09-setup.exe
wine nsis-3.09-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[edit]

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
cp $HOME/prefix/lib/wx*.dll $HOME/prefix/bin

Compile libfilezilla[edit]

cd ~/src
svn co https://svn.filezilla-project.org/svn/libfilezilla/tags/0.33.0 lfz
cd lfz
autoreconf -i
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static 
make
make install

Compile Boost Regex[edit]

cd ~/src
wget https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.tar.bz2
tar xf boost_1_85_0.tar.bz2
cd boost_1_85_0
echo "using gcc :  : x86_64-w64-mingw32-g++ ;" > user-config.jam
./bootstrap-sh
./b2 --user-config=./user-config.jam --build-type=minimal --with-regex --prefix=$HOME/prefix install

Compile FileZilla[edit]

cd ~/src
svn co https://svn.filezilla-project.org/svn/FileZilla3/tags/3.56.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.