-
Notifications
You must be signed in to change notification settings - Fork 0
/
redo-everything-from-scratch
executable file
·207 lines (189 loc) · 3.82 KB
/
redo-everything-from-scratch
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#! /bin/bash
RED="\033[1;31m"
BLUE="\033[1;34m"
NORMAL="\033[0m"
OK="\033[1;32m OK \033[0m"
FAIL="\033[1;31m FAILED \033[0m"
restart=$1
compiler=$2
branch=$3
if [ "$compiler" == "" ]
then
compiler=g++
else
if [ "$compiler" != "g++" ] \
&& [ "$compiler" != "clang++" ] \
&& [ "$compiler" != "clang++-14" ] \
&& [ "$compiler" != "clang++-15" ]
then
echo "compiler must be c++ or clang++[-14|15]"
exit
fi
fi
echo -n "Rebuilding ALL with $compiler "
if [ "$branch" != "" ];
then
echo "in branch $branch"
else
echo "in the current branches"
fi
host=`hostname`
if [ "$host" == "bonus" ] || [ "$host" == "kokos" ]
then
prefix="/home/sloot/usr/local/"
else
wd=`pwd`
prefix="${wd}/../usr/local/"
fi
# directories to handle
dirs="scripts ticcutils timbl timblserver timbltests mbt mbtserver mbttests dimbl libfolia FoLiApy foliatest uctodata ucto frogdata frog frogtests foliautils ticcltools toad wopr"
# optional directories
optdirs='colibri-core colibri-utils'
# executables to test (using -V only)
exes='timbl timblserver mbt mbtserver dimbl ucto frog folialint FoLiA-stats FoLiA-alto FoLiA-hocr TICCL-lexclean TICCL-indexerNT wopr'
partdirs=()
if [ "$restart" != "" ]
then
for app in $dirs
do
echo "app=$app restart=$restart"
if [ $app = $restart ]
then
partdirs+="$app "
restart="seenitall"
else
if [ $restart = "seenitall" ]
then
partdirs+="$app "
fi
fi
done
fi
if [ "$partdirs" != "" ];
then
dirs=$partdirs
fi
echo "building for $dirs"
#sanity check for REQUIRED directories
for app in $dirs
do
if ! test -d $app
then
echo "$app dir not found. Could become troublesome"
exit
fi
done
count=0;
for app in $optdirs
do
if ! test -d $app
then
echo "$app dir not found. skipping."
else
dirs="$dirs $app"
fi
done
# configure and make all
for app in $dirs
do
if test -d $app
then
name=$app
name=${name/\//_}
rm -f ../$name.log
pushd $app > ../$name.log 2>&1
echo -en "$app: updating"
if [ "$branch" != "" ];
then
git checkout --quiet $branch > /dev/null 2>&1
if [ $? -ne 0 ];
then
# branch bestaat niet, blijf waar je bent
echo -en " [$RED NO $branch, sticking to: `git rev-parse --abbrev-ref HEAD`$NORMAL]"
else
echo -en " [$BLUE$branch$NORMAL]"
fi
else
echo -ne " [$BLUE`git rev-parse --abbrev-ref HEAD`$NORMAL]"
fi
git pull --recurse-submodules >> ../$name.log 2>&1
if [ $? -ne 0 ];
then
echo -e $FAIL
popd
echo "see $name.log"
exit
fi
if test -e Makefile.am
then
make maintainer-clean >> ../$name.log 2>&1
rm -f config.{guess,sub}
if test -e bootstrap.sh
then
sh ./bootstrap.sh >> ../$name.log 2>&1
else
sh ./bootstrap >> ../$name.log 2>&1
fi
if [ $? -ne 0 ];
then
echo -e $FAIL
popd
echo "see $name.log"
exit
fi
echo -n ", configuring"
CXX=$compiler CXXFLAGS="-pedantic -W -Wall -O3 " ./configure --prefix=$prefix >> ../$name.log 2>&1
if [ $? -ne 0 ];
then
echo -e $FAIL
popd
echo "see $name.log"
exit
fi
echo -n ", making"
make install >> ../$name.log 2>&1
if [ $? -ne 0 ];
then
echo -e $FAIL
popd
echo "see $name.log"
exit
fi
echo -n ", checking"
make check >> ../$name.log 2>&1
if [ $? -ne 0 ];
then
echo -e $FAIL
popd
echo "see $name.log"
exit
else
echo -e $OK
fi
else
echo -e $OK
fi
popd >> ../$name.log 2>&1
else
echo "$app dir not found. Could become troublesome"
exit 1
fi
done
# poor mans test
for app in $exes
do
if test -x $prefix/bin/$app
then
$prefix/bin/$app -V > $name-test.log 2>&1
if [ $? -ne 0 ];
then
echo -e $FAIL
echo "see $name-test.log"
else
echo -n "testing $app: "
echo -e $OK
fi
else
echo "couldn't find $app executable"
fi
done