<commit_before>#!/bin/sh
# Usage examples:
# ./install.sh libbson master
# ./install.sh mongoc 1.3.5
# PREFIX=/tmp/installdir CONFIGURE_ARGS="--enable-debug" ./install.sh mongoc 1.3.5


set -o errexit
set -o xtrace


usage() {
    echo "Please either say mongoc, or libbson, optionally which version"
    echo "$0 <mongoc|libbson> [master|x.y.z]"
}
[ $# -lt 1 ] && { usage; exit 2; }

VERSION=${2:-master}
PREFIX=${PREFIX:-$(pwd)"/deps-install"}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')

case "$OS" in
    darwin|linux)
        CONFIGURE_ARGS_MONGOC="--disable-automatic-init-and-cleanup --disable-shm-counters --with-libbson=system"
        CONFIGURE_ARGS_BSON="--disable-extra-align"
        CONFIGURE_ARGS_EXTRA="--enable-tests=no --enable-examples=no --enable-debug --enable-optimizations --disable-static --disable-dependency-tracking --with-pic --prefix=$PREFIX"
        ;;

    *)
        echo "$0: unsupported platform '$OS'" >&2
        exit 2
        ;;
esac

case "$1" in
    libbson)
        LIB="libbson"
        CONFIGURE_ARGS=${CONFIGURE_ARGS:-$CONFIGURE_ARGS_BSON $CONFIGURE_ARGS_EXTRA}
    ;;

    mongoc)
        LIB="mongo-c-driver"
        CONFIGURE_ARGS=${CONFIGURE_ARGS:=$CONFIGURE_ARGS_MONGOC $CONFIGURE_ARGS_EXTRA}
    ;;
    *)
        echo "Got '$2'"
        usage;
        exit 2
    ;;
esac

echo "About to install $LIB ($VERSION) into $PREFIX configured with '$CONFIGURE_ARGS'"

if [ "${VERSION}" = "master" ]; then
    rm -rf $LIB
    # Must be http as rhel55 has https issues
    curl -o $LIB.tgz -L http://s3.amazonaws.com/mciuploads/$LIB/$LIB-latest.tar.gz
    tar --extract --file $LIB.tgz
    rm -rf $LIB
    DIR=$(echo $LIB-*)
else
    DIR=$LIB-${VERSION}
    rm -rf $LIB.tgz $DIR
    curl -o $LIB.tgz -L https://github.com/mongodb/$LIB/releases/download/${VERSION}/$LIB-${VERSION}.tar.gz
    tar --extract --file $LIB.tgz
fi

cd $DIR

case "$OS" in
    darwin)
        MAKEFLAGS="-j"$(sysctl -n hw.logicalcpu)
        PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" ./configure $CONFIGURE_ARGS
        make
        make install
        ;;

    linux)
        MAKEFLAGS="-j"$(grep -c ^processor /proc/cpuinfo)
        PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" ./configure $CONFIGURE_ARGS
        make
        make install
        ;;

    *)
        echo "$0: unsupported platform '$OS'" >&2
        exit 2
        ;;
esac<commit_msg>CXX-748 Correctly pass -j option to make when compiling C driver<commit_after>#!/bin/sh
# Usage examples:
# ./install.sh libbson master
# ./install.sh mongoc 1.3.5
# PREFIX=/tmp/installdir CONFIGURE_ARGS="--enable-debug" ./install.sh mongoc 1.3.5


set -o errexit
set -o xtrace


usage() {
    echo "Please either say mongoc, or libbson, optionally which version"
    echo "$0 <mongoc|libbson> [master|x.y.z]"
}
[ $# -lt 1 ] && { usage; exit 2; }

VERSION=${2:-master}
PREFIX=${PREFIX:-$(pwd)"/deps-install"}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')

case "$OS" in
    darwin|linux)
        CONFIGURE_ARGS_MONGOC="--disable-automatic-init-and-cleanup --disable-shm-counters --with-libbson=system"
        CONFIGURE_ARGS_BSON="--disable-extra-align"
        CONFIGURE_ARGS_EXTRA="--enable-tests=no --enable-examples=no --enable-debug --enable-optimizations --disable-static --disable-dependency-tracking --with-pic --prefix=$PREFIX"
        ;;

    *)
        echo "$0: unsupported platform '$OS'" >&2
        exit 2
        ;;
esac

case "$1" in
    libbson)
        LIB="libbson"
        CONFIGURE_ARGS=${CONFIGURE_ARGS:-$CONFIGURE_ARGS_BSON $CONFIGURE_ARGS_EXTRA}
    ;;

    mongoc)
        LIB="mongo-c-driver"
        CONFIGURE_ARGS=${CONFIGURE_ARGS:=$CONFIGURE_ARGS_MONGOC $CONFIGURE_ARGS_EXTRA}
    ;;
    *)
        echo "Got '$2'"
        usage;
        exit 2
    ;;
esac

echo "About to install $LIB ($VERSION) into $PREFIX configured with '$CONFIGURE_ARGS'"

if [ "${VERSION}" = "master" ]; then
    rm -rf $LIB
    # Must be http as rhel55 has https issues
    curl -o $LIB.tgz -L http://s3.amazonaws.com/mciuploads/$LIB/$LIB-latest.tar.gz
    tar --extract --file $LIB.tgz
    rm -rf $LIB
    DIR=$(echo $LIB-*)
else
    DIR=$LIB-${VERSION}
    rm -rf $LIB.tgz $DIR
    curl -o $LIB.tgz -L https://github.com/mongodb/$LIB/releases/download/${VERSION}/$LIB-${VERSION}.tar.gz
    tar --extract --file $LIB.tgz
fi

cd $DIR

case "$OS" in
    darwin)
        PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" ./configure $CONFIGURE_ARGS
        make "-j$(sysctl -n hw.logicalcpu)"
        make install
        ;;

    linux)
        PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" ./configure $CONFIGURE_ARGS
        make "-j$(grep -c ^processor /proc/cpuinfo)"
        make install
        ;;

    *)
        echo "$0: unsupported platform '$OS'" >&2
        exit 2
        ;;
esac
{'fraction_non_alphanumeric': 0.15994935640430472, 'fraction_numerical': 0.009917704156995147, 'mean_word_length': 2.577358490566038, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6572524', 'n_tokens_mistral': 1730, 'n_tokens_neox': 1629, 'n_words': 371}