-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup-libraries-osx
executable file
·91 lines (81 loc) · 3.03 KB
/
setup-libraries-osx
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
#!/bin/bash
set -e
source osx-environment
set -x
export CCACHE_DIR="$OSX_BASE_DIR/ccache/libs"
mkdir -p "$CCACHE_DIR" "$OSX_LIBDIR" "$BUILDDIR"
rm -rf "$BUILDDIR"/*
cd "$BUILDDIR"
if ! [[ -e ~/.rvm ]]; then
echo "*** ERROR: You must install RVM in single user mode"
exit 1
fi
# We compile libraries with -fvisibility=hidden in order to avoid symbol clashes
# with the library version that's installed by the system. Despite OS X using
# two-level namespaces, symbol clashes still happen.
# Compile a static OpenSSL library.
if [[ ! -e "$OSX_LIBDIR/bin/openssl" ]]; then
wget http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar xzf openssl-$OPENSSL_VERSION.tar.gz
rm openssl-$OPENSSL_VERSION.tar.gz
cd openssl-$OPENSSL_VERSION
./Configure darwin64-x86_64-cc --prefix="$OSX_LIBDIR" --openssldir="$OSX_LIBDIR/openssl" \
threads zlib no-shared no-sse2 -fvisibility=hidden
make
make install_sw
strip "$OSX_LIBDIR/bin/openssl"
strip -S "$OSX_LIBDIR/lib/libcrypto.a"
strip -S "$OSX_LIBDIR/lib/libssl.a"
mkdir -p "$OSX_LIBDIR/lib/libcrypto"
pushd "$OSX_LIBDIR/lib/libcrypto"
ar x ../libcrypto.a
popd
mkdir -p "$OSX_LIBDIR/lib/libssl"
pushd "$OSX_LIBDIR/lib/libssl"
ar x ../libssl.a
popd
cd ..
rm -rf openssl-$OPENSSL_VERSION
fi
# Compile a minimalist libcurl with almost no dependencies.
if [[ ! -e "$OSX_LIBDIR/bin/curl" ]]; then
wget http://curl.haxx.se/download/curl-$CURL_VERSION.tar.bz2
tar xjf curl-$CURL_VERSION.tar.bz2
rm curl-$CURL_VERSION.tar.bz2
cd curl-$CURL_VERSION
env CFLAGS='-O2 -fvisibility=hidden' \
./configure --prefix="$OSX_LIBDIR" --disable-shared --disable-debug --enable-optimize --disable-werror \
--disable-curldebug --enable-symbol-hiding --disable-ares --disable-manual --disable-ldap --disable-ldaps \
--disable-rtsp --disable-dict --disable-ftp --disable-ftps --disable-gopher --disable-imap \
--disable-imaps --disable-pop3 --disable-pop3s --without-librtmp --disable-smtp --disable-smtps \
--disable-telnet --disable-tftp --disable-smb --disable-versioned-symbols \
--without-libmetalink --without-libidn --without-libssh2 --without-libmetalink --without-nghttp2
make -j4
make install-strip
cd ..
rm -rf curl-$CURL_VERSION
fi
# Compile a minimalist PCRE with almost no dependencies.
if [[ ! -e "$OSX_LIBDIR/bin/pcre-config" ]]; then
wget http://vorboss.dl.sourceforge.net/project/pcre/pcre/$PCRE_VERSION/pcre-$PCRE_VERSION.tar.gz
tar xjf pcre-$PCRE_VERSION.tar.gz
rm pcre-$PCRE_VERSION.tar.gz
cd pcre-$PCRE_VERSION
./configure --prefix="$OSX_LIBDIR" --disable-shared --disable-cpp --disable-pcregrep-jit
make -j4
make install-strip
cd ..
rm -rf pcre-$PCRE_VERSION
fi
# Compile a static zlib library.
if [[ ! -e "$OSX_LIBDIR/lib/libz.a" ]]; then
wget http://vorboss.dl.sourceforge.net/project/libpng/zlib/$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz
tar xzf zlib-$ZLIB_VERSION.tar.gz
rm zlib-$ZLIB_VERSION.tar.gz
cd zlib-$ZLIB_VERSION
CFLAGS='-O2 -fvisibility=hidden' ./configure --prefix="$OSX_LIBDIR" --static
make install
strip -S "$OSX_LIBDIR/lib/libz.a"
cd ..
rm -rf zlib-$ZLIB_VERSION
fi