<commit_before>#!/bin/bash

#
# Install dependencies on Travis
#
# Inputs:
#    TRAVIS_OS_NAME - "linux" or "osx"
#    BUILD_STATIC   - "true" or "false"
#
# Static builds use scripts to download libarchive, libconfuse, and libsodium,
# so those are only installed on shared library builds.
#

set -e
set -v

source scripts/third_party_versions.sh

MAKE_FLAGS=-j4
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
    DEPS_INSTALL_DIR=/usr
else
    DEPS_INSTALL_DIR=/usr/local
fi

install_confuse() {
    curl -LO https://github.com/martinh/libconfuse/releases/download/v$CONFUSE_VERSION/confuse-$CONFUSE_VERSION.tar.xz
    tar xf confuse-$CONFUSE_VERSION.tar.xz
    pushd confuse-$CONFUSE_VERSION
    ./configure --prefix=$DEPS_INSTALL_DIR --disable-examples
    make $MAKE_FLAGS
    sudo make install
    popd
}

install_sodium() {
    curl -LO https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUM_VERSION.tar.gz
    tar xf libsodium-$LIBSODIUM_VERSION.tar.gz
    pushd libsodium-$LIBSODIUM_VERSION
    ./configure --prefix=$DEPS_INSTALL_DIR
    make $MAKE_FLAGS
    sudo make install
    popd
}

if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
    sudo apt-get update -qq
    sudo apt-get install -qq autopoint mtools unzip zip help2man
    case $MODE in
        windows)
            sudo dpkg --add-architecture i386
            sudo apt-get update
            sudo apt-get install -qq gcc-mingw-w64-x86-64 wine
            ;;
        dynamic)
            sudo apt-get install -qq libarchive-dev
            install_confuse
            install_sodium
            pip install --user cpp-coveralls
            ;;
        static)
            # Need fpm when building static so that we can make the .deb and .rpm packages
            sudo apt-get install -qq rpm
            gem install fpm
            ;;
        raspberrypi)
            sudo apt-get install -qq libarchive-dev qemu binfmt-support qemu-user-static
            gem install fpm
            pushd ~
            git clone https://github.com/raspberrypi/tools.git --depth 1
            popd
            ;;

    esac
else
    brew update

    # Fix "/usr/local/Library/ENV/4.3/sed: Not such file" errors
    brew uninstall libtool
    brew install libtool

    brew install coreutils mtools
    brew install gettext
    if [[ "$MODE" = "dynamic" ]]; then
        brew install libarchive libsodium confuse
    fi<commit_msg>Fix OSX builds by removing coreutils install<commit_after>#!/bin/bash

#
# Install dependencies on Travis
#
# Inputs:
#    TRAVIS_OS_NAME - "linux" or "osx"
#    BUILD_STATIC   - "true" or "false"
#
# Static builds use scripts to download libarchive, libconfuse, and libsodium,
# so those are only installed on shared library builds.
#

set -e
set -v

source scripts/third_party_versions.sh

MAKE_FLAGS=-j4
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
    DEPS_INSTALL_DIR=/usr
else
    DEPS_INSTALL_DIR=/usr/local
fi

install_confuse() {
    curl -LO https://github.com/martinh/libconfuse/releases/download/v$CONFUSE_VERSION/confuse-$CONFUSE_VERSION.tar.xz
    tar xf confuse-$CONFUSE_VERSION.tar.xz
    pushd confuse-$CONFUSE_VERSION
    ./configure --prefix=$DEPS_INSTALL_DIR --disable-examples
    make $MAKE_FLAGS
    sudo make install
    popd
}

install_sodium() {
    curl -LO https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUM_VERSION.tar.gz
    tar xf libsodium-$LIBSODIUM_VERSION.tar.gz
    pushd libsodium-$LIBSODIUM_VERSION
    ./configure --prefix=$DEPS_INSTALL_DIR
    make $MAKE_FLAGS
    sudo make install
    popd
}

if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
    sudo apt-get update -qq
    sudo apt-get install -qq autopoint mtools unzip zip help2man
    case $MODE in
        windows)
            sudo dpkg --add-architecture i386
            sudo apt-get update
            sudo apt-get install -qq gcc-mingw-w64-x86-64 wine
            ;;
        dynamic)
            sudo apt-get install -qq libarchive-dev
            install_confuse
            install_sodium
            pip install --user cpp-coveralls
            ;;
        static)
            # Need fpm when building static so that we can make the .deb and .rpm packages
            sudo apt-get install -qq rpm
            gem install fpm
            ;;
        raspberrypi)
            sudo apt-get install -qq libarchive-dev qemu binfmt-support qemu-user-static
            gem install fpm
            pushd ~
            git clone https://github.com/raspberrypi/tools.git --depth 1
            popd
            ;;

    esac
else
    brew update

    # Fix "/usr/local/Library/ENV/4.3/sed: Not such file" errors
    brew uninstall libtool
    brew install libtool

    brew install mtools
    brew install gettext
    if [[ "$MODE" = "dynamic" ]]; then
        brew install libarchive libsodium confuse
    fi
{'fraction_non_alphanumeric': 0.08619612742036227, 'fraction_numerical': 0.005829689777222569, 'mean_word_length': 2.254742547425474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6313997', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1480, 'n_words': 414}