From 77211f999d137d29e91f3266083bbf59b07e56a1 Mon Sep 17 00:00:00 2001 From: Bill Hamilton Date: Tue, 19 Jun 2018 20:29:26 +0000 Subject: [PATCH] Amazon: Changed mongodb driver versions and compile settings for cxx version 3.3 --- scripts/eosio_build_amazon.sh | 105 ++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 36 deletions(-) diff --git a/scripts/eosio_build_amazon.sh b/scripts/eosio_build_amazon.sh index 1adaa3925..6f29c819b 100644 --- a/scripts/eosio_build_amazon.sh +++ b/scripts/eosio_build_amazon.sh @@ -381,46 +381,80 @@ fi fi printf "\\n\\tChecking MongoDB C++ driver installation.\\n" - if [ ! -e "/usr/local/lib/libmongocxx-static.a" ]; then + MONGO_INSTALL=true + if [ -e "/usr/local/lib/libmongocxx-static.a" ]; then + MONGO_INSTALL=false + if ! version=$( grep "Version:" /usr/local/lib64/pkgconfig/libbsoncxx-static.pc | tr -s ' ' | awk '{print $2}' ) + then + printf "\\tUnable to determine mongodb-cxx-driver version.\\n" + printf "\\tExiting now.\\n\\n" + exit 1; + fi + + maj=$( echo "${version}" | cut -d'.' -f1 ) + min=$( echo "${version}" | cut -d'.' -f2 ) + if [ "${maj}" -gt 3 ]; then + MONGO_INSTALL=true + elif [ "${maj}" -eq 3 ] && [ "${min}" -lt 3 ]; then + MONGO_INSTALL=true + fi + fi + + if [ $MONGO_INSTALL == "true" ]; then if ! cd "${TEMP_DIR}" then - printf "\\n\\tUnable to cd into directory %s.\\n" "${TEMP_DIR}" - printf "\\n\\tExiting now.\\n" + printf "\\tUnable to enter directory %s.\\n" "${TEMP_DIR}" + printf "\\tExiting now.\\n\\n" exit 1; fi - STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 \ - "https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz" ) + STATUS=$( curl -LO -w '%{http_code}' --connect-timeout 30 https://github.com/mongodb/mongo-c-driver/releases/download/1.10.2/mongo-c-driver-1.10.2.tar.gz ) if [ "${STATUS}" -ne 200 ]; then - rm -f "${TEMP_DIR}/mongo-c-driver-1.9.3.tar.gz" + if ! rm -f "${TEMP_DIR}/mongo-c-driver-1.10.2.tar.gz" + then + printf "\\tUnable to remove file %s/mongo-c-driver-1.10.2.tar.gz.\\n" "${TEMP_DIR}" + fi printf "\\tUnable to download MongoDB C driver at this time.\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! tar xf "${TEMP_DIR}/mongo-c-driver-1.9.3.tar.gz" + if ! tar xf mongo-c-driver-1.10.2.tar.gz then - printf "\\n\\tUnable to decompress file %s/mongo-c-driver-1.9.3.tar.gz.\\n" "${TEMP_DIR}" - printf "\\n\\tExiting now.\\n" + printf "\\tUnable to unarchive file %s/mongo-c-driver-1.10.2.tar.gz.\\n" "${TEMP_DIR}" + printf "\\tExiting now.\\n\\n" exit 1; fi - if ! rm -f "${TEMP_DIR}/mongo-c-driver-1.9.3.tar.gz" + if ! rm -f "${TEMP_DIR}/mongo-c-driver-1.10.2.tar.gz" then - printf "\\n\\tUnable to remove file %s/mongo-c-driver-1.9.3.tar.gz.\\n" "${TEMP_DIR}" - printf "\\n\\tExiting now.\\n" + printf "\\tUnable to remove file mongo-c-driver-1.10.2.tar.gz.\\n" + printf "\\tExiting now.\\n\\n" exit 1; fi - if ! cd "${TEMP_DIR}/mongo-c-driver-1.9.3" + if ! cd "${TEMP_DIR}"/mongo-c-driver-1.10.2 then - printf "\\n\\tUnable to change directory info %s/mongo-c-driver-1.9.3.\\n" "${TEMP_DIR}" - printf "\\n\\tExiting now.\\n" + printf "\\tUnable to cd into directory %s/mongo-c-driver-1.10.2.\\n" "${TEMP_DIR}" + printf "\\tExiting now.\\n\\n" exit 1; fi - if ! ./configure --enable-static --with-libbson=bundled --enable-ssl=openssl --disable-automatic-init-and-cleanup --prefix=/usr/local + if ! mkdir cmake-build then - printf "\\tConfiguring MongoDB C driver has encountered the above errors.\\n" + printf "\\tUnable to create directory %s/mongo-c-driver-1.10.2/cmake-build.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! make -j"${JOBS}" + if ! cd cmake-build + then + printf "\\tUnable to enter directory %s/mongo-c-driver-1.10.2/cmake-build.\\n" "${TEMP_DIR}" + printf "\\tExiting now.\\n\\n" + exit 1; + fi + if ! "${CMAKE}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_BSON=ON \ + -DENABLE_SSL=OPENSSL -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=ON -DENABLE_STATIC=ON .. + then + printf "\\tConfiguring MongoDB C driver has encountered the errors above.\\n" + printf "\\tExiting now.\\n\\n" + exit 1; + fi + if ! make -j"${CPU_CORE}" then printf "\\tError compiling MongoDB C driver.\\n" printf "\\tExiting now.\\n\\n" @@ -434,36 +468,35 @@ fi fi if ! cd "${TEMP_DIR}" then - printf "\\n\\tUnable to cd into directory %s.\\n" "${TEMP_DIR}" - printf "\\n\\tExiting now.\\n" + printf "\\tUnable to enter directory %s.\\n" "${TEMP_DIR}" + printf "\\tExiting now.\\n\\n" exit 1; fi - if ! rm -rf "${TEMP_DIR}/mongo-c-driver-1.9.3" + if ! rm -rf "${TEMP_DIR}/mongo-c-driver-1.10.2" then - printf "\\n\\tUnable to remove directory %s/mongo-c-driver-1.9.3.\\n" "${TEMP_DIR}" - printf "\\n\\tExiting now.\\n" + printf "\\tUnable to remove directory %s/mongo-c-driver-1.10.2.\\n" "${TEMP_DIR}" + printf "\\tExiting now.\\n\\n" exit 1; fi - if ! git clone https://github.com/mongodb/mongo-cxx-driver.git --branch releases/v3.2 --depth 1 + if ! git clone https://github.com/mongodb/mongo-cxx-driver.git --branch releases/v3.3 --depth 1 then printf "\\tUnable to clone MongoDB C++ driver at this time.\\n" printf "\\tExiting now.\\n\\n" - exit; + exit 1; fi if ! cd "${TEMP_DIR}/mongo-cxx-driver/build" then - printf "\\n\\tUnable to enter directory %s/mongo-cxx-driver/build.\\n" "${TEMP_DIR}" - printf "\\n\\tExiting now.\\n" + printf "\\tUnable to enter directory %s/mongo-cxx-driver/build.\\n" "${TEMP_DIR}" + printf "\\tExiting now.\\n\\n" exit 1; fi - - if ! "${CMAKE}" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="/usr/local" "${TEMP_DIR}/mongo-cxx-driver" + if ! "${CMAKE}" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. then printf "\\tCmake has encountered the above errors building the MongoDB C++ driver.\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! sudo make -j"${JOBS}" + if ! sudo make -j"${CPU_CORE}" then printf "\\tError compiling MongoDB C++ driver.\\n" printf "\\tExiting now.\\n\\n" @@ -477,19 +510,19 @@ fi fi if ! cd "${TEMP_DIR}" then - printf "\\n\\tUnable to cd into directory %s.\\n" "${TEMP_DIR}" - printf "\\n\\tExiting now.\\n" + printf "\\tUnable to enter directory %s.\\n" "${TEMP_DIR}" + printf "\\tExiting now.\\n\\n" exit 1; fi if ! sudo rm -rf "${TEMP_DIR}/mongo-cxx-driver" then - printf "\\n\\tUnable to remove directory %s/mongo-cxx-driver.\\n" "${TEMP_DIR}" - printf "\\n\\tExiting now.\\n" + printf "\\tUnable to remove directory %s/mongo-cxx-driver.\\n" "${TEMP_DIR}" "${TEMP_DIR}" + printf "\\tExiting now.\\n\\n" exit 1; fi - printf "\\tSuccessfully installed Mongo C/C++ drivers found at /usr/local/lib.\\n" + printf "\\tMongo C++ driver installed at /usr/local/lib64/libmongocxx-static.a.\\n" else - printf "\\tMongo C++ driver found at /usr/local/lib.\\n" + printf "\\tMongo C++ driver found at /usr/local/lib64/libmongocxx-static.a.\\n" fi printf "\\n\\tChecking secp256k1-zkp installation.\\n" -- GitLab