-
Notifications
You must be signed in to change notification settings - Fork 2
/
build
executable file
·98 lines (79 loc) · 2.23 KB
/
build
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
#!/usr/bin/env bash
#
# build-wget
#
# Build a standalone wget that supports TLS. This script is to be executed
# in a Docker container running the toltec-dev/base image. The resulting
# binary will be written to /root/wget
#
if [[ -z $SYSROOT ]]; then
echo "This script must be executed in a Docker container running the"
echo "toltec-dev/base image. The \$SYSROOT variable was not found."
exit 1
fi
set -e
# Curl command with flags suitable for scripting, restricted to HTTPS
rsecurl() {
curl --fail --silent --tlsv1.2 --proto '=https' "$@"
}
# Download and verify checksum
fetch() {
rsecurl -o "$2" "$1"
sha256sum -c <(echo "$3 $2") > /dev/null
}
cd /root
# Build Nettle
mkdir nettle-build
pushd nettle-build
fetch https://ftp.gnu.org/gnu/nettle/nettle-3.7.tar.gz nettle.tar.gz \
f001f64eb444bf13dd91bceccbc20acbc60c4311d6e2b20878452eb9a9cec75a
tar --strip-components=1 -zxf nettle.tar.gz
rm nettle.tar.gz
./configure \
--prefix="$SYSROOT/usr" \
--host="$CHOST" \
--enable-mini-gmp \
--disable-shared \
--disable-documentation \
--disable-assembler
make -j $(nproc)
make install
popd
rm -r nettle-build
# Build GnuTLS
mkdir gnutls-build
pushd gnutls-build
fetch https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.0.tar.xz gnutls.tar.xz \
49e2a22691d252c9f24a9829b293a8f359095bc5a818351f05f1c0a5188a1df8
tar --strip-components=1 -Jxf gnutls.tar.xz
rm gnutls.tar.xz
./configure \
--prefix="$SYSROOT/usr" \
--host="$CHOST" \
--disable-doc \
--enable-static \
--with-nettle-mini \
--with-included-libtasn1 \
--with-included-unistring \
--without-p11-kit
make -j $(nproc)
make install
popd
rm -r gnutls-build
# Build wget
mkdir wget-build
pushd wget-build
fetch https://ftp.gnu.org/gnu/wget/wget-1.21.1.tar.gz wget.tar.gz \
59ba0bdade9ad135eda581ae4e59a7a9f25e3a4bde6a5419632b31906120e26e
tar --strip-components=1 -zxf wget.tar.gz
rm wget.tar.gz
export GNUTLS_LIBS="-L$SYSROOT/usr/lib -Wl,-Bstatic -lgnutls -Wl,-Bdynamic -pthread -latomic -lhogweed -lnettle"
./configure \
--prefix="$SYSROOT/usr" \
--host="$CHOST"
make -j $(nproc)
popd
mv wget-build/src/wget .
rm -r wget-build
# Strip symbols from the resulting binary
${CROSS_COMPILE}strip --strip-all wget