halcanary | 135b7ec | 2015-03-27 12:11:49 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Copyright 2015 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 | # This script will update Skia's dependenciess as necessary and run |
| 9 | # gyp if needed. |
| 10 | |
| 11 | # Example usage (assumes Posix-standard shell, git installed): |
| 12 | # |
| 13 | # git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 14 | # export PATH="${PWD}/depot_tools:${PATH}" |
| 15 | # git clone https://skia.googlesource.com/skia |
| 16 | # cd skia |
| 17 | # bin/sync-and-gyp && ninja -C out/Debug |
| 18 | # out/Debug/dm |
| 19 | # |
| 20 | # Once changes are made to DEPS or gyp/ or the source, recompile Skia with: |
| 21 | # |
| 22 | # ${skiadir}/bin/sync-and-gyp && ninja -C ${skiadir}/out/Debug |
| 23 | |
| 24 | cd "$(dirname "$0")/.." |
| 25 | |
| 26 | if ! [ -f .gclient ] ; then |
| 27 | gclient config --name . --unmanaged 'https://skia.googlesource.com/skia' |
| 28 | fi |
| 29 | |
| 30 | if ! [ -f DEPS ]; then |
| 31 | echo DEPS file missing >&2 |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
| 35 | if [ "$(git hash-object DEPS)" != "$(git config sync-deps.last)" ] ; then |
| 36 | gclient sync || exit |
| 37 | git config sync-deps.last "$(git hash-object DEPS)" |
| 38 | fi |
| 39 | |
| 40 | function catifexists() { if [ -f "$1" ]; then cat "$1"; fi; } |
| 41 | |
| 42 | function gyp_hasher() { |
| 43 | { |
halcanary | 43315bb | 2015-05-26 08:01:19 -0700 | [diff] [blame] | 44 | echo "$CC" |
| 45 | echo "$CXX" |
halcanary | 135b7ec | 2015-03-27 12:11:49 -0700 | [diff] [blame] | 46 | echo "$GYP_GENERATORS" |
| 47 | echo "$GYP_DEFINES" |
| 48 | find gyp -type f -print -exec git hash-object {} \; |
halcanary | 43315bb | 2015-05-26 08:01:19 -0700 | [diff] [blame] | 49 | find bench gm tests -name '*.c*' | LANG= sort |
halcanary | 135b7ec | 2015-03-27 12:11:49 -0700 | [diff] [blame] | 50 | } | git hash-object --stdin |
| 51 | } |
| 52 | |
| 53 | : ${SKIA_OUT:=out} |
| 54 | GYP_HASH=$(gyp_hasher) |
| 55 | HASH_PATH="${SKIA_OUT}/gyp_hash" |
| 56 | if [ "$GYP_HASH" != "$(catifexists "$HASH_PATH")" ]; then |
halcanary | 8440baa | 2015-04-24 14:33:06 -0700 | [diff] [blame] | 57 | python ./gyp_skia || exit |
halcanary | 135b7ec | 2015-03-27 12:11:49 -0700 | [diff] [blame] | 58 | echo "$GYP_HASH" > "$HASH_PATH" |
| 59 | fi |