aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools
diff options
context:
space:
mode:
authorGravatar borenet@google.com <borenet@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-11 15:52:19 +0000
committerGravatar borenet@google.com <borenet@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-11 15:52:19 +0000
commit05d550ed364d459233874a6dcc1af3c95f195548 (patch)
tree30e2e75bee379db7d61a5d96212bb437cb3c1873 /platform_tools
parent82f317815e182fd2e34a8a41eba9ea90e01b0846 (diff)
GYP Changes and Scripts for Compiling Skia for ChromeOS
For now, this requires having a complete ChromeOS checkout. R=djsollen@google.com Review URL: https://codereview.chromium.org/16099011 git-svn-id: http://skia.googlecode.com/svn/trunk@9505 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'platform_tools')
-rwxr-xr-xplatform_tools/chromeos/bin/build_skia_in_chroot39
-rwxr-xr-xplatform_tools/chromeos/bin/chromeos_make39
-rwxr-xr-xplatform_tools/chromeos/bin/chromeos_setup.sh87
-rw-r--r--platform_tools/chromeos/gyp/dependencies.gypi35
4 files changed, 200 insertions, 0 deletions
diff --git a/platform_tools/chromeos/bin/build_skia_in_chroot b/platform_tools/chromeos/bin/build_skia_in_chroot
new file mode 100755
index 0000000000..d73ce90580
--- /dev/null
+++ b/platform_tools/chromeos/bin/build_skia_in_chroot
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# This script builds Skia inside of a ChromeOS chroot. It is intended to be run
+# either while inside the chroot or indirectly by running chromeos_make which
+# enters the chroot and runs this script.
+
+makeVars=""
+deviceID=""
+
+while (( "$#" )); do
+
+ if [[ $(echo "$1" | grep "^-d$") != "" ]];
+ then
+ deviceID="$2"
+ shift
+ else
+ makeVars="$makeVars $1"
+ fi
+
+shift
+done
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+source $SCRIPT_DIR/chromeos_setup.sh
+
+setup_device $deviceID
+returnVal=$?
+if [ $returnVal != 0 ]
+then
+ exit 1;
+fi
+
+make ${makeVars}
+returnVal=$?
+if [ $returnVal != 0 ]
+then
+ exit 1;
+fi
diff --git a/platform_tools/chromeos/bin/chromeos_make b/platform_tools/chromeos/bin/chromeos_make
new file mode 100755
index 0000000000..dc008f35fc
--- /dev/null
+++ b/platform_tools/chromeos/bin/chromeos_make
@@ -0,0 +1,39 @@
+#!/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.
+
+MAKE_FLAGS=$@
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+if [ $(uname) != "Linux" ]; then
+ echo "ERROR: Can only build for ChromeOS on Linux."
+ exit 1
+fi
+
+if [ -z "${CHROMEOS_ROOT}" ]; then
+ echo "ERROR: Please set CHROMEOS_ROOT to the root of your ChromeOS checkout."
+ exit 1
+fi
+
+CHROMEOS_CHROOT="${CHROMEOS_ROOT}/chroot"
+
+# Where the Skia code will pretend to live inside the chroot.
+SKIA_CHROOT_PARENT="/usr/local"
+SKIA_CHROOT_DIR="${SKIA_CHROOT_PARENT}/skia"
+
+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
+
+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=$?
+
+sudo umount ${CHROMEOS_CHROOT}${SKIA_CHROOT_DIR}
+
+if [ "${returnVal}" != "0" ]
+then
+ exit 1;
+fi
diff --git a/platform_tools/chromeos/bin/chromeos_setup.sh b/platform_tools/chromeos/bin/chromeos_setup.sh
new file mode 100755
index 0000000000..d0dc5b7bd1
--- /dev/null
+++ b/platform_tools/chromeos/bin/chromeos_setup.sh
@@ -0,0 +1,87 @@
+# Set up the environment to build Skia for ChromeOS.
+
+function exportVar {
+ NAME=$1
+ VALUE=$2
+ echo export $NAME=\"$VALUE\"
+ export $NAME="$VALUE"
+}
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+# Helper function to configure the GYP defines to the appropriate values
+# based on the target device.
+setup_device() {
+ DEFINES="OS=linux"
+ DEFINES="${DEFINES} host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')"
+ DEFINES="${DEFINES} skia_os=chromeos"
+
+ # TODO(borenet): We have to define skia_warnings_as_errors=0 for the arm
+ # build, which throws lots of "mangling of va_list has changed" warnings.
+ DEFINES="${DEFINES} skia_warnings_as_errors=0"
+
+ # Setup the build variation depending on the target device
+ TARGET_DEVICE="$1"
+
+ if [ -z "$TARGET_DEVICE" ]; then
+ echo "INFO: no target device type was specified so using the default 'x86-generic'"
+ TARGET_DEVICE="x86-generic"
+ fi
+
+ # Toolchain prefixes.
+ X86_TOOLCHAIN_PREFIX="i686-pc-linux-gnu"
+ AMD64_TOOLCHAIN_PREFIX="x86_64-cros-linux-gnu"
+ ARMV7_TOOLCHAIN_PREFIX="armv7a-cros-linux-gnueabi"
+
+ case $TARGET_DEVICE in
+ x86-generic)
+ DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32"
+ CHROMEOS_TOOLCHAIN_TYPE=${X86_TOOLCHAIN_PREFIX}
+ BOARD_TYPE="x86-generic"
+ ;;
+ amd64-generic)
+ DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=64"
+ CHROMEOS_TOOLCHAIN_TYPE=${AMD64_TOOLCHAIN_PREFIX}
+ BOARD_TYPE="amd64-generic"
+ ;;
+ arm-generic)
+ DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 armv7=1 arm_thumb=0 skia_arch_width=32"
+ CHROMEOS_TOOLCHAIN_TYPE=${ARMV7_TOOLCHAIN_PREFIX}
+ BOARD_TYPE="arm-generic"
+ ;;
+ *)
+ echo -n "ERROR: unknown device specified ($TARGET_DEVICE), valid values: "
+ echo "x86-generic amd64-generic arm-generic"
+ return 1;
+ ;;
+ esac
+
+ DEFINES="${DEFINES} skia_cros_target=${BOARD_TYPE}"
+
+ CHROMEOS_TOOLCHAIN_PREFIX="/usr/bin/${CHROMEOS_TOOLCHAIN_TYPE}"
+ exportVar AR "$CHROMEOS_TOOLCHAIN_PREFIX-ar"
+ if [[ -z "$CHROMEOS_MAKE_CCACHE" ]]; then
+ exportVar CC "$CHROMEOS_TOOLCHAIN_PREFIX-gcc"
+ exportVar CXX "$CHROMEOS_TOOLCHAIN_PREFIX-g++"
+ exportVar LINK "$CHROMEOS_TOOLCHAIN_PREFIX-gcc"
+ else
+ exportVar CC "$CHROMEOS_MAKE_CCACHE $CHROMEOS_TOOLCHAIN_PREFIX-gcc"
+ exportVar CXX "$CHROMEOS_MAKE_CCACHE $CHROMEOS_TOOLCHAIN_PREFIX-g++"
+ exportVar LINK "$CHROMEOS_MAKE_CCACHE $CHROMEOS_TOOLCHAIN_PREFIX-gcc"
+ fi
+ exportVar RANLIB "$CHROMEOS_TOOLCHAIN_PREFIX-ranlib"
+ exportVar OBJCOPY "$CHROMEOS_TOOLCHAIN_PREFIX-objcopy"
+ exportVar STRIP "$CHROMEOS_TOOLCHAIN_PREFIX-strip"
+
+ echo "The build is targeting the device: $TARGET_DEVICE"
+
+ BUILD_PREFIX="/build/${BOARD_TYPE}"
+
+ exportVar C_INCLUDE_PATH "${BUILD_PREFIX}/usr/include"
+ exportVar CPLUS_INCLUDE_PATH "${BUILD_PREFIX}/usr/include"
+ exportVar LIBRARY_PATH "${BUILD_PREFIX}/usr/lib"
+ exportVar LD_LIBRARY_PATH "${BUILD_PREFIX}/usr/lib"
+
+ exportVar GYP_DEFINES "$DEFINES"
+ exportVar SKIA_OUT "out/config/chromeos-${TARGET_DEVICE}"
+}
diff --git a/platform_tools/chromeos/gyp/dependencies.gypi b/platform_tools/chromeos/gyp/dependencies.gypi
new file mode 100644
index 0000000000..38e3c5337f
--- /dev/null
+++ b/platform_tools/chromeos/gyp/dependencies.gypi
@@ -0,0 +1,35 @@
+# This GYP file stores the dependencies necessary to build Skia on the Chrome OS
+# platform. The OS doesn't provide many stable libraries as part of the
+# distribution so we have to build a few of them ourselves.
+
+{
+ 'variables': {
+ 'skia_warnings_as_errors': 0,
+ },
+ 'targets': [
+ {
+ 'target_name': 'gif',
+ 'type': 'static_library',
+ 'sources': [
+ '../third_party/externals/gif/dgif_lib.c',
+ '../third_party/externals/gif/gifalloc.c',
+ '../third_party/externals/gif/gif_err.c',
+ ],
+ 'include_dirs': [
+ '../third_party/externals/gif',
+ ],
+ 'cflags': [
+ '-Wno-format',
+ '-DHAVE_CONFIG_H',
+ ],
+ 'cflags!': [
+ '-Wall',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '../third_party/externals/gif',
+ ],
+ }
+ },
+ ]
+}