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