aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/install_dependencies.sh
blob: 037b8940bd0609f2c5fcff8f4c5c6eeabb8ba087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/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.

# install_dependencies.sh will install system-specific Skia
# dependencies using your system's package manager.  If your system is
# not supported, add logic here to support it.

set -e

# Return 0 iff all package name arguments are installed.
dpkg_all_installed() {
    for arg; do
        if !(dpkg-query -W -f'${Status}' "$arg" 2>/dev/null | \
            grep -q "ok installed"); then
            return 1
        fi
    done
    return 0
}

if command -v lsb_release > /dev/null ; then
    case $(lsb_release -i -s) in
        Ubuntu)
            PACKAGES=$(cat<<-EOF
		build-essential
		libfreetype6-dev
		libfontconfig-dev
		libpng12-dev
		libgif-dev
		libqt4-dev
		EOF
            )
           if [ $(lsb_release -r -s) = '14.04' ] ; then
               PACKAGES="${PACKAGES} ninja-build"
            fi
            if ! dpkg_all_installed $PACKAGES; then
                sudo apt-get install $PACKAGES
            fi
            exit
            ;;
    esac
fi

echo 'unknown system'
exit 1