-
Notifications
You must be signed in to change notification settings - Fork 16
/
system.sh
executable file
·136 lines (120 loc) · 2.58 KB
/
system.sh
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
##
## Check required software for Mac OS X
##
FU_system_require_darwin() {
# required software for Mac
local requires=(
"gettext"
"gawk"
"grep"
"gnu-sed"
"curl"
"pkg-config"
"libtool"
"intltool"
"glib"
"intltool"
"autogen"
"autoconf"
"automake"
"cmake"
)
# Check for Homebrew package manager
echo -n "Checking for 'brew'... "
if ! hash "brew" 2>/dev/null; then
echo "faild"
echo
echo " To execute this script on Mac OS X you have to install Homebrew."
echo " You can download Homebrew from: http://brew.sh"
echo
exit 1
fi
# Serach if the required packages are installed. This packages are all auto
# linked. If a packet is not found it will be installed automatically.
for require in "${requires[@]}"
do
echo -n "Checking for '$require'... "
if [ $(brew list | grep -c $require) = 0 ]; then
echo
brew install $require
else
echo "yes"
fi
done
# link gettext force
if ! hash gettext 2>/dev/null; then
brew link gettext --force
fi
}
##
## Check required software for Linux
##
FU_system_require_linux() {
local missing_requires=()
# required software for Linux
local requires=(
"gettext"
"gawk"
"grep"
"sed"
"curl"
"pkg-config"
"libtool"
"intltool"
"glib"
"intltool"
"autogen"
"autoconf"
"automake"
"cmake"
"libxml2-dev"
"xsltproc"
)
# Serach if the required packages are installed.
# If a packet is not found it will not be installed automatically becuase
# we need root access for that.
for require in "${requires[@]}"
do
echo -n "Checking for '$require'... "
if [ $(dpkg --list | grep -c $require) = 0 ]; then
echo "no"
missing_requires+=($require)
else
echo "yes"
fi
done
# Display the missing packages
if [ ${#missing_requires[@]} -gt 0 ]; then
echo
echo "*** Some required packages were not found! ***"
echo "Pleas install the required packages by running the following command and run the script again:"
echo
echo " sudo apt-get install ${missing_requires[*]}"
echo
exit 1
fi
}
##
## Check cross compiler and required software
##
FU_system_require() {
# Check if cross compiler is avalible
echo -n "Checking for '${UV_target}-gcc'... "
if ! [ -f "${UV_toolchain_dir}/bin/${UV_target}-gcc" ]; then
echo "faild"
echo
echo "*** Error cross compiler not found! ***"
echo "*** Please check your configuration file. ***"
echo
exit 1
else
echo "yes"
fi
# search for required packages
if [ $GV_build_os = "Linux" ]; then
FU_system_require_linux
elif [ $GV_build_os = "Darwin" ]; then
FU_system_require_darwin
fi
}