Files
documentdb/scripts/install_setup_libbson.sh
T
Shuai Tian fe0b1eb6b5 Merged PR 1588579: [OSS] fix citus and libbson scripts for documentdb
### Does this PR have any customer impact?

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)

### Are you introducing any new config? If yes, do you have tests with and without them being set?

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description
citus script:
line 46 throws error when ProcessCitusMakefileGlobal does not exist

libbson script:
save the downloaded file locally to avoid run tar command with incompleted file
2025-02-25 22:09:25 -08:00

45 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# fail if trying to reference a variable that is not set.
set -u
# exit immediately if a command exits with a non-zero status
set -e
source="${BASH_SOURCE[0]}"
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
echo "scriptDir: $scriptDir"
. $scriptDir/setup_versions.sh
MONGO_DRIVER_VERSION=$(GetLibbsonVersion)
if [ "${INSTALLDESTDIR:-""}" == "" ]; then
INSTALLDESTDIR="/usr";
fi
if [ "${MAKE_PROGRAM:-""}" == "" ]; then
MAKE_PROGRAM="cmake3"
fi
pushd $INSTALL_DEPENDENCIES_ROOT
curl -s -L https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_DRIVER_VERSION/mongo-c-driver-$MONGO_DRIVER_VERSION.tar.gz -o ./mongo-c-driver-$MONGO_DRIVER_VERSION.tar.gz
tar -xzvf ./mongo-c-driver-$MONGO_DRIVER_VERSION.tar.gz -C $INSTALL_DEPENDENCIES_ROOT --transform="s|mongo-c-driver-$MONGO_DRIVER_VERSION|mongo-c-driver|"
# remove the tar file
rm -rf ./mongo-c-driver-$MONGO_DRIVER_VERSION.tar.gz
cd $INSTALL_DEPENDENCIES_ROOT/mongo-c-driver/build
$MAKE_PROGRAM -DENABLE_MONGOC=ON -DMONGOC_ENABLE_ICU=OFF -DENABLE_ICU=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_INSTALL_PREFIX=$INSTALLDESTDIR ..
make clean && make -sj$(cat /proc/cpuinfo | grep -c "processor") install
popd
if [ "${CLEANUP_SETUP:-"0"}" == "1" ]; then
rm -rf $INSTALL_DEPENDENCIES_ROOT/mongo-c-driver
fi