Editing Cross Compiling FileZilla 3 for Windows under Ubuntu or Debian GNU/Linux

From FileZilla Wiki
Jump to navigationJump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
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]].
+
apt-get install -y mingw32 make g\+\+ libtool bzip2 automake gettext wx-common
  
== OS version ==
+
mkdir fz3
 +
cd fz3
  
Any recent Linux should do the trick. For the sake of simplicity, this guide focuses on Debian(-based) distributions.
+
wget ftp://ftp.gnu.org/gnu/libiconv/libiconv-1.13.tar.gz
 +
tar zxvf libiconv-1.13.tar.gz
 +
cd libiconv-1.13
 +
./configure --prefix=/usr/i586-mingw32msvc --host=i586-mingw32msvc --disable-shared --enable-static
 +
make install clean
 +
cd ..
  
We strongly recommend to use [http://debian.org Debian '''12''' (Bookworkm)] or later ('''recommended''')
+
wget ftp://alpha.gnu.org/gnu/libidn/libidn-0.6.9.tar.gz
 +
tar zxvf libidn-0.6.9.tar.gz
 +
cd libidn-0.6.9
 +
./configure --prefix=/usr/i586-mingw32msvc --host=i586-mingw32msvc --disable-shared --enable-static
 +
make install clean
 +
cd ..
  
== Setting up the build environment ==
+
wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.7.tar.bz2
 +
tar jxvf libgpg-error-1.7.tar.bz2
 +
cd libgpg-error-1.7
 +
./configure --prefix=/usr/i586-mingw32msvc --host=i586-mingw32msvc --disable-shared --enable-static --disable-nls
 +
make install clean
 +
cd ..
  
As root, execute:
+
wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.4.4.tar.bz2
  dpkg --add-architecture i386
+
  tar jxvf libgcrypt-1.4.4.tar.bz2
  apt update
+
  cd libgcrypt-1.4.4
  apt install automake autoconf libtool make gettext lzip xz-utils
+
  ./configure --prefix=/usr/i586-mingw32msvc --host=i586-mingw32msvc --disable-shared --enable-static --disable-nls --disable-asm --with-gpg-error-prefix=/usr/i586-mingw32msvc
apt install mingw-w64 pkg-config wx-common wine wine64 wine32 wine-binfmt subversion git
+
make install clean
 +
cd ..
  
Back as normal user, execute:
+
wget ftp://ftp.gnutls.org/pub/gnutls/gnutls-2.8.3.tar.bz2
  mkdir ~/prefix
+
  tar jxvf gnutls-2.8.3.tar.bz2
  mkdir ~/src
+
  cd gnutls-2.8.3
  export PATH="$HOME/prefix/bin:$PATH"
+
  ./configure --prefix=/usr/i586-mingw32msvc --host=i586-mingw32msvc --disable-shared --enable-static --disable-nls --disable-cxx --with-libgcrypt-prefix=/usr/i586-mingw32msvc
export LD_LIBRARY_PATH="$HOME/prefix/lib:$LD_LIBRARY_PATH"
+
make install clean
export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
+
  cd ..
  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'`"
+
  wget http://nchc.dl.sourceforge.net/sourceforge/wxwindows/wxWidgets-2.8.10.tar.bz2
 +
tar jxvf wxWidgets-2.8.10.tar.bz2
 +
cd wxWidgets-2.8.10
 +
mkdir compile
 +
cd compile
 +
../configure --prefix=/usr/i586-mingw32msvc --host=i586-mingw32msvc --disable-shared --enable-static --enable-unicode
 +
make install clean
 +
cd ../..
  
<!--
+
  wget http://downloads.sourceforge.net/filezilla/FileZilla_3.2.7.1_src.tar.bz2
<p style="font-size:150%;color:#ff0000">'''Beware:''' You need to patch your MinGW runtime!</p>
+
  tar jxvf FileZilla_3.2.7.1_src.tar.bz2
Note: This does not affect mingw-w64 >= v4.0.6, mingw-w64 v4.0.6 is available in Ubuntu 16.10.
+
  cd filezilla-3.2.7.1
 
+
  ./autogen.sh
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:
+
  mkdir compile
  https://sourceforge.net/p/mingw-w64/mingw-w64/ci/2474f3904a1fbce19d96383a9633e6c2eeb427ea/
+
  cd compile
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/bca09678e3bfd67b2d445127280ee5a1d9d0453a/
+
   
 
+
  cat << EOF > /usr/i586-mingw32msvc/bin/libgnutls-config
Without these patches, FileZilla will not work properly and will fail in obscure ways.
+
  #!/bin/sh
-->
+
  echo "-L/usr/i586-mingw32msvc/lib -lgnutls -lgcrypt -lgpg-error"
 
+
  EOF
== GMP ==
+
  chmod +x /usr/i586-mingw32msvc/bin/libgnutls-config
 
+
   
cd ~/src
+
  ../configure --prefix=/usr/i586-mingw32msvc --host=i586-mingw32msvc --disable-shared --enable-static --with-wx-prefix=/usr/i586-mingw32msvc --with-libgnutls-prefix=/usr/i586-mingw32msvc
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
  make install
+
  strip src/interface/filezilla.exe
 
+
  strip src/putty/fzsftp.exe
== 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.
 

Please note that all contributions to FileZilla Wiki are considered to be released under the GNU Free Documentation License 1.2 (see FileZilla Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)