xref: /aosp_15_r20/external/skia/tools/install_dependencies.sh (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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		libgl1-mesa-dev
36		libglu1-mesa-dev
37		libharfbuzz-dev
38		libicu-dev
39		libjpeg-dev
40		libpng-dev
41		libwebp-dev
42        libx11-xcb-dev
43        libxcb-xkb-dev
44        xcb
45		EOF
46            )
47           if [ $(lsb_release -r -s) = '14.04' ] ; then
48               PACKAGES="${PACKAGES} ninja-build"
49           fi
50           if ! dpkg_all_installed $PACKAGES; then
51               sudo apt-get $1 install $PACKAGES
52           fi
53           exit
54           ;;
55    esac
56fi
57
58echo 'unknown system'
59exit 1
60