Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bootstrap.sh to work on three platforms #444

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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