2013-06-11 15:52:19 +00:00
|
|
|
#!/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
|
|
|
|
|
2013-06-19 15:13:32 +00:00
|
|
|
|
|
|
|
makeVars=""
|
|
|
|
deviceID=""
|
2013-06-19 19:44:18 +00:00
|
|
|
crosBotoFile=""
|
2013-06-19 15:13:32 +00:00
|
|
|
|
|
|
|
while (( "$#" )); do
|
|
|
|
|
|
|
|
if [[ $(echo "$1" | grep "^-d$") != "" ]];
|
|
|
|
then
|
|
|
|
deviceID="$2"
|
|
|
|
shift
|
2013-06-19 19:44:18 +00:00
|
|
|
elif [[ "$1" == "--cros-boto-file" ]];
|
|
|
|
then
|
|
|
|
crosBotoFile="$2"
|
|
|
|
shift
|
2013-06-19 15:13:32 +00:00
|
|
|
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"
|
|
|
|
|
|
|
|
# Obtain some extra headers and libraries if needed.
|
|
|
|
if ! [[ -d "${CHROMEOS_CHROOT}/x86-generic" && \
|
|
|
|
-d "${CHROMEOS_CHROOT}/amd64-generic" && \
|
|
|
|
-d "${CHROMEOS_CHROOT}/arm-generic" ]]; then
|
|
|
|
gsutil cp gs://chromium-skia-gm/chromeos-toolchains/cros_toolchain.tgz ${CHROMEOS_CHROOT}
|
|
|
|
if [[ "$?" != "0" ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
pushd ${CHROMEOS_CHROOT} > /dev/null
|
|
|
|
tar -zxvf cros_toolchain.tgz
|
|
|
|
if [[ "$?" != "0" ]]; then
|
2013-06-11 15:52:19 +00:00
|
|
|
exit 1
|
2013-06-19 15:13:32 +00:00
|
|
|
fi
|
|
|
|
rm cros_toolchain.tgz
|
|
|
|
popd > /dev/null
|
2013-06-11 15:52:19 +00:00
|
|
|
fi
|
|
|
|
|
2013-06-19 19:44:18 +00:00
|
|
|
# If a boto file was provided, use that instead of the default.
|
|
|
|
if [[ -n "$crosBotoFile" ]]; then
|
|
|
|
export AWS_CREDENTIAL_FILE="$crosBotoFile"
|
|
|
|
export BOTO_CONFIG="$crosBotoFile"
|
|
|
|
fi
|
|
|
|
|
2013-06-19 15:13:32 +00:00
|
|
|
# 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"
|
2013-06-11 15:52:19 +00:00
|
|
|
|
2013-06-19 15:13:32 +00:00
|
|
|
# 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"
|
2013-06-11 15:52:19 +00:00
|
|
|
|
2013-06-19 15:13:32 +00:00
|
|
|
# Where the Skia code will pretend to live inside the chroot.
|
|
|
|
SKIA_TOP_DIR="${SCRIPT_DIR}/../../.."
|
2013-06-11 15:52:19 +00:00
|
|
|
|
2013-06-19 15:13:32 +00:00
|
|
|
pushd ${CHROMEOS_CHROOT}
|
|
|
|
cros chrome-sdk --board ${deviceID} --debug -- /bin/sh -c "cd ${SKIA_TOP_DIR}; platform_tools/chromeos/bin/build_skia_in_chroot ${makeVars}"
|
2013-06-11 15:52:19 +00:00
|
|
|
returnVal=$?
|
2013-06-19 15:13:32 +00:00
|
|
|
popd > /dev/null
|
2013-06-11 15:52:19 +00:00
|
|
|
|
2013-06-19 15:13:32 +00:00
|
|
|
# Clean up
|
|
|
|
rm ${CHROMEOS_CHROOT}/.gclient
|
2013-06-11 15:52:19 +00:00
|
|
|
|
|
|
|
if [ "${returnVal}" != "0" ]
|
|
|
|
then
|
|
|
|
exit 1;
|
|
|
|
fi
|