1#!/bin/sh 2 3# Copyright 2014 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 8set -e # When any command fails, the shell will immediately exit. 9 10if echo $- | grep -q 'x'; then 11 # Debug mode 12 trap 'echo exit status = $?' EXIT 13fi 14 15usage() { 16 cat >&2 <<EOF 17barelinux_make - this script builds a version of skia that does not 18depend on external libraries, perfect for putting in an embedded 19system running Linux. 20 21Assumes that you have already run the download_deps script. 22 23Usage: 24 $0 \\ 25 [-o SKIA_OUT_DIR] [-c CC_EXE] [-x CXX_EXE] \\ 26 [-t Debug | Release | Coverage | Release_Developer] \\ 27 [GYP_DEFINES...] 28 29Example use: 30 $0 \\ 31 -o ~/build/skia/arg64gcc \\ 32 -c ~/local/arm64/bin/aarch64-linux-gnu-gcc \\ 33 -x ~/local/arm64/bin/aarch64-linux-gnu-g++ \\ 34 skia_gpu=0 skia_arch_type=arm skia_arch_width=64 \\ 35 armv7=1 armv8=1 arm_neon=0 arm_thumb=0 36EOF 37 return 1 38} 39 40# BUILD_TYPE should be one of: 41# Coverage, Debug, Release, or Release_Developer 42BUILD_TYPE='Debug' 43 44while getopts ":c:x:o:t:h" opt ; do 45 case $opt in 46 c) export CC="$OPTARG" ;; 47 x) export CXX="$OPTARG" ;; 48 o) export SKIA_OUT="$OPTARG";; 49 t) BUILD_TYPE="$OPTARG";; 50 h) usage || exit;; 51 ?) echo "unknown option '$OPTARG'" >&2; 52 usage || exit;; 53 esac 54done 55# Append exra arguments to GYP_DEFINES variable. 56shift $(( $OPTIND - 1 )) 57GYP_DEFINES="${GYP_DEFINES} $*" 58 59# If you move this script, this must be changed. 60SKIA_SRC_DIR="$(cd "$(dirname "$0")/../../.."; pwd)" 61 62# Set a reasonable default. 63export SKIA_OUT="${SKIA_OUT:-${SKIA_SRC_DIR}/out/barelinux}" 64 65mkdir -p "$SKIA_OUT" 66 67export GYP_GENERATORS="ninja" 68export GYP_GENERATOR_FLAGS="" 69export GYP_DEFINES="${GYP_DEFINES} \ 70 skia_warnings_as_errors=0 \ 71 skia_giflib_static=1 \ 72 skia_libpng_static=1 \ 73 skia_zlib_static=1 \ 74 skia_freetype_static=1 \ 75 skia_no_fontconfig=1 \ 76 skia_poppler_enabled=0 \ 77 skia_skip_gui=1 \ 78 " 79 80"${SKIA_SRC_DIR}/gyp_skia" 81 82ninja -C "${SKIA_OUT}/${BUILD_TYPE}" 83 84