#/bin/bash

SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

set -euo pipefail

# Set env variables (if you are a developer, put this in your .bash_profile!)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

# Make sure we have Homebrew
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Reinstall the developer tools
# sudo rm -rf $(xcode-select -print-path) && xcode-select --install

# Other packages needed
brew install python3
brew install libtool
brew install pkg-config
brew install nasm
brew install x265

# Python requirements
pip3 install pyyaml --user
pip3 install wget --user

# Clean up. We'll get everything we need from the install after
rm -rf /tmp/spectrum_native_deps
(cd ../.. && git clean -xdf)

# And away we go!
exec $SCRIPT_ROOT/setup.sh
