Home | History | Annotate | Download | only in bin
      1 # Set up the environment to build Skia for ChromeOS.
      2 ###############################################################################
      3 # Copyright 2015 Google Inc.
      4 #
      5 # Use of this source code is governed by a BSD-style license that can be
      6 # found in the LICENSE file.
      7 ###############################################################################
      8 
      9 function exportVar {
     10   NAME=$1
     11   VALUE=$2
     12   echo export $NAME=\"$VALUE\"
     13   export $NAME="$VALUE"
     14 }
     15 
     16 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
     17 
     18 # Helper function to configure the GYP defines to the appropriate values
     19 # based on the target device.
     20 setup_device() {
     21   # Setup the build variation depending on the target device
     22   TARGET_DEVICE="${SDK_BOARD}"
     23 
     24   if [ -z "$TARGET_DEVICE" ]; then
     25     echo "ERROR: No target device specified!"
     26     return 1
     27   fi
     28 
     29   DEFINES="OS=linux host_os=linux skia_os=chromeos skia_gpu=0"
     30 
     31   case $TARGET_DEVICE in
     32     link)
     33         DEFINES="${DEFINES} skia_arch_type=x86_64"
     34         GENERIC_BOARD_TYPE="amd64-generic"
     35         ;;
     36     daisy)
     37         DEFINES="${DEFINES} skia_arch_type=arm arm_version=7 arm_neon=1"
     38         # TODO(borenet): We have to define skia_warnings_as_errors=0 for the arm
     39         # build, which throws lots of "mangling of va_list has changed" warnings.
     40         DEFINES="${DEFINES} skia_warnings_as_errors=0"
     41         GENERIC_BOARD_TYPE="arm-generic"
     42         ;;
     43     *)
     44         echo -n "ERROR: unknown device specified ($TARGET_DEVICE), valid values: "
     45         echo "x86-alex link daisy"
     46         return 1;
     47         ;;
     48   esac
     49 
     50   echo "The build is targeting the device: $TARGET_DEVICE"
     51 
     52   exportVar GENERIC_BOARD_TYPE ${GENERIC_BOARD_TYPE}
     53   exportVar GYP_DEFINES "$DEFINES"
     54   exportVar GYP_GENERATORS "ninja"
     55   exportVar GYP_GENERATOR_FLAGS ""
     56   SKIA_OUT=${SKIA_OUT:-out}
     57   exportVar SKIA_OUT "${SKIA_OUT}/config/chromeos-${TARGET_DEVICE}"
     58   exportVar builddir_name "."
     59 }
     60