Editing Compiling FileZilla 3 under Windows
From FileZilla Wiki
Jump to navigationJump to searchWarning: 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]] and how to compile it under Windows using [http://msys2.github.io/ msys2]. Msys2 is a cygwin environment | + | This documentation explains how to setup a build environment for [[FileZilla 3]] and how to compile it under Windows using [http://msys2.github.io/ msys2]. Msys2 is a cygwin environment. |
It will take some time to get everything working, but you will be able to use the build environment for other programs too. | It will take some time to get everything working, but you will be able to use the build environment for other programs too. | ||
− | |||
− | |||
'''Note to wiki contributors: Do not change version numbers on your own. The build process is somewhat fragile and does break if you change things''' | '''Note to wiki contributors: Do not change version numbers on your own. The build process is somewhat fragile and does break if you change things''' | ||
Line 11: | Line 9: | ||
=Installing the MSYS2 environment= | =Installing the MSYS2 environment= | ||
− | Download the 64bit MSYS2 installer | + | Download the 64bit MSYS2 installer: [http://sourceforge.net/project/msys2/Base/x86_64/msys2-x86_64-20150512.exe msys2-x86_64-20150512.exe] |
+ | |||
+ | Install MSYS2 to '''c:\msys64'''. | ||
=Installing the compiler toolchain= | =Installing the compiler toolchain= | ||
Line 20: | Line 20: | ||
===First update=== | ===First update=== | ||
− | Start the MSYS2 | + | Start the MSYS2 shell |
pacman -Syu | pacman -Syu | ||
− | close | + | close MSYS shell, and maybe you will need rebase (Google for details, just run a autorebase.bat in C:\msys64). |
===Install tools and compiler toolchain=== | ===Install tools and compiler toolchain=== | ||
− | Start MSYS2 | + | Start MSYS2 shell, execute the following command to install the necessary packages: |
− | pacman -S | + | 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: |
# Fix missing platform prefix for windres | # Fix missing platform prefix for windres | ||
[ -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/libpthread.dll.a | ||
== Setting up the environment== | == Setting up the environment== | ||
Line 40: | Line 48: | ||
Execute the following commands: | Execute the following commands: | ||
mkdir ~/prefix | mkdir ~/prefix | ||
− | echo 'export PATH="$HOME/prefix/bin | + | 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 | + | 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 | ||
− | |||
− | Restart the | + | Restart the MSYS shell. |
=Building dependencies= | =Building dependencies= | ||
Line 53: | Line 60: | ||
cd ~ | cd ~ | ||
− | curl -O https://gmplib.org/download/gmp/gmp-6. | + | curl -O https://gmplib.org/download/gmp/gmp-6.0.0a.tar.xz |
− | tar xf gmp-6. | + | tar xf gmp-6.0.0a.tar.xz |
− | cd gmp-6. | + | cd gmp-6.0.0a |
− | ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable- | + | ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-static --disable-shared --enable-fat |
make && make install | make && make install | ||
Line 62: | Line 69: | ||
cd ~ | cd ~ | ||
− | wget | + | wget http://ftp.gnu.org/gnu/nettle/nettle-3.1.1.tar.gz |
− | tar xf nettle-3. | + | tar xf nettle-3.1.1.tar.gz |
− | cd nettle-3. | + | cd nettle-3.1.1 |
− | ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable- | + | ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-static --disable-shared --enable-fat |
make && make install | make && make install | ||
Line 71: | Line 78: | ||
cd ~ | cd ~ | ||
− | wget | + | wget http://zlib.net/zlib-1.2.8.tar.gz |
− | tar xf zlib-1.2. | + | tar xf zlib-1.2.8 |
− | cd zlib-1.2. | + | cd zlib-1.2.8 |
− | + | ./configure --prefix="$HOME/prefix" --static | |
make && make install | make && make install | ||
Line 80: | Line 87: | ||
cd ~ | cd ~ | ||
− | wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3. | + | wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4/gnutls-3.4.4.1.tar.xz |
− | tar xf gnutls-3. | + | tar xf gnutls-3.4.4.1.tar.xz |
− | cd gnutls-3. | + | cd gnutls-3.4.4.1 |
− | ./configure --prefix="$HOME/prefix" --enable- | + | ./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 |
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/ | + | wget https://sqlite.org/2015/sqlite-autoconf-3081101.tar.gz |
− | tar xf sqlite-autoconf- | + | tar xf sqlite-autoconf-3081101.tar.gz |
− | cd sqlite-autoconf- | + | cd sqlite-autoconf-3081101 |
− | ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable- | + | ./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-static --disable-shared |
make && make install | make && make install | ||
Line 98: | Line 108: | ||
cd ~ | cd ~ | ||
− | + | svn co https://github.com/wxWidgets/wxWidgets/branches/WX_3_0_BRANCH wx3 | |
cd wx3 | cd wx3 | ||
− | ./configure | + | ./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 123: | Line 124: | ||
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 134: | ||
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 | ||
− | |||
==Building the installer== | ==Building the installer== | ||
Line 139: | Line 139: | ||
=== Installing NSIS === | === Installing NSIS === | ||
− | Download and install NSIS | + | Download and install Unicode NSIS from http://www.scratchpaper.com |
+ | |||
+ | Make sure you get the Unicode version and not the ANSI one. | ||
=== Compile the installer script === | === Compile the installer script === |