• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# Copyright 2014 Google Inc.
3#
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# install_dependencies.sh will install system-specific Skia
8# dependencies using your system's package manager.  If your system is
9# not supported, add logic here to support it.
10
11# Pass in --yes as the first argument to force apt-get to skip Y/n prompts while
12# being backward compatible with the old behavior.
13
14set -e
15
16# Return 0 iff all package name arguments are installed.
17dpkg_all_installed() {
18    for arg; do
19        if !(dpkg-query -W -f'${Status}' "$arg" 2>/dev/null | \
20            grep -q "ok installed"); then
21            return 1
22        fi
23    done
24    return 0
25}
26
27if command -v lsb_release > /dev/null ; then
28    case $(lsb_release -i -s) in
29        Ubuntu|Debian)
30            PACKAGES=$(cat<<-EOF
31		build-essential
32		freeglut3-dev
33		libfontconfig-dev
34		libfreetype6-dev
35		libgif-dev
36		libgl1-mesa-dev
37		libglu1-mesa-dev
38		libharfbuzz-dev
39		libicu-dev
40		libjpeg-dev
41		libpng-dev
42		libwebp-dev
43		EOF
44            )
45           if [ $(lsb_release -r -s) = '14.04' ] ; then
46               PACKAGES="${PACKAGES} ninja-build"
47           fi
48           if ! dpkg_all_installed $PACKAGES; then
49               sudo apt-get $1 install $PACKAGES
50           fi
51           exit
52           ;;
53    esac
54fi
55
56echo 'unknown system'
57exit 1
58