1#!/bin/bash 2# Copyright 2017 The Chromium Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5set -eu 6 7# Builds new rc binaries at head and uploads them to google storage. 8# The new .sha1 files will be in the tree after this has run. 9 10if [[ "$OSTYPE" != "darwin"* ]]; then 11 echo "this script must run on a mac" 12 exit 1 13fi 14 15DIR="$(cd "$(dirname "${0}" )" && pwd)" 16SRC_DIR="$DIR/../../../.." 17 18# Make sure Linux and Windows sysroots are installed, for distrib.py. 19$SRC_DIR/build/linux/sysroot_scripts/install-sysroot.py --arch amd64 20$SRC_DIR/build/vs_toolchain.py update --force 21 22# Make a temporary directory. 23WORK_DIR=$(mktemp -d) 24if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then 25 echo "could not create temp dir" 26 exit 1 27fi 28function cleanup { 29 rm -rf "$WORK_DIR" 30} 31trap cleanup EXIT 32 33# Check out rc and build it in the temporary directory. Copy binaries over. 34pushd "$WORK_DIR" > /dev/null 35git clone -q https://github.com/nico/hack 36cd hack/res 37./distrib.py "$SRC_DIR" 38popd > /dev/null 39cp "$WORK_DIR/hack/res/rc-linux64" "$DIR/linux64/rc" 40cp "$WORK_DIR/hack/res/rc-mac" "$DIR/mac/rc" 41cp "$WORK_DIR/hack/res/rc-win.exe" "$DIR/win/rc.exe" 42 43# Upload binaries to cloud storage. 44upload_to_google_storage.py -b chromium-browser-clang/rc "$DIR/linux64/rc" 45upload_to_google_storage.py -b chromium-browser-clang/rc "$DIR/mac/rc" 46upload_to_google_storage.py -b chromium-browser-clang/rc "$DIR/win/rc.exe" 47