OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 makeVars="" | 3 # This script builds Skia for ChromeOS by mounting the Skia checkout inside a |
4 deviceID="" | 4 # chroot contained within an existing ChromeOS checkout, entering the chroot, |
| 5 # and running the build_skia_in_chroot script. |
5 | 6 |
6 while (( "$#" )); do | 7 MAKE_FLAGS=$@ |
| 8 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
7 | 9 |
8 if [[ $(echo "$1" | grep "^-d$") != "" ]]; | 10 if [ $(uname) != "Linux" ]; then |
9 then | 11 echo "ERROR: Can only build for ChromeOS on Linux." |
10 deviceID="$2" | |
11 shift | |
12 elif [[ "$1" == "--use-ccache" ]]; | |
13 then | |
14 if [[ -z "$ANDROID_MAKE_CCACHE" ]]; | |
15 then | |
16 ANDROID_MAKE_CCACHE=$(which ccache) | |
17 fi | |
18 else | |
19 makeVars="$makeVars $1" | |
20 fi | |
21 | |
22 shift | |
23 done | |
24 | |
25 if [[ -n "$ANDROID_MAKE_CCACHE" ]]; then | |
26 $ANDROID_MAKE_CCACHE --version &> /dev/null | |
27 if [[ "$?" != "0" ]]; then | |
28 echo "Unable to find ccache!" | |
29 exit 1 | 12 exit 1 |
30 fi | |
31 fi | 13 fi |
32 | 14 |
33 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 15 if [ -z "${CHROMEOS_ROOT}" ]; then |
34 | 16 echo "ERROR: Please set CHROMEOS_ROOT to the root of your ChromeOS checkout.
" |
35 # hack for x86 support in android_setup.sh | 17 exit 1 |
36 if [ "$deviceID" == "x86" ] || [ "$deviceID" == "razr_i" ] | |
37 then | |
38 ANDROID_ARCH="x86" | |
39 fi | 18 fi |
40 | 19 |
41 source $SCRIPT_DIR/android_setup.sh | 20 CHROMEOS_CHROOT="${CHROMEOS_ROOT}/chroot" |
42 | 21 |
43 setup_device $deviceID | 22 # Where the Skia code will pretend to live inside the chroot. |
| 23 SKIA_CHROOT_PARENT="/usr/local" |
| 24 SKIA_CHROOT_DIR="${SKIA_CHROOT_PARENT}/skia" |
| 25 |
| 26 echo "Mounting Skia source at ${SKIA_CHROOT_DIR} in chroot." |
| 27 sudo mkdir -p ${CHROMEOS_CHROOT}${SKIA_CHROOT_DIR} |
| 28 sudo mount $(pwd) ${CHROMEOS_CHROOT}${SKIA_CHROOT_DIR} -o bind |
| 29 |
| 30 echo "Compiling in chroot: ${CHROMEOS_CHROOT}" |
| 31 sudo ${CHROMEOS_ROOT}/chromite/bin/cros_sdk -- /bin/sh -c "cd ${SKIA_CHROOT_DIR}
; platform_tools/chromeos/bin/build_skia_in_chroot $MAKE_FLAGS" |
44 returnVal=$? | 32 returnVal=$? |
45 if [ $returnVal != 0 ] | 33 |
| 34 sudo umount ${CHROMEOS_CHROOT}${SKIA_CHROOT_DIR} |
| 35 |
| 36 if [ "${returnVal}" != "0" ] |
46 then | 37 then |
47 exit 1; | 38 exit 1; |
48 fi | 39 fi |
49 | |
50 # write the out directory into the .android_config file | |
51 echo $SKIA_OUT > .android_config | |
52 | |
53 make $makeVars | |
54 if [ $? != 0 ] | |
55 then | |
56 exit 1; | |
57 fi | |
OLD | NEW |