-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.sh
executable file
·101 lines (87 loc) · 2.4 KB
/
check.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
#!/bin/bash
kol_czerw="\e[1;31m"
kol_zielo="\e[1;33m"
kol_reset="\e[0m"
function OKEJ {
echo -e "${kol_zielo}OK ${kol_reset}"
}
function SPRAWDZ_LIB {
if [ -z "$1" ]; then
echo "check.sh Internal Error: You have to add library name as argumetn"
exit 1;
fi
echo -ne "Checking $1 ... \t"
pkg-config --exists $1
if [ $? -ne 0 ]; then
echo -e "${kol_czerw}$1 is not installed correctly${kol_reset}"
exit 1
else
OKEJ
fi
#Gdy drugi argument nie jest Zerem (pustym ci±giem)
if [ ! -z "$2" ]; then
echo -ne "Checking if $1 is in version >= $2 ... \t"
pkg-config $1 --atleast-version=$2
if [ $? -ne 0 ]; then
echo -e "${kol_czerw}$1 is not in version >= $2 ${kol_reset}"
CURRENT_VERSION=`pkg-config --modversion $1`
echo "Currently installed version of $1, is $CURRENT_VERSION"
exit 1
else
OKEJ
fi
fi
}
function CHECK_LIB_RAW {
echo -ne "Checking $1 ... \t"
if [ -z "$1" ]; then
echo "check.sh interanl error You have to specify libaray name"
exit 1;
fi
TMPFILE=`mktemp -q /tmp/$0.XXXXXX`
if [ $? -ne 0 ]; then
echo "$0: Can't create temp file, exiting..."
echo TMPFILE = $TMPFILE
exit 1
fi
NEWTMP=${TMPFILE}.c
mv "${TMPFILE}" "${NEWTMP}"
echo "int main(int argc, char **argv) {return 0;}" >> ${NEWTMP}
cc -l$1 $NEWTMP -o /dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo -e "${kol_czerw}$1 is not installed correctly${kol_reset}"
rm ${NEWTMP} 2>/dev/null
exit 1
else
rm ${NEWTMP} 2>/dev/null
OKEJ
fi
}
echo -ne "Checking C++ complier... \t"
g++ --version > /dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo "You dont have C++ compiler"
exit 1
else OKEJ
fi
echo -ne "Checking pkg-config... \t"
# sprawdzmy czy jest pkg-config, to co wypluwa jest niepotrzebne wiêc dajemy
# na /dev/null
pkg-config --version > /dev/null 2>/dev/null
#sprawdzwmy exit-code z poprzedniego polecenia
if [ $? -ne 0 ]; then
echo -e "${kol_czerw}You have to install pkg-config ${kol_reset}"
exit 1
else OKEJ
fi
#==============================================================================
# Tutaj mo¿na zapodaæ potrzebne biblioteki
# podanie jednego argumentu sprawdza tylko czy dana biblioteka istnieje,
# podanie drugiego sprawdza czy ta biblioteka jest >= wersji
#==============================================================================
SPRAWDZ_LIB gtkmm-2.4
SPRAWDZ_LIB gtkspell-2.0
CHECK_LIB_RAW gettextpo
CHECK_LIB_RAW aspell
echo -e "\nIt seems that you have all stuff needed to compile"
echo "Type make, to compile program"