OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 | |
3 # This script builds Skia for ChromeOS by mounting the Skia checkout inside a | |
4 # chroot contained within an existing ChromeOS checkout, entering the chroot, | |
5 # and running the build_skia_in_chroot script. | |
6 | |
7 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
8 | |
9 if [ $(uname) != "Linux" ]; then | |
10 echo "ERROR: Can only build for ChromeOS on Linux." | |
11 exit 1 | |
12 fi | |
13 | |
14 | |
15 makeVars="" | |
16 deviceID="" | |
17 | |
18 while (( "$#" )); do | |
19 | |
20 if [[ $(echo "$1" | grep "^-d$") != "" ]]; | |
21 then | |
22 deviceID="$2" | |
23 shift | |
24 else | |
25 makeVars="$makeVars $1" | |
26 fi | |
27 | |
28 shift | |
29 done | |
30 | |
31 if [[ -z "${deviceID}" ]]; then | |
32 echo "You must provide a deviceID with -d." | |
33 exit 1 | |
34 fi | |
35 | |
36 CHROMEOS_CHROOT="${SCRIPT_DIR}/../toolchain" | |
37 | |
38 # Get the required SDK version. | |
39 # TODO(borenet): Should we instead get the latest from GS? | |
40 #SDK_VERSION=$(gsutil cat gs://chromeos-image-archive/${deviceID}-release/LATEST
-master) | |
41 #SDK_VERSION=${SDK_VERSION:4} | |
42 SDK_VERSION="4279.0.0" | |
43 mkdir -p "${CHROMEOS_CHROOT}/src/chromeos" | |
44 echo -n ${SDK_VERSION} > "${CHROMEOS_CHROOT}/src/chromeos/CHROMEOS_LKGM" | |
45 | |
46 # Download the toolchain tarball if needed. | |
47 # TODO(borenet): Let chrome-sdk take care of this once it works with external | |
48 # boards. | |
49 if ! [[ -d "${CHROMEOS_CHROOT}/.cros_cache" ]]; then | |
50 TARBALL="cros_toolchain.tgz" | |
51 gsutil cp gs://chromium-skia-gm/chromeos-toolchains/${TARBALL} ${CHROMEOS_CHRO
OT} | |
52 if [ "$?" != "0" ] | |
53 then | |
54 exit 1; | |
55 fi | |
56 pushd "${CHROMEOS_CHROOT}" > /dev/null | |
57 tar -zxvf ${TARBALL} | |
58 popd > /dev/null | |
59 rm ${CHROMEOS_CHROOT}/${TARBALL} | |
60 fi | |
61 | |
62 # Put a fake .gclient file in the toolchain directory so that the cros tool | |
63 # thinks we're in a Chrome checkout. | |
64 echo "Delete me!" > "${CHROMEOS_CHROOT}/.gclient" | |
65 | |
66 # We may also need a .git directory. | |
67 GIT_DIR="${CHROMEOS_CHROOT}/src/third_party/chromite/.git" | |
68 if ! [[ -d "${GIT_DIR}" ]]; then | |
69 mkdir -p ${GIT_DIR} | |
70 fi | |
71 | |
72 # Where the Skia code will pretend to live inside the chroot. | |
73 SKIA_TOP_DIR="${SCRIPT_DIR}/../../.." | |
74 | |
75 pushd ${CHROMEOS_CHROOT} | |
76 cros chrome-sdk --nogoma --board ${deviceID} --debug -- /bin/sh -c "cd ${SKIA_TO
P_DIR}; platform_tools/chromeos/bin/build_skia_in_chroot ${makeVars}" | |
77 popd > /dev/null | |
78 | |
79 # Clean up | |
80 rm ${CHROMEOS_CHROOT}/.gclient | |
81 | |
82 if [ -f .cros_build_successful ]; then | |
83 rm -rf .cros_build_successful | |
84 exit 0 | |
85 fi | |
86 | |
87 exit 1 | |
OLD | NEW |