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