Skip to content

Commit

Permalink
Update bootstrap.sh to work on three platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu Zeng authored and zengyu714 committed Sep 12, 2022
1 parent 3aeaa0c commit 4184307
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ PROTOBUF_VERSION="3.11.4"
CURL_VERSION="7.85.0"
AWS_SDK_CPP_VERSION="1.9.67"

# 1.1.1.q is not stable for MacOS, downgraded to 1.1.1n
# see https://github.com/openssl/openssl/issues/18720
if [[ $(uname) == 'Darwin' ]]; then
OPENSSL_VERSION="1.1.1n"
fi

LIB_OPENSSL="https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
LIB_BOOST="https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_UNDERSCORED}.tar.gz"
LIB_ZLIB="https://zlib.net/fossils/zlib-${ZLIB_VERSION}.tar.gz"
Expand Down Expand Up @@ -119,26 +125,26 @@ function conf {

# OpenSSL
if [ ! -d "openssl-${OPENSSL_VERSION}" ]; then

_curl "$LIB_OPENSSL" >openssl.tgz
tar xf openssl.tgz
rm openssl.tgz

cd openssl-${OPENSSL_VERSION}

# Have to leave MD4 enabled because curl expects it
OPTS="threads no-shared no-idea no-camellia no-seed no-bf no-cast no-rc2 no-rc5 no-md2 no-mdc2 no-ssl2 no-ssl3 no-capieng no-dso"

if [[ $(uname) == 'Darwin' ]]; then
silence ./Configure darwin64-x86_64-cc $OPTS --prefix=$INSTALL_DIR
OPTS="$OPTS darwin64-x86_64-cc enable-ec_nistp_64_gcc_128"
silence ./Configure $OPTS --prefix="$INSTALL_DIR"
elif [[ $(uname) == MINGW* ]]; then
silence ./Configure mingw64 $OPTS --prefix=$INSTALL_DIR
silence ./Configure mingw64 $OPTS --prefix="$INSTALL_DIR"
find ./ -name Makefile | while read f; do
echo >>$f
echo "%.o: %.c" >>$f
echo >>"$f"
echo "%.o: %.c" >>"$f"
echo -e '\t$(COMPILE.c) $(OUTPUT_OPTION) $<;' >>$f
done
else
silence ./config $OPTS --prefix=$INSTALL_DIR
silence ./config "$OPTS" --prefix="$INSTALL_DIR"
fi

silence make depend
Expand All @@ -160,7 +166,7 @@ if [ ! -d "boost_${BOOST_VERSION_UNDERSCORED}" ]; then
OPTS="-j 8 --build-type=minimal --layout=system --prefix=$INSTALL_DIR link=static threading=multi release install"

if [[ $(uname) == 'Darwin' ]]; then
silence ./bootstrap.sh --with-libraries=$LIBS
silence ./bootstrap.sh --with-libraries=$LIBS --with-toolset=clang
silence ./b2 toolset=clang-darwin $OPTS cxxflags="$MACOSX_MIN_COMPILER_OPT"
elif [[ $(uname) == MINGW* ]]; then
silence ./bootstrap.sh --with-libraries=$LIBS --with-toolset=mingw
Expand Down Expand Up @@ -215,16 +221,20 @@ if [ ! -d "curl-${CURL_VERSION}" ]; then

cd curl-${CURL_VERSION}

silence conf --disable-shared --disable-ldap --disable-ldaps --without-libidn2 \
--enable-threaded-resolver --disable-debug --without-libssh2 --without-ca-bundle --with-ssl="${INSTALL_DIR}" --without-libidn
if [[ $(uname) == 'Darwin' ]]; then
#
silence conf --disable-shared --disable-ldap --disable-ldaps --without-libidn2 \
--enable-threaded-resolver --disable-debug --without-libssh2 --without-ca-bundle --with-openssl

# Apply a patch for macOS that should prevent curl from trying to use clock_gettime
# This is a temporary work around for https://github.com/awslabs/amazon-kinesis-producer/issues/117
# until dependencies are updated
#
sed -Ei .bak 's/#define HAVE_CLOCK_GETTIME_MONOTONIC 1//' lib/curl_config.h
else
silence conf --disable-shared --disable-ldap --disable-ldaps --without-libidn2 \
--enable-threaded-resolver --disable-debug --without-libssh2 --without-ca-bundle --with-ssl="${INSTALL_DIR}" --without-libidn
fi

silence make -j
silence make install

Expand Down Expand Up @@ -256,7 +266,7 @@ if [ ! -d "aws-sdk-cpp" ]; then
-DCMAKE_FIND_FRAMEWORK=LAST \
-DENABLE_TESTING="OFF" \
../aws-sdk-cpp
silence make -j 4
silence make -j8
silence make install

cd ..
Expand Down

0 comments on commit 4184307

Please sign in to comment.