OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright 2014 Google Inc. | 3 # Copyright 2014 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
| 8 set -e # When any command fails, the shell will immediately exit. |
| 9 |
| 10 if echo $- | grep -q 'x'; then |
| 11 # Debug mode |
| 12 trap 'echo exit status = $?' EXIT |
| 13 fi |
| 14 |
8 usage() { | 15 usage() { |
9 cat >&2 <<EOF | 16 cat >&2 <<EOF |
10 barelinux_make - this script builds a version of skia that does not | 17 barelinux_make - this script builds a version of skia that does not |
11 depend on external libraries, perfect for putting in an embedded | 18 depend on external libraries, perfect for putting in an embedded |
12 system running Linux. | 19 system running Linux. |
13 | 20 |
14 Assumes that you have already run the download_deps script. | 21 Assumes that you have already run the download_deps script. |
15 | 22 |
16 Usage: | 23 Usage: |
17 $0 \\ | 24 $0 \\ |
(...skipping 27 matching lines...) Expand all Loading... |
45 usage || exit;; | 52 usage || exit;; |
46 esac | 53 esac |
47 done | 54 done |
48 # Append exra arguments to GYP_DEFINES variable. | 55 # Append exra arguments to GYP_DEFINES variable. |
49 shift $(( $OPTIND - 1 )) | 56 shift $(( $OPTIND - 1 )) |
50 GYP_DEFINES="${GYP_DEFINES} $*" | 57 GYP_DEFINES="${GYP_DEFINES} $*" |
51 | 58 |
52 # If you move this script, this must be changed. | 59 # If you move this script, this must be changed. |
53 SKIA_SRC_DIR="$(cd "$(dirname "$0")/../../.."; pwd)" | 60 SKIA_SRC_DIR="$(cd "$(dirname "$0")/../../.."; pwd)" |
54 | 61 |
55 try() { | 62 # Set a reasonable default. |
56 # exit shell script on nonzero return code | 63 export SKIA_OUT="${SKIA_OUT:-${SKIA_SRC_DIR}/out/barelinux}" |
57 "$@" | |
58 local ret=$? | |
59 if [ $ret != 0 ] ; then | |
60 echo "'$@' failed and returned ${ret}." >&2 | |
61 return $ret | |
62 fi | |
63 } | |
64 is_set() { | |
65 test "$1" && test "$(eval echo \${$1})"; | |
66 } | |
67 | 64 |
68 # Set a reasonable default. | 65 mkdir -p "$SKIA_OUT" |
69 is_set SKIA_OUT || export SKIA_OUT="${SKIA_SRC_DIR}/out/barelinux" | |
70 | |
71 # Assume ninja is in your path | |
72 try command -v ninja > /dev/null || exit | |
73 | |
74 try test -x "${SKIA_SRC_DIR}/gyp_skia" || exit | |
75 try mkdir -p "$SKIA_OUT" || exit | |
76 | 66 |
77 export GYP_GENERATORS="ninja" | 67 export GYP_GENERATORS="ninja" |
78 export GYP_GENERATOR_FLAGS="" | 68 export GYP_GENERATOR_FLAGS="" |
79 export GYP_DEFINES="${GYP_DEFINES} \ | 69 export GYP_DEFINES="${GYP_DEFINES} \ |
80 skia_warnings_as_errors=0 \ | 70 skia_warnings_as_errors=0 \ |
81 skia_giflib_static=1 \ | 71 skia_giflib_static=1 \ |
82 skia_libpng_static=1 \ | 72 skia_libpng_static=1 \ |
83 skia_zlib_static=1 \ | 73 skia_zlib_static=1 \ |
84 skia_freetype_static=1 \ | 74 skia_freetype_static=1 \ |
85 skia_no_fontconfig=1 \ | 75 skia_no_fontconfig=1 \ |
86 skia_poppler_enabled=0 \ | 76 skia_poppler_enabled=0 \ |
87 skia_skip_gui=1 \ | 77 skia_skip_gui=1 \ |
88 " | 78 " |
89 | 79 |
90 try "${SKIA_SRC_DIR}/gyp_skia" || exit | 80 "${SKIA_SRC_DIR}/gyp_skia" |
91 | 81 |
92 try test -d "${SKIA_OUT}/${BUILD_TYPE}" || exit | 82 ninja -C "${SKIA_OUT}/${BUILD_TYPE}" |
93 | 83 |
94 try ninja -C "${SKIA_OUT}/${BUILD_TYPE}" || exit | |
95 | |
OLD | NEW |