-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_use_libressl.sh
More file actions
executable file
·43 lines (37 loc) · 1.14 KB
/
_use_libressl.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.14 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
#!/bin/bash
set -xe
: "${_PREFIX:=$1}"
: "${_SCRATCH_DIR:=$2}"
: "${_UNIVERSAL:=$3}"
if [[ ! -e "$_PREFIX/lib/libssl.dylib" ]]
then
# Use the latest OpenSSL/LibreSSL
mkdir -p "$_PREFIX/lib"
for i in crypto ssl ; do
ln -s "$(ls -1 "/usr/lib/lib$i".*.dylib | tail -1)" "$_PREFIX/lib/lib$i.dylib"
done
_VER="$(strings "$_PREFIX/lib/libssl.dylib" | grep LibreSSL | sed 's/^[^0-9]*//')"
if [[ -z "$_VER" ]]
then
test -n "$(find /Library/Developer/CommandLineTools -path '*/openssl/crypto.h' \
-print -quit)"
else
_PKG="libressl-$_VER"
# Install LibreSSL headers
cd "$_SCRATCH_DIR"
[[ -s "$_PKG.tar.gz" ]] || \
curl -OkfSL "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/$_PKG.tar.gz"
tar -C "$_PREFIX" -xf "$_PKG.tar.gz" --strip-components=1 --exclude='*Makefile.*' \
"$_PKG/include/openssl"
# Patch for universal arch
if [[ "$_UNIVERSAL" == 1 ]]; then
sed -i '' "s/ THIRTY_TWO_BIT$/&\\
#if defined(__i386__) || defined(__i386)\\
# define BN_LLONG\\
# undef SIXTY_FOUR_BIT_LONG\\
# undef SIXTY_FOUR_BIT\\
# define THIRTY_TWO_BIT\\
#endif/" "$_PREFIX/include/openssl/opensslconf.h"
fi
fi
fi