Home | History | Annotate | Download | only in tools
      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 set -e
     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 
     24 if command -v lsb_release > /dev/null ; then
     25     case $(lsb_release -i -s) in
     26         Ubuntu)
     27             PACKAGES=$(cat<<-EOF
     28 		build-essential
     29 		libfreetype6-dev
     30 		libfontconfig-dev
     31 		libpng12-dev
     32 		libgif-dev
     33 		libqt4-dev
     34 		EOF
     35             )
     36            if [ $(lsb_release -r -s) = '14.04' ] ; then
     37                PACKAGES="${PACKAGES} ninja-build"
     38             fi
     39             if ! dpkg_all_installed $PACKAGES; then
     40                 sudo apt-get install $PACKAGES
     41             fi
     42             exit
     43             ;;
     44     esac
     45 fi
     46 
     47 echo 'unknown system'
     48 exit 1
     49 
     50