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

From FileZilla Wiki
Jump to navigationJump to search
(exyBzxVqlyMaaM)
m (Reverted edits by 2600:387:2:803:0:0:0:72 (talk) to last revision by CodeSquid)
Tag: Rollback
 
(144 intermediate revisions by 15 users not shown)
Line 1: Line 1:
Back in 2001-2005 when I used Libranet (or even from 1999-2005) when Libranet was commercially avlaaible (and also freely avlaaible for testing), it was one of the finest distributions avlaaible. It had the good, solid Debian software behind it, but it had some excellent administration tools that made it really easy to manageFor a while, when it faded, yes, there were easy distributions, but not too many with good administration tools in the Debian spaceKanotix had a few, but not as good as LibranetSidux was the first distribution to bring back some good tools, but fighting over project goals and sources of income and support tore the group and team members apart multiple timesA distribution closer to the original sidux, with some similarites to the original Libranet called siduction is one of the finest distributions based on Debian SidLibranet, however, was generally built upon Debian Testing. I personally think that a distribution that could easily allow you to build your system from Stable, Testing, or Sid would be great; I know of one called antiX core, where you can grow your system from scratch and select your Debian repo as you go; it's a great idea, but perhaps a bit raw for some tastesThe antiX base aims just a bit higher and is simplerGrabbing good ideas from Libranet, siduction, and antiX, the best of each, and eventually build a couple of base platforms, perhaps one that people could just install and use (a modest, but full featured system), then a more minimal, but complete system, however one that has few applications, instead providing a simple basis for building your own, makes a second good choice, then, like antiX core, a system containing the core system essentials and a set of easy tools to build your own customized system would be ideal.The antiX systems target older systemsI think a great model for LibraNext would be to initially target newer systemsIf it grows, having one branch for newer systems and another for older systems would be nice.Whether one or two of these ideas could actually be accomplished would greatly depend on who is avlaaible to develop, test, promote, and provide ideasOne suggestion would be NOT to re-invent all of this, but grab the best ideas from the best distros; for me and my personal preferences, I'd lift the best from the likes of antiX, siduction, and MEPIS with proper permissionI'm sure other distros have great pieces; integrating them together in a light, cohesive set would be great.  Perhaps even stuff from the original Libranet could still be useful if they are freed up and made avlaaible.
+
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 ==
 +
 
 +
Any recent Linux should do the trick. For the sake of simplicity, this guide focuses on Debian(-based) distributions.
 +
 
 +
We strongly recommend to use [http://debian.org Debian '''12''' (Bookworkm)] 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 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 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>
 +
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:
 +
  https://sourceforge.net/p/mingw-w64/mingw-w64/ci/2474f3904a1fbce19d96383a9633e6c2eeb427ea/
 +
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/bca09678e3bfd67b2d445127280ee5a1d9d0453a/
 +
 
 +
Without these patches, FileZilla will not work properly and will fail in obscure ways.
 +
-->
 +
 
 +
== GMP ==
 +
 
 +
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 ==
 +
 
 +
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 ==
 +
 
 +
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 ==
 +
 
 +
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.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 ==
 +
 
 +
  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 ==
 +
 
 +
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 FileZilla ==
 +
 
 +
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.

Latest revision as of 08:45, 12 October 2023

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