#!/bin/sh

# Copyright 2014 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# download_deps - download Skia's dependencies for a bare Linux system
# (the normal dependecies plus giflib, libpng, and zlib.)

try() {
    # print an error on nonzero return code
    "$@"
    local ret=$?
    if [ $ret != 0 ] ; then
        echo "'$@' failed and returned ${ret}." >&2
        return $ret
    fi
}

try command -v gclient > /dev/null || exit
cd "$(dirname "$0")/../../.."

try gclient config --unmanaged --name . \
    'https://skia.googlesource.com/skia.git' || exit

echo 'target_os = ["barelinux"]' >> ./.gclient

try gclient sync --jobs=1 || exit