-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
121 lines (105 loc) · 4.13 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
HOST=$ARCH-w64-mingw32
PREFIX=$PWD/$HOST
PREFIX_AUTOMAKE=$PWD/automake
export MINGW_ROOT=$PWD/$(find llvm-mingw* -maxdepth 1 -type d | head -n 1)
export PATH=$PREFIX_AUTOMAKE/bin:$PATH:$MINGW_ROOT/bin:$PREFIX/bin:$PREFIX/lib:$MINGW_ROOT/$HOST/bin
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$PREFIX/lib/pkgconfig
export CFLAGS="-Wno-unused-function -Wno-unused-lambda-capture -Wno-unused-variable \
-Wno-ignored-attributes -Wno-inconsistent-missing-override \
-Wno-inconsistent-dllimport -O2"
export CXXFLAGS=$CFLAGS
echo Building for $HOST
# For some reason MinGW ARM is missing serveral libs compared to x86
# Build lib for $ARCH from i686 version
# $1 : The lib filename, in MinGW convention
# xyz.dll -> libxyz.a
function build_lib() {
LIBFILE=$1
MODULE=$(echo $LIBFILE | sed 's/lib\(.*\?\)\.a/\1/g')
DLLFILE=$(echo $MODULE | tr '/a-z/' '/A-Z/').dll
(
echo LIBRARY $DLLFILE
echo EXPORTS
$HOST-nm $MINGW_ROOT/i686-w64-mingw32/lib/$LIBFILE --just-symbol-name |
sed '/^$/d' | sed "/^$DLLFILE/d" | sed '/\.idata/d' | sed '/__imp/d' | sed '/__NULL_IMPORT/d' |
sed '/_NULL_THUNK_DATA/d' | sed '/__IMPORT_DESCRIPTOR/d' | sed 's/@.*$//g' | sed 's/^_//g'
) > $MODULE.def
$HOST-dlltool -d $MODULE.def -l $MINGW_ROOT/$HOST/lib/$LIBFILE
}
if [ $ARCH == "aarch64" ]
then
build_lib "libpowrprof.a"
build_lib "libsetupapi.a"
fi
# automake
pushd $(find automake* -maxdepth 1 -type d | head -n 1)
./configure --prefix=$PREFIX_AUTOMAKE || exit 1
make || exit 1
make install || exit 1
popd
# gmp
pushd $(find gmp* -maxdepth 1 -type d | head -n 1)
./configure --prefix=$PREFIX --host=$HOST --disable-static --enable-shared \
--disable-cxx --disable-assembly || exit 1
make -j $(nproc) || exit 1
make install || exit 1
popd
# nettle
pushd $(find nettle* -maxdepth 1 -type d | head -n 1)
./configure --prefix=$PREFIX --host=$HOST --disable-static --enable-shared --disable-assembler \
--with-include-path=$PREFIX/include --with-lib-path=$PREFIX/lib || exit 1
make -j $(nproc) || exit 1
make install || exit 1
popd
# gnutls
pushd $(find gnutls* -maxdepth 1 -type d | head -n 1)
GMP_CFLAGS="-I$PREFIX/include" GMP_LIBS="-L$PREFIX/lib -lgmp" \
./configure --prefix=$PREFIX --host=$HOST --disable-static --enable-shared --disable-cxx \
--without-p11-kit --with-included-libtasn1 --with-included-unistring --enable-local-libopts \
--disable-srp-authentication --disable-dtls-srtp-support --disable-heartbeat-support \
--disable-psk-authentication --disable-anon-authentication --disable-openssl-compatibility --without-tpm \
--disable-hardware-acceleration --disable-tools --disable-doc || exit 1
make -j $(nproc) || exit 1
make install || exit 1
popd
# sqlite
pushd $(find sqlite* -maxdepth 1 -type d | head -n 1)
./configure --prefix=$PREFIX --host=$HOST --disable-static --enable-shared || exit 1
make || exit 1
make install || exit 1
popd
# libfilezilla
pushd $(find libfilezilla* -maxdepth 1 -type d | head -n 1)
for p in ../patches/libtool/*.patch; do patch -p1 < "$p"; done
autoconf
./configure --prefix=$PREFIX --host=$HOST --disable-static --enable-shared --disable-doxygen-doc || exit 1
make -j $(nproc) || exit 1
make install || exit 1
popd
# filezilla
pushd $(find filezilla* -maxdepth 1 -type d | head -n 1)
for p in ../patches/libtool/*.patch; do patch -p1 < "$p"; done
for p in ../patches/filezilla/*.patch; do patch -p1 < "$p"; done
autoconf
pushd src/fzshellext
autoconf
popd
./configure --prefix=$PREFIX --host=$HOST --with-wx-config=$PREFIX/bin/wx-config --disable-manualupdatecheck || exit 1
make -j $(nproc) || exit 1
make install || exit 1
$HOST-strip src/interface/.libs/filezilla.exe \
src/putty/.libs/fzsftp.exe \
src/putty/.libs/fzputtygen.exe \
src/fzshellext/32/.libs/libfzshellext-0.dll \
src/fzshellext/64/.libs/libfzshellext-0.dll \
data/dlls/*.dll
pushd data
sh makezip.sh $PREFIX
mv FileZilla.zip ../../
if [ $ARCH != "armv7" ]
then
wine "../../nsis/makensis.exe" install.nsi
mv FileZilla_3_setup.exe ../../
fi
popd
popd