-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathopenssl.sh
49 lines (40 loc) · 898 Bytes
/
openssl.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
set -ex
main() {
local version=1.0.2m
local os=$1 \
triple=$2
local dependencies=(
ca-certificates
curl
m4
make
perl
)
# NOTE cross toolchain must be already installed
apt-get update
local purge_list=()
for dep in ${dependencies[@]}; do
if ! dpkg -L $dep; then
apt-get install --no-install-recommends -y $dep
purge_list+=( $dep )
fi
done
td=$(mktemp -d)
pushd $td
curl https://www.openssl.org/source/openssl-$version.tar.gz | \
tar --strip-components=1 -xz
AR=${triple}ar CC=${triple}gcc ./Configure \
--prefix=/openssl \
no-dso \
$os \
-fPIC \
${@:3}
nice make -j$(nproc)
make install
# clean up
apt-get purge --auto-remove -y ${purge_list[@]}
popd
rm -rf $td
rm $0
}
main "${@}"