| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # This script builds Skia for ChromeOS by mounting the Skia checkout inside a | 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, | 4 # chroot contained within an existing ChromeOS checkout, entering the chroot, |
| 5 # and running the build_skia_in_chroot script. | 5 # and running the build_skia_in_chroot script. |
| 6 | 6 |
| 7 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 7 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 8 | 8 |
| 9 if [ $(uname) != "Linux" ]; then | 9 if [ $(uname) != "Linux" ]; then |
| 10 echo "ERROR: Can only build for ChromeOS on Linux." | 10 echo "ERROR: Can only build for ChromeOS on Linux." |
| 11 exit 1 | 11 exit 1 |
| 12 fi | 12 fi |
| 13 | 13 |
| 14 | 14 |
| 15 makeVars="" | 15 makeVars="" |
| 16 deviceID="" | 16 deviceID="" |
| 17 crosBotoFile="" |
| 17 | 18 |
| 18 while (( "$#" )); do | 19 while (( "$#" )); do |
| 19 | 20 |
| 20 if [[ $(echo "$1" | grep "^-d$") != "" ]]; | 21 if [[ $(echo "$1" | grep "^-d$") != "" ]]; |
| 21 then | 22 then |
| 22 deviceID="$2" | 23 deviceID="$2" |
| 23 shift | 24 shift |
| 25 elif [[ "$1" == "--cros-boto-file" ]]; |
| 26 then |
| 27 crosBotoFile="$2" |
| 28 shift |
| 24 else | 29 else |
| 25 makeVars="$makeVars $1" | 30 makeVars="$makeVars $1" |
| 26 fi | 31 fi |
| 27 | 32 |
| 28 shift | 33 shift |
| 29 done | 34 done |
| 30 | 35 |
| 31 if [[ -z "${deviceID}" ]]; then | 36 if [[ -z "${deviceID}" ]]; then |
| 32 echo "You must provide a deviceID with -d." | 37 echo "You must provide a deviceID with -d." |
| 33 exit 1 | 38 exit 1 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 45 fi | 50 fi |
| 46 pushd ${CHROMEOS_CHROOT} > /dev/null | 51 pushd ${CHROMEOS_CHROOT} > /dev/null |
| 47 tar -zxvf cros_toolchain.tgz | 52 tar -zxvf cros_toolchain.tgz |
| 48 if [[ "$?" != "0" ]]; then | 53 if [[ "$?" != "0" ]]; then |
| 49 exit 1 | 54 exit 1 |
| 50 fi | 55 fi |
| 51 rm cros_toolchain.tgz | 56 rm cros_toolchain.tgz |
| 52 popd > /dev/null | 57 popd > /dev/null |
| 53 fi | 58 fi |
| 54 | 59 |
| 60 # If a boto file was provided, use that instead of the default. |
| 61 if [[ -n "$crosBotoFile" ]]; then |
| 62 export AWS_CREDENTIAL_FILE="$crosBotoFile" |
| 63 export BOTO_CONFIG="$crosBotoFile" |
| 64 fi |
| 65 |
| 55 # Get the required SDK version. | 66 # Get the required SDK version. |
| 56 # TODO(borenet): Should we instead get the latest from GS? | 67 # TODO(borenet): Should we instead get the latest from GS? |
| 57 #SDK_VERSION=$(gsutil cat gs://chromeos-image-archive/${deviceID}-release/LATEST
-master) | 68 #SDK_VERSION=$(gsutil cat gs://chromeos-image-archive/${deviceID}-release/LATEST
-master) |
| 58 #SDK_VERSION=${SDK_VERSION:4} | 69 #SDK_VERSION=${SDK_VERSION:4} |
| 59 SDK_VERSION="4279.0.0" | 70 SDK_VERSION="4279.0.0" |
| 60 mkdir -p "${CHROMEOS_CHROOT}/src/chromeos" | 71 mkdir -p "${CHROMEOS_CHROOT}/src/chromeos" |
| 61 echo -n ${SDK_VERSION} > "${CHROMEOS_CHROOT}/src/chromeos/CHROMEOS_LKGM" | 72 echo -n ${SDK_VERSION} > "${CHROMEOS_CHROOT}/src/chromeos/CHROMEOS_LKGM" |
| 62 | 73 |
| 63 # Put a fake .gclient file in the toolchain directory so that the cros tool | 74 # Put a fake .gclient file in the toolchain directory so that the cros tool |
| 64 # thinks we're in a Chrome checkout. | 75 # thinks we're in a Chrome checkout. |
| 65 echo "Delete me!" > "${CHROMEOS_CHROOT}/.gclient" | 76 echo "Delete me!" > "${CHROMEOS_CHROOT}/.gclient" |
| 66 | 77 |
| 67 # Where the Skia code will pretend to live inside the chroot. | 78 # Where the Skia code will pretend to live inside the chroot. |
| 68 SKIA_TOP_DIR="${SCRIPT_DIR}/../../.." | 79 SKIA_TOP_DIR="${SCRIPT_DIR}/../../.." |
| 69 | 80 |
| 70 pushd ${CHROMEOS_CHROOT} | 81 pushd ${CHROMEOS_CHROOT} |
| 71 cros chrome-sdk --board ${deviceID} --debug -- /bin/sh -c "cd ${SKIA_TOP_DIR}; p
latform_tools/chromeos/bin/build_skia_in_chroot ${makeVars}" | 82 cros chrome-sdk --board ${deviceID} --debug -- /bin/sh -c "cd ${SKIA_TOP_DIR}; p
latform_tools/chromeos/bin/build_skia_in_chroot ${makeVars}" |
| 72 returnVal=$? | 83 returnVal=$? |
| 73 popd > /dev/null | 84 popd > /dev/null |
| 74 | 85 |
| 75 # Clean up | 86 # Clean up |
| 76 rm ${CHROMEOS_CHROOT}/.gclient | 87 rm ${CHROMEOS_CHROOT}/.gclient |
| 77 | 88 |
| 78 if [ "${returnVal}" != "0" ] | 89 if [ "${returnVal}" != "0" ] |
| 79 then | 90 then |
| 80 exit 1; | 91 exit 1; |
| 81 fi | 92 fi |
| OLD | NEW |