-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·156 lines (143 loc) · 3.67 KB
/
install.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/bin/bash -e
shopt -s nocasematch
set -e
cat<<EOF
Where do you want to install MINT? (Default: /usr/local)
Include files will be under 'include/', library files under 'lib/'.
EOF
while true; do
read -e -i "/usr/local" INSTALL
if [ -d $INSTALL ]; then
echo -e "*** Installing in $INSTALL.\n"
break
else
cat<<EOF
That directory does not exist.
Do you want to create it (c) or to enter a new one (e)?
EOF
read -s -n 1 ANS
if [[ $ANS == "c" ]]; then
mkdir -p $INSTALL
if [[ ! $? ]]; then
echo "* Cannot create directory. Try again."
else
echo "* Directory created"
break
fi
else
echo "Enter new directory name:"
fi
fi
done
# check for necessary SDL libraries; use images only if all are found
SDL[0]=$(/sbin/ldconfig -NXv | grep 'libSDL\.so' | wc -l)
SDL[1]=$(/sbin/ldconfig -NXv | grep 'libSDL_image.so' | wc -l)
SDL[2]=$(/sbin/ldconfig -NXv | grep 'libSDL_ttf.so' | wc -l)
SDL[3]=$(/sbin/ldconfig -NXv | grep 'libSDL_gfx.so' | wc -l)
SDLNAMES=("SDL" "SDL_image" "SDL_ttf" "SDL_gfx")
NOYES=("NO" "YES")
for i in $(seq 0 3); do
if [ ${SDL[$i]} -le 0 ]; then
echo -e "* Missing library:" ${SDLNAMES[$i]}
echo "* Disabling support for images and graphical interface"
export image=0
break
else
export image=1
fi
done
if [ $image -eq 1 ]; then
echo "* Image and graphics support ENABLED"
fi
if [[ -e /usr/local/lib/libpigpio.a || -e /usr/lib/libpigpio.a ]]; then
export pi=1
echo "* Raspberry Pi GPIO support ENABLED"
else
export pi=0
echo "* PiGPIO library not found"
echo "* Including DUMMY version of Raspberry Pi functions"
echo "* (Code should compile, but using GPIOs won't do anything)"
fi
echo
cat<<EOF
Q: Do you want to enable camera support? [y/n]
EOF
read -s -n 1 ANS
if [[ $ANS == "y" ]]; then
export camera=1
echo -e "* Camera enabled.\n"
CAMSHOT=$(which camshot | wc -l)
if [ $CAMSHOT -le 0 ]; then
echo "* Camshot program not found, compiling"
echo " (Will be installed later)"
./yruba camshot
fi
else
echo "* Camera disabled"
fi
cat<<EOF
Q: Do you want to enable multithreading? [y/n]
EOF
read -s -n 1 ANS
if [[ $ANS == "y" ]]; then
export threads=1
echo -e "* Multithreading enabled.\n"
else
export threads=0
echo -e "* Multithreading disabled.\n"
fi
cat<<EOF
Q: Do you want to install a debugging version of MINT? [y/n]
EOF
read -s -n 1 ANS
if [[ $ANS == "y" ]]; then
DEBUG=1
echo -e "* Debugging version libmint-debug.a enabled.\n"
else
DEBUG=0
echo -e "* Debugging version disabled.\n"
fi
cat<<EOF
Q: Do you want to install a profiling version of MINT? [y/n]
EOF
read -s -n 1 ANS
if [[ $ANS == "y" ]]; then
PROFILE=1
echo -e "* Profiling version libmint-profile.a enabled.\n"
else
PROFILE=0
echo -e "* Profiling version disabled.\n"
fi
echo -e "* Building libmint.a ***\n"
pi=$pi camera=$camera threads=$threads image=$image ./yruba mint
if [[ $? ]]; then
echo "* Build successful ***"
install=$INSTALL ./yruba install || exit
else
echo "* Build failed ***"
exit
fi
if [[ $DEBUG -eq 1 ]]; then
echo -e "* Building debugging version of MINT ***\n"
camera=$camera threads=$threads image=$image debug=1 ./yruba mint
if [[ $? ]]; then
echo "* Build successful ***"
install=$INSTALL ./yruba install || exit
else
echo "* Build failed ***"
exit
fi
fi
if [[ $PROFILE -eq 1 ]]; then
echo -e "* Building profiling version of MINT ***\n"
camera=$camera threads=$threads image=$image profile=1 ./yruba mint
if [[ $? ]]; then
echo "* Build successful ***"
install=$INSTALL ./yruba install || exit
else
echo "* Build failed ***"
exit
fi
fi
#echo "* Building documentation under doc/"
#./yruba doc