1#!/bin/bash
2# Copyright (c) 2012 The Native Client Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6# Script assumed to be run in native_client/
7if [[ $(pwd) != */native_client ]]; then
8  echo "ERROR: must be run in native_client!"
9  exit 1
10fi
11
12if [ $# -ne 0 ]; then
13  echo "USAGE: $0"
14  exit 2
15fi
16
17set -x
18set -e
19set -u
20
21
22echo @@@BUILD_STEP clobber@@@
23rm -rf scons-out toolchain ../xcodebuild ../out
24
25echo @@@BUILD_STEP compile_toolchain@@@
26tools/llvm/trusted-toolchain-creator.sh trusted_sdk arm-trusted.tgz
27chmod a+r arm-trusted.tgz
28
29echo @@@BUILD_STEP untar_toolchain@@@
30# Untar toolchain mainly to be sure we can.
31mkdir -p toolchain/linux_x86/arm_trusted
32cd toolchain/linux_x86/arm_trusted
33tar xfz ../../../arm-trusted.tgz
34# Check that we can go into a part of it.
35cd arm-2009q3
36cd ../../..
37
38if [[ "${BUILDBOT_SLAVE_TYPE:-Trybot}" != "Trybot" ]]; then
39  echo @@@BUILD_STEP archive_build@@@
40  gsutil=${GSUTIL:-gsutil}
41  GS_BASE=gs://nativeclient-archive2/toolchain
42  ${gsutil} cp -a public-read \
43      arm-trusted.tgz \
44      ${GS_BASE}/${BUILDBOT_GOT_REVISION}/naclsdk_linux_arm-trusted.tgz
45  ${gsutil} -h Cache-Control:no-cache cp -a public-read \
46      arm-trusted.tgz \
47      ${GS_BASE}/latest/naclsdk_linux_arm-trusted.tgz
48fi
49