Index: platform_tools/chromeos/bin/chromeos_make |
=================================================================== |
--- platform_tools/chromeos/bin/chromeos_make (revision 0) |
+++ platform_tools/chromeos/bin/chromeos_make (working copy) |
@@ -1,57 +1,39 @@ |
#!/bin/bash |
-makeVars="" |
-deviceID="" |
+# 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. |
-while (( "$#" )); do |
+MAKE_FLAGS=$@ |
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
- if [[ $(echo "$1" | grep "^-d$") != "" ]]; |
- then |
- deviceID="$2" |
- shift |
- elif [[ "$1" == "--use-ccache" ]]; |
- then |
- if [[ -z "$ANDROID_MAKE_CCACHE" ]]; |
- then |
- ANDROID_MAKE_CCACHE=$(which ccache) |
- fi |
- else |
- makeVars="$makeVars $1" |
- fi |
+if [ $(uname) != "Linux" ]; then |
+ echo "ERROR: Can only build for ChromeOS on Linux." |
+ exit 1 |
+fi |
-shift |
-done |
- |
-if [[ -n "$ANDROID_MAKE_CCACHE" ]]; then |
- $ANDROID_MAKE_CCACHE --version &> /dev/null |
- if [[ "$?" != "0" ]]; then |
- echo "Unable to find ccache!" |
+if [ -z "${CHROMEOS_ROOT}" ]; then |
+ echo "ERROR: Please set CHROMEOS_ROOT to the root of your ChromeOS checkout." |
exit 1 |
- fi |
fi |
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
+CHROMEOS_CHROOT="${CHROMEOS_ROOT}/chroot" |
-# hack for x86 support in android_setup.sh |
-if [ "$deviceID" == "x86" ] || [ "$deviceID" == "razr_i" ] |
-then |
- ANDROID_ARCH="x86" |
-fi |
+# Where the Skia code will pretend to live inside the chroot. |
+SKIA_CHROOT_PARENT="/usr/local" |
+SKIA_CHROOT_DIR="${SKIA_CHROOT_PARENT}/skia" |
-source $SCRIPT_DIR/android_setup.sh |
+echo "Mounting Skia source at ${SKIA_CHROOT_DIR} in chroot." |
+sudo mkdir -p ${CHROMEOS_CHROOT}${SKIA_CHROOT_DIR} |
+sudo mount $(pwd) ${CHROMEOS_CHROOT}${SKIA_CHROOT_DIR} -o bind |
-setup_device $deviceID |
+echo "Compiling in chroot: ${CHROMEOS_CHROOT}" |
+sudo ${CHROMEOS_ROOT}/chromite/bin/cros_sdk -- /bin/sh -c "cd ${SKIA_CHROOT_DIR}; platform_tools/chromeos/bin/build_skia_in_chroot $MAKE_FLAGS" |
returnVal=$? |
-if [ $returnVal != 0 ] |
-then |
- exit 1; |
-fi |
-# write the out directory into the .android_config file |
-echo $SKIA_OUT > .android_config |
+sudo umount ${CHROMEOS_CHROOT}${SKIA_CHROOT_DIR} |
-make $makeVars |
-if [ $? != 0 ] |
+if [ "${returnVal}" != "0" ] |
then |
exit 1; |
fi |