Editing Compiling FileZilla 3 under Windows

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 11: Line 11:
 
=Installing the MSYS2 environment=
 
=Installing the MSYS2 environment=
  
Download the 64bit MSYS2 installer and install it in a convenient location: [https://repo.msys2.org/distrib/x86_64/msys2-x86_64-20220118.exe msys2-x86_64-20220118.exe]
+
Download the 64bit MSYS2 installer and install it in a convenient location: [http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe msys2-x86_64-20180531.exe]
  
 
=Installing the compiler toolchain=
 
=Installing the compiler toolchain=
Line 22: Line 22:
 
Start the MSYS2 MinGW 64-bit shell
 
Start the MSYS2 MinGW 64-bit shell
 
  pacman -Syu
 
  pacman -Syu
close MSYS2 shell. Repeat until there are no more updates.
+
close MSYS2 shell.
  
 
===Install tools and compiler toolchain===
 
===Install tools and compiler toolchain===
  
Start MSYS2 MinGW 64-bit shell, execute the following command to install the necessary packages:
+
Start MSYS2 shell, execute the following command to install the necessary packages:
  
  pacman -S autoconf automake libtool make mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git svn
+
  pacman -S base-devel msys2-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain  
 +
pacman -S svn git curl wget
 +
pacman -S ca-certificates
  
 
Execute the following to work around some most-annoying bugs in the toolchain
 
Execute the following to work around some most-annoying bugs in the toolchain
Line 35: Line 37:
 
  [ -f /mingw64/bin/x86_64-w64-mingw32-windres.exe ] || ln -s /mingw64/bin/windres.exe /mingw64/bin/x86_64-w64-mingw32-windres.exe
 
  [ -f /mingw64/bin/x86_64-w64-mingw32-windres.exe ] || ln -s /mingw64/bin/windres.exe /mingw64/bin/x86_64-w64-mingw32-windres.exe
 
  [ -f /mingw32/bin/i686-w64-mingw32-windres.exe  ] || ln -s /mingw32/bin/windres.exe /mingw32/bin/i686-w64-mingw32-windres.exe
 
  [ -f /mingw32/bin/i686-w64-mingw32-windres.exe  ] || ln -s /mingw32/bin/windres.exe /mingw32/bin/i686-w64-mingw32-windres.exe
 +
 +
# Even when statically linking to libstdc++, it still tries to dynamically link to lib(win)pthread. On top of it, libtool is too
 +
# stupid to recognize the semantics of -Wl,-Bstatic. This leaves one option: Removing the dynamic import libraries.
 +
rm /mingw32/i686-w64-mingw32/lib/libpthread.dll.a
 +
rm /mingw32/i686-w64-mingw32/lib/libwinpthread.dll.a
 +
rm /mingw64/x86_64-w64-mingw32/lib/libpthread.dll.a
 +
rm /mingw64/x86_64-w64-mingw32/lib/libwinpthread.dll.a
  
 
== Setting up the environment==
 
== Setting up the environment==
Line 40: Line 49:
 
Execute the following commands:
 
Execute the following commands:
 
  mkdir ~/prefix
 
  mkdir ~/prefix
  echo 'export PATH="$HOME/prefix/bin:$HOME/prefix/lib:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.profile
+
  echo 'export PATH="$HOME/prefix/bin:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.profile
 
  echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.profile
 
  echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.profile
  echo 'export PATH="$HOME/prefix/bin:$HOME/prefix/lib:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.bash_profile
+
  echo 'export PATH="$HOME/prefix/bin:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.bash_profile
 
  echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.bash_profile
 
  echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.bash_profile
echo 'export LC_ALL=C' >> ~/.bash_profile
 
  
Restart the MSYS2 MINGW64 shell.
+
Restart the MSYS2 shell.
  
 
=Building dependencies=
 
=Building dependencies=
Line 53: Line 61:
  
 
  cd ~
 
  cd ~
  curl -O https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
+
  curl -O https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
  tar xf gmp-6.2.1.tar.xz
+
  tar xf gmp-6.1.2.tar.xz
  cd gmp-6.2.1
+
  cd gmp-6.1.2
  ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
+
  ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-static --disable-shared --enable-fat
 
  make && make install
 
  make && make install
  
Line 62: Line 70:
  
 
  cd ~
 
  cd ~
  wget https://ftp.gnu.org/gnu/nettle/nettle-3.7.3.tar.gz
+
  wget http://ftp.gnu.org/gnu/nettle/nettle-3.3.tar.gz
  tar xf nettle-3.7.3.tar.gz
+
  tar xf nettle-3.3.tar.gz
  cd nettle-3.7.3
+
  cd nettle-3.3
  ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
+
  ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-static --disable-shared --enable-fat
 
  make && make install
 
  make && make install
  
Line 71: Line 79:
  
 
  cd ~
 
  cd ~
  wget https://zlib.net/fossils/zlib-1.2.13.tar.gz
+
  wget http://zlib.net/zlib-1.2.11.tar.gz
  tar xf zlib-1.2.13.tar.gz
+
  tar xf zlib-1.2.11.tar.gz
  cd zlib-1.2.13
+
  cd zlib-1.2.11
  LDSHAREDLIBC='' ./configure --prefix="$HOME/prefix" -u=GNU
+
  ./configure --prefix="$HOME/prefix" --static -u=GNU
 
  make && make install
 
  make && make install
  
Line 80: Line 88:
  
 
  cd ~
 
  cd ~
  wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.7/gnutls-3.7.2.tar.xz
+
  wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5/gnutls-3.5.15.tar.xz
  tar xf gnutls-3.7.2.tar.xz
+
  tar xf gnutls-3.5.15.tar.xz
  cd gnutls-3.7.2
+
  cd gnutls-3.5.15
  ./configure --prefix="$HOME/prefix" --enable-shared --disable-static --build=x86_64-w64-mingw32 --with-included-libtasn1 --disable-doc --disable-guile --without-p11-kit --enable-local-libopts --disable-nls --with-included-unistring --disable-tests
+
  ./configure --prefix="$HOME/prefix" --enable-static --disable-shared --build=x86_64-w64-mingw32 --with-included-libtasn1 --disable-doc --disable-guile --without-p11-kit --enable-local-libopts --disable-nls --with-included-unistring
 
  make && make install
 
  make && 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/include/gnutls/gnutls.h"
  
 
==Building SQLite==
 
==Building SQLite==
  
 
  cd ~
 
  cd ~
  wget https://sqlite.org/2018/sqlite-autoconf-3250300.tar.gz
+
  wget https://sqlite.org/2017/sqlite-autoconf-3200100.tar.gz
  tar xf sqlite-autoconf-3250300.tar.gz
+
  tar xf sqlite-autoconf-3200100.tar.gz
  cd sqlite-autoconf-3250300
+
  cd sqlite-autoconf-3200100
  ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static
+
  ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-static --disable-shared
 
  make && make install
 
  make && make install
  
Line 98: Line 109:
  
 
  cd ~
 
  cd ~
  git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
+
  svn co https://github.com/wxWidgets/wxWidgets/branches/WX_3_0_BRANCH wx3
 
  cd wx3
 
  cd wx3
  ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-unicode --enable-printfposparam --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin
+
  ./configure --prefix="$HOME/prefix" --enable-static --disable-shared --build=x86_64-w64-mingw32 --enable-unicode --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin
 
  make && make install
 
  make && make install
  
Line 109: Line 120:
 
  cd libfilezilla
 
  cd libfilezilla
 
  autoreconf -i  
 
  autoreconf -i  
  ./configure --prefix="$HOME/prefix" --enable-shared --disable-static
+
  ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-static --disable-shared
 
  make && make install
 
  make && make install
  
Line 123: Line 134:
 
  cd ~/filezilla
 
  cd ~/filezilla
 
  autoreconf -i
 
  autoreconf -i
  ./configure --with-pugixml=builtin
+
  ./configure --build=x86_64-w64-mingw32 --with-pugixml=builtin LDFLAGS="-static-libgcc -static-libstdc++"
 
  make
 
  make
  
Line 133: Line 144:
 
  strip src/fzshellext/64/.libs/libfzshellext-0.dll
 
  strip src/fzshellext/64/.libs/libfzshellext-0.dll
 
  strip src/fzshellext/32/.libs/libfzshellext-0.dll
 
  strip src/fzshellext/32/.libs/libfzshellext-0.dll
strip data/dlls/*.dll
 
  
 
==Building the installer==
 
==Building the installer==

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)