#!/bin/bash
set -eu
if [[ "$OSTYPE" != "darwin"* ]]; then
echo "this script must run on a mac"
exit 1
fi
DIR="$(cd "$(dirname "${0}" )" && pwd)"
SRC_DIR="$DIR/../../../.."
$SRC_DIR/build/linux/sysroot_scripts/install-sysroot.py --arch amd64
$SRC_DIR/build/vs_toolchain.py update --force
WORK_DIR=$(mktemp -d)
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
echo "could not create temp dir"
exit 1
fi
function cleanup {
rm -rf "$WORK_DIR"
}
trap cleanup EXIT
pushd "$WORK_DIR" > /dev/null
git clone -q https://github.com/nico/hack
cd hack/res
./distrib.py "$SRC_DIR"
popd > /dev/null
cp "$WORK_DIR/hack/res/rc-linux64" "$DIR/linux64/rc"
cp "$WORK_DIR/hack/res/rc-mac" "$DIR/mac/rc"
cp "$WORK_DIR/hack/res/rc-win.exe" "$DIR/win/rc.exe"
upload_to_google_storage.py -b chromium-browser-clang/rc "$DIR/linux64/rc"
upload_to_google_storage.py -b chromium-browser-clang/rc "$DIR/mac/rc"
upload_to_google_storage.py -b chromium-browser-clang/rc "$DIR/win/rc.exe"