-
Notifications
You must be signed in to change notification settings - Fork 18
/
build_darwin_x86_64.sh
executable file
·79 lines (70 loc) · 2.59 KB
/
build_darwin_x86_64.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
#!/bin/sh -eu
echo "running build_darwin_x86_64.sh..."
SDK_PATH=$(xcrun --show-sdk-path)
XCODE_LIB="$SDK_PATH/usr/lib/"
XCODE_INCLUDE="$SDK_PATH/usr/include/"
if [ $# -eq 1 ]; then
re='^[0-9]+$'
if ! echo "$1" | grep -Eq "$re" ; then
echo "Invalid number of cores" >&2; exit 1
fi
jobs=$1
else
jobs=$(sysctl -n hw.logicalcpu_max)
fi
rm -rf x86_64 && mkdir x86_64
tar -xvzf "zlib-$ZLIB_VERSION.tar.gz" -C x86_64
cd "x86_64/zlib-$ZLIB_VERSION"
./configure --prefix="$PWD/root"
make ${jobs:+-j${jobs}} && make ${jobs:+-j$jobs} check && make install
cd ../../
tar -xvzf "openssl-$OPENSSL_VERSION.tar.gz" -C x86_64
cd "x86_64/openssl-$OPENSSL_VERSION"
./Configure --prefix="$PWD/root" \
darwin64-x86_64-cc \
no-dso \
no-shared \
no-ssl-trace \
no-ui-console
make ${jobs:+-j${jobs}} && make test && make install
cd ../../
#Apple messed up getentropy and clock_gettimesymbols when they added two functions in Sierra:
#they forgot to decorate them with appropriate AVAILABLE_MAC_OS_VERSION checks.
#So we have to explicitly disable them for binaries to work on MacOS 10.11.
tar -zxvf "libevent-$LIBEVENT_VERSION.tar.gz" -C x86_64
cd "x86_64/libevent-$LIBEVENT_VERSION"
patch -p0 < ../../patch/libevent/regress.c.patch
./configure \
LDFLAGS="-L$PWD/../openssl-$OPENSSL_VERSION/root/lib" \
CPPFLAGS="-I$PWD/../openssl-$OPENSSL_VERSION/include" \
--prefix="$PWD/install" \
--disable-openssl \
--disable-shared \
--enable-static \
--disable-clock-gettime \
--with-pic
make ${jobs:+-j${jobs}} && make ${jobs:+-j${jobs}} check && make install
cd ../../
tar -xvzf "tor-$TOR_VERSION.tar.gz" -C x86_64
cd "x86_64/tor-$TOR_VERSION"
./configure \
LDFLAGS="-L$XCODE_LIB" \
CPPFLAGS="-I$XCODE_INCLUDE" \
--prefix="$PWD/root" \
--enable-static-libevent \
--enable-static-openssl \
--enable-static-zlib \
--with-libevent-dir="$PWD/../libevent-$LIBEVENT_VERSION/install" \
--with-openssl-dir="$PWD/../openssl-$OPENSSL_VERSION/root" \
--with-zlib-dir="$PWD/../zlib-$ZLIB_VERSION/root" \
--disable-asciidoc \
--disable-html-manual \
--disable-lzma \
--disable-manpage \
--disable-zstd \
--disable-module-relay \
--disable-module-dirauth \
ac_cv_func_getentropy=no \
ac_cv_func_clock_gettime=no
make ${jobs:+-j${jobs}} && make ${jobs:+-j${jobs}} check && make install
cd ../../