OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright 2015 Google Inc. | 3 # Copyright 2015 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 # This script will update Skia's dependenciess as necessary and run | 8 # This script will update Skia's dependenciess as necessary and run |
9 # gyp if needed. | 9 # gyp if needed. |
10 | 10 |
11 # Example usage (assumes Posix-standard shell, git installed): | 11 # Depends on: Posix-compliant shell, Python, and Git. |
12 # | 12 # |
13 # git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | 13 # Example usage: |
14 # export PATH="${PWD}/depot_tools:${PATH}" | 14 # |
15 # git clone https://skia.googlesource.com/skia | 15 # git clone https://skia.googlesource.com/skia |
16 # cd skia | 16 # cd skia |
17 # bin/sync-and-gyp && ninja -C out/Debug | 17 # bin/deps-and-gyp |
18 # out/Debug/dm | 18 # ninja -C out/Debug && out/Debug/dm |
19 # | 19 # |
20 # Once changes are made to DEPS or gyp/ or the source, recompile Skia with: | 20 # Once changes are made to DEPS or gyp/ or the source, call: |
21 # | 21 # |
22 # ${skiadir}/bin/sync-and-gyp && ninja -C ${skiadir}/out/Debug | 22 # bin/deps-and-gyp |
| 23 |
| 24 if [ "$SKIA_OUT" ]; then |
| 25 mkdir -p "$SKIA_OUT" || exit |
| 26 # get non-relative path of $SKIA_OUT before changing directory. |
| 27 SKIA_OUT="$(cd "$SKIA_OUT"; pwd)" |
| 28 fi |
23 | 29 |
24 cd "$(dirname "$0")/.." | 30 cd "$(dirname "$0")/.." |
25 | 31 |
26 if ! [ -f .gclient ] ; then | |
27 gclient config --unmanaged 'https://skia.googlesource.com/skia' | |
28 printf ',s/"skia"/"."/\nwq\n' | ed .gclient | |
29 fi | |
30 | |
31 if ! [ -f DEPS ]; then | 32 if ! [ -f DEPS ]; then |
32 echo DEPS file missing >&2 | 33 echo DEPS file missing >&2 |
33 exit 1 | 34 exit 1 |
34 fi | 35 fi |
35 | 36 |
36 if [ "$(git hash-object DEPS)" != "$(git config sync-deps.last)" ] ; then | 37 if [ "$(git hash-object DEPS)" != "$(git config sync-deps.last)" ] ; then |
37 gclient sync || exit | 38 GIT_SYNC_DEPS_QUIET=1 python tools/git-sync-deps || exit |
38 git config sync-deps.last "$(git hash-object DEPS)" | 39 git config sync-deps.last "$(git hash-object DEPS)" |
39 fi | 40 fi |
40 | 41 |
41 catifexists() { if [ -f "$1" ]; then cat "$1"; fi; } | 42 catifexists() { if [ -f "$1" ]; then cat "$1"; fi; } |
42 | 43 |
43 gyp_hasher() { | 44 gyp_hasher() { |
44 { | 45 { |
45 echo "$CC" | 46 echo "$CC" |
46 echo "$CXX" | 47 echo "$CXX" |
47 echo "$GYP_GENERATORS" | 48 echo "$GYP_GENERATORS" |
48 echo "$GYP_DEFINES" | 49 echo "$GYP_DEFINES" |
49 find gyp -type f -print -exec git hash-object {} \; | 50 find gyp -type f -print -exec git hash-object {} \; |
50 find bench gm tests -name '*.c*' | LANG= sort | 51 find bench gm tests -name '*.c*' | LANG= sort |
51 } | git hash-object --stdin | 52 } | git hash-object --stdin |
52 } | 53 } |
53 | 54 |
54 : ${SKIA_OUT:=out} | 55 : ${SKIA_OUT:=out} |
55 GYP_HASH=$(gyp_hasher) | 56 GYP_HASH=$(gyp_hasher) |
56 HASH_PATH="${SKIA_OUT}/gyp_hash" | 57 HASH_PATH="${SKIA_OUT}/gyp_hash" |
57 if [ "$GYP_HASH" != "$(catifexists "$HASH_PATH")" ]; then | 58 if [ "$GYP_HASH" != "$(catifexists "$HASH_PATH")" ]; then |
58 python ./gyp_skia || exit | 59 python ./gyp_skia || exit |
59 echo "$GYP_HASH" > "$HASH_PATH" | 60 echo "$GYP_HASH" > "$HASH_PATH" |
60 fi | 61 fi |
OLD | NEW |