| 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="" | |
| 18 | 17 |
| 19 while (( "$#" )); do | 18 while (( "$#" )); do |
| 20 | 19 |
| 21 if [[ $(echo "$1" | grep "^-d$") != "" ]]; | 20 if [[ $(echo "$1" | grep "^-d$") != "" ]]; |
| 22 then | 21 then |
| 23 deviceID="$2" | 22 deviceID="$2" |
| 24 shift | 23 shift |
| 25 elif [[ "$1" == "--cros-boto-file" ]]; | |
| 26 then | |
| 27 crosBotoFile="$2" | |
| 28 shift | |
| 29 else | 24 else |
| 30 makeVars="$makeVars $1" | 25 makeVars="$makeVars $1" |
| 31 fi | 26 fi |
| 32 | 27 |
| 33 shift | 28 shift |
| 34 done | 29 done |
| 35 | 30 |
| 36 if [[ -z "${deviceID}" ]]; then | 31 if [[ -z "${deviceID}" ]]; then |
| 37 echo "You must provide a deviceID with -d." | 32 echo "You must provide a deviceID with -d." |
| 38 exit 1 | 33 exit 1 |
| 39 fi | 34 fi |
| 40 | 35 |
| 41 CHROMEOS_CHROOT="${SCRIPT_DIR}/../toolchain" | 36 CHROMEOS_CHROOT="${SCRIPT_DIR}/../toolchain" |
| 42 | 37 |
| 43 # Obtain some extra headers and libraries if needed. | |
| 44 if ! [[ -d "${CHROMEOS_CHROOT}/x86-generic" && \ | |
| 45 -d "${CHROMEOS_CHROOT}/amd64-generic" && \ | |
| 46 -d "${CHROMEOS_CHROOT}/arm-generic" ]]; then | |
| 47 gsutil cp gs://chromium-skia-gm/chromeos-toolchains/cros_toolchain.tgz ${CHROM
EOS_CHROOT} | |
| 48 if [[ "$?" != "0" ]]; then | |
| 49 exit 1 | |
| 50 fi | |
| 51 pushd ${CHROMEOS_CHROOT} > /dev/null | |
| 52 tar -zxvf cros_toolchain.tgz | |
| 53 if [[ "$?" != "0" ]]; then | |
| 54 exit 1 | |
| 55 fi | |
| 56 rm cros_toolchain.tgz | |
| 57 popd > /dev/null | |
| 58 fi | |
| 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 | |
| 66 # Get the required SDK version. | 38 # Get the required SDK version. |
| 67 # TODO(borenet): Should we instead get the latest from GS? | 39 # TODO(borenet): Should we instead get the latest from GS? |
| 68 #SDK_VERSION=$(gsutil cat gs://chromeos-image-archive/${deviceID}-release/LATEST
-master) | 40 #SDK_VERSION=$(gsutil cat gs://chromeos-image-archive/${deviceID}-release/LATEST
-master) |
| 69 #SDK_VERSION=${SDK_VERSION:4} | 41 #SDK_VERSION=${SDK_VERSION:4} |
| 70 SDK_VERSION="4279.0.0" | 42 SDK_VERSION="4279.0.0" |
| 71 mkdir -p "${CHROMEOS_CHROOT}/src/chromeos" | 43 mkdir -p "${CHROMEOS_CHROOT}/src/chromeos" |
| 72 echo -n ${SDK_VERSION} > "${CHROMEOS_CHROOT}/src/chromeos/CHROMEOS_LKGM" | 44 echo -n ${SDK_VERSION} > "${CHROMEOS_CHROOT}/src/chromeos/CHROMEOS_LKGM" |
| 73 | 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 |
| 74 # Put a fake .gclient file in the toolchain directory so that the cros tool | 62 # Put a fake .gclient file in the toolchain directory so that the cros tool |
| 75 # thinks we're in a Chrome checkout. | 63 # thinks we're in a Chrome checkout. |
| 76 echo "Delete me!" > "${CHROMEOS_CHROOT}/.gclient" | 64 echo "Delete me!" > "${CHROMEOS_CHROOT}/.gclient" |
| 77 | 65 |
| 78 # Where the Skia code will pretend to live inside the chroot. | 66 # Where the Skia code will pretend to live inside the chroot. |
| 79 SKIA_TOP_DIR="${SCRIPT_DIR}/../../.." | 67 SKIA_TOP_DIR="${SCRIPT_DIR}/../../.." |
| 80 | 68 |
| 81 pushd ${CHROMEOS_CHROOT} | 69 pushd ${CHROMEOS_CHROOT} |
| 82 cros chrome-sdk --board ${deviceID} --debug -- /bin/sh -c "cd ${SKIA_TOP_DIR}; p
latform_tools/chromeos/bin/build_skia_in_chroot ${makeVars}" | 70 cros chrome-sdk --board ${deviceID} --debug -- /bin/sh -c "cd ${SKIA_TOP_DIR}; p
latform_tools/chromeos/bin/build_skia_in_chroot ${makeVars}" |
| 83 returnVal=$? | 71 returnVal=$? |
| 84 popd > /dev/null | 72 popd > /dev/null |
| 85 | 73 |
| 86 # Clean up | 74 # Clean up |
| 87 rm ${CHROMEOS_CHROOT}/.gclient | 75 rm ${CHROMEOS_CHROOT}/.gclient |
| 88 | 76 |
| 89 if [ "${returnVal}" != "0" ] | 77 if [ "${returnVal}" != "0" ] |
| 90 then | 78 then |
| 91 exit 1; | 79 exit 1; |
| 92 fi | 80 fi |
| OLD | NEW |