From b433e0e7c4cb79090204f63328e563fd9168ba2b Mon Sep 17 00:00:00 2001 From: Yu Zeng Date: Sat, 10 Sep 2022 18:10:43 +0000 Subject: [PATCH] Update bootstrap.sh to work on three platforms --- bootstrap.sh | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 94a945bc..90c1aad9 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -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" @@ -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 @@ -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 @@ -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 @@ -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 ..