forked from Netflix/vmaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-environment
executable file
·45 lines (39 loc) · 1.31 KB
/
check-environment
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
#!/bin/bash
_PLATFORM=`uname`
_MISSING=''
function check_installed {
local _name=$1
local _command=$2
local _brew_name=$3
local _apt_name=$4
command -v $_command > /dev/null && return 0
local _message="$_name is not installed"
if [ $_PLATFORM == "Darwin" ]; then
_message="$_message, try: 'brew install $_brew_name'"
_MISSING="$_MISSING $_brew_name"
else
_message="$_message, try: 'sudo apt-get install -y $_apt_name'"
_MISSING="$_MISSING $_apt_name"
fi
echo $_message
}
# Name Command Brew package name apt package name
check_installed gfortran gfortran gcc gfortran
check_installed freetype freetype-config freetype libfreetype6-dev
check_installed pkg-config pkg-config pkg-config pkg-config
check_installed hdf5 h5cc homebrew/science/hdf5 libhdf5-dev
if [ -n "$_MISSING" ]; then
echo
echo "You don't have all prerequisites installed, can't build"
echo "You can install them all at once by running this command:"
echo
if [ $_PLATFORM == "Darwin" ]; then
echo "brew install$_MISSING"
else
echo "sudo apt-get install -y$_MISSING"
fi
echo
exit 1
else
echo "All prerequisites met"
fi