forked from microsoft/libHttpClient
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenssl_Linux.bash
More file actions
84 lines (73 loc) · 2.44 KB
/
openssl_Linux.bash
File metadata and controls
84 lines (73 loc) · 2.44 KB
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
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
OPENSSL_SRC="$SCRIPT_DIR/../../External/openssl"
CONFIGURATION="Release"
while [[ $# -gt 0 ]]; do
case $1 in
-c|--config)
CONFIGURATION="$2"
shift # past argument
shift # past value
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done
# Skip hwclock if not available
if command -v hwclock >/dev/null 2>&1; then
sudo hwclock --hctosys
fi
sudo rm -rf /usr/local/ssl
sudo mkdir /usr/local/ssl
sudo mkdir /usr/local/ssl/lib
sudo mkdir /usr/local/ssl/include
sudo mkdir /usr/local/ssl/include/openssl
if [ ! -d /usr/local/ssl ] ; then
echo "Directory /usr/local/ssl does not exist"
exit 1
fi
if [ ! -d /usr/local/ssl/lib ] ; then
echo "Directory /usr/local/ssl/lib does not exist"
exit 1
fi
if [ ! -d /usr/local/ssl/include/openssl ] ; then
echo "Directory /usr/local/ssl/include/openssl does not exist"
exit 1
fi
if [ -f "$SCRIPT_DIR/../../Out/x64/$CONFIGURATION/libcrypto.Linux/libcrypto.a" ]; then
echo "Previously-built library present at $SCRIPT_DIR/../../Out/x64/$CONFIGURATION/libcrypto.Linux/libcrypto.a - skipping build"
exit 0
else
echo "No previously-built library present at $SCRIPT_DIR/../../Out/x64/$CONFIGURATION/libcrypto.Linux/libcrypto.a - performing build"
fi
pushd $OPENSSL_SRC
if [ -f Makefile ] && make -n clean >/dev/null 2>&1; then
make clean
fi
sed -i -e 's/\r$//' Configure
if [ "$CONFIGURATION" = "Debug" ]; then
# make libcrypto and libssl
./Configure --prefix=/usr/local/ssl --openssldir=/usr/local/ssl linux-x86_64-clang no-shared no-hw no-engine no-async -d
else
# make libcrypto and libssl
./Configure --prefix=/usr/local/ssl --openssldir=/usr/local/ssl linux-x86_64-clang no-shared no-hw no-engine no-async
fi
make CFLAGS="-fvisibility=hidden" CXXFLAGS="-fvisibility=hidden"
if make -n install >/dev/null 2>&1; then
sudo make install
fi
# copies binaries to final directory
mkdir -p "$SCRIPT_DIR"/../../Out/x64/"$CONFIGURATION"/libcrypto.Linux
cp -R "$PWD"/libcrypto.a "$SCRIPT_DIR"/../../Out/x64/"$CONFIGURATION"/libcrypto.Linux
mkdir -p "$SCRIPT_DIR"/../../Out/x64/"$CONFIGURATION"/libssl.Linux
cp -R "$PWD"/libssl.a "$SCRIPT_DIR"/../../Out/x64/"$CONFIGURATION"/libssl.Linux
if [ -f Makefile ] && make -n clean >/dev/null 2>&1; then
make clean
fi
popd