aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/chromeos/bin/chromeos_make
blob: a1cb2ba6a3df8a75654b708280afdb37b4b7d458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash

# This script builds Skia for ChromeOS by mounting the Skia checkout inside a
# chroot contained within an existing ChromeOS checkout, entering the chroot,
# and running the build_skia_in_chroot script.

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

if [ $(uname) != "Linux" ]; then
    echo "ERROR: Can only build for ChromeOS on Linux."
    exit 1
fi


makeVars=""
deviceID=""

while (( "$#" )); do

  if [[ $(echo "$1" | grep "^-d$") != "" ]];
  then 
    deviceID="$2"
    shift
  else
    makeVars="$makeVars $1"
  fi

shift
done

if [[ -z "${deviceID}" ]]; then
  echo "You must provide a deviceID with -d."
  exit 1
fi

CHROMEOS_CHROOT="${SCRIPT_DIR}/../toolchain"

# Get the required SDK version.
# TODO(borenet): Should we instead get the latest from GS?
#SDK_VERSION=$(gsutil cat gs://chromeos-image-archive/${deviceID}-release/LATEST-master)
#SDK_VERSION=${SDK_VERSION:4}
SDK_VERSION="4279.0.0"
mkdir -p "${CHROMEOS_CHROOT}/src/chromeos"
echo -n ${SDK_VERSION} > "${CHROMEOS_CHROOT}/src/chromeos/CHROMEOS_LKGM"

# Download the toolchain tarball if needed.
# TODO(borenet): Let chrome-sdk take care of this once it works with external
# boards.
if ! [[ -d "${CHROMEOS_CHROOT}/.cros_cache" ]]; then
  TARBALL="cros_toolchain.tgz"
  gsutil cp gs://chromium-skia-gm/chromeos-toolchains/${TARBALL} ${CHROMEOS_CHROOT}
  if [ "$?" != "0" ]
  then
    exit 1;
  fi
  pushd "${CHROMEOS_CHROOT}" > /dev/null
  tar -zxvf ${TARBALL}
  popd > /dev/null
  rm ${CHROMEOS_CHROOT}/${TARBALL}
fi

# Put a fake .gclient file in the toolchain directory so that the cros tool
# thinks we're in a Chrome checkout.
echo "Delete me!" > "${CHROMEOS_CHROOT}/.gclient"

# Where the Skia code will pretend to live inside the chroot.
SKIA_TOP_DIR="${SCRIPT_DIR}/../../.."

pushd ${CHROMEOS_CHROOT}
cros chrome-sdk --nogoma --board ${deviceID} --debug -- /bin/sh -c "cd ${SKIA_TOP_DIR}; platform_tools/chromeos/bin/build_skia_in_chroot ${makeVars}"
popd > /dev/null

# Clean up
rm ${CHROMEOS_CHROOT}/.gclient

if [ -f .cros_build_successful ]; then
  rm -rf .cros_build_successful
  exit 0
fi

exit 1