OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # Copyright 2014 Google Inc. | 2 # Copyright 2014 Google Inc. |
3 # | 3 # |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # install_dependencies.sh will install system-specific Skia | 7 # install_dependencies.sh will install system-specific Skia |
8 # dependencies using your system's package manager. If your system is | 8 # dependencies using your system's package manager. If your system is |
9 # not supported, add logic here to support it. | 9 # not supported, add logic here to support it. |
10 | 10 |
11 set -e | 11 set -e |
12 | 12 |
| 13 # Return 0 iff all package name arguments are installed. |
| 14 dpkg_all_installed() { |
| 15 for arg; do |
| 16 if !(dpkg-query -W -f'${Status}' "$arg" 2>/dev/null | \ |
| 17 grep -q "ok installed"); then |
| 18 return 1 |
| 19 fi |
| 20 done |
| 21 return 0 |
| 22 } |
| 23 |
13 if command -v lsb_release > /dev/null ; then | 24 if command -v lsb_release > /dev/null ; then |
14 case $(lsb_release -i -s) in | 25 case $(lsb_release -i -s) in |
15 Ubuntu) | 26 Ubuntu) |
16 sudo apt-get install \ | 27 PACKAGES=$(cat<<-EOF |
17 build-essential \ | 28 » » build-essential |
18 » » libfreetype6-dev \ | 29 » » libfreetype6-dev |
19 » » libfontconfig-dev \ | 30 » » libfontconfig-dev |
20 » » libpng12-dev \ | 31 » » libpng12-dev |
21 » » libgif-dev \ | 32 » » libgif-dev |
22 » » libqt4-dev \ | 33 » » libqt4-dev |
23 » » clang | 34 » » EOF |
24 » if [ $(lsb_release -r -s) = '14.04' ] ; then | 35 ) |
25 » » sudo apt-get install \ | 36 if [ $(lsb_release -r -s) = '14.04' ] ; then |
26 » » ninja-build | 37 PACKAGES="${PACKAGES} ninja-build" |
27 » fi | 38 fi |
| 39 if ! dpkg_all_installed $PACKAGES; then |
| 40 sudo apt-get install $PACKAGES |
| 41 fi |
28 exit | 42 exit |
29 ;; | 43 ;; |
30 esac | 44 esac |
31 fi | 45 fi |
32 | 46 |
33 echo 'unknown system' | 47 echo 'unknown system' |
34 exit 1 | 48 exit 1 |
35 | 49 |
OLD | NEW |