skia2/bin/sync-and-gyp
halcanary 43315bbe4b sync-and-gyp: make smarter
This fixes two issues: If gyp is run with the CXX and CC environment
variables set, it will produce different ninja build files.
sync-and-gyp now tracks the values of those variables; if they change,
re-run gyp.

Secondly, we introduced find.py, which is used inside gyp files.  If
the contents of certain directories changes, gyp should be re-run.  So
now we track those directories too.

Review URL: https://codereview.chromium.org/1153083002
2015-05-26 08:01:19 -07:00

60 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
# Copyright 2015 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script will update Skia's dependenciess as necessary and run
# gyp if needed.
# Example usage (assumes Posix-standard shell, git installed):
#
# git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
# export PATH="${PWD}/depot_tools:${PATH}"
# git clone https://skia.googlesource.com/skia
# cd skia
# bin/sync-and-gyp && ninja -C out/Debug
# out/Debug/dm
#
# Once changes are made to DEPS or gyp/ or the source, recompile Skia with:
#
# ${skiadir}/bin/sync-and-gyp && ninja -C ${skiadir}/out/Debug
cd "$(dirname "$0")/.."
if ! [ -f .gclient ] ; then
gclient config --name . --unmanaged 'https://skia.googlesource.com/skia'
fi
if ! [ -f DEPS ]; then
echo DEPS file missing >&2
exit 1
fi
if [ "$(git hash-object DEPS)" != "$(git config sync-deps.last)" ] ; then
gclient sync || exit
git config sync-deps.last "$(git hash-object DEPS)"
fi
function catifexists() { if [ -f "$1" ]; then cat "$1"; fi; }
function gyp_hasher() {
{
echo "$CC"
echo "$CXX"
echo "$GYP_GENERATORS"
echo "$GYP_DEFINES"
find gyp -type f -print -exec git hash-object {} \;
find bench gm tests -name '*.c*' | LANG= sort
} | git hash-object --stdin
}
: ${SKIA_OUT:=out}
GYP_HASH=$(gyp_hasher)
HASH_PATH="${SKIA_OUT}/gyp_hash"
if [ "$GYP_HASH" != "$(catifexists "$HASH_PATH")" ]; then
python ./gyp_skia || exit
echo "$GYP_HASH" > "$HASH_PATH"
fi