-
Notifications
You must be signed in to change notification settings - Fork 0
/
redo-folia-from-scratch
executable file
·153 lines (141 loc) · 2.77 KB
/
redo-folia-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
#! /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"
branch=$1
compiler=$2
if [ "$compiler" == "" ];
then
compiler=g++
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
dirs='scripts ticcutils libfolia FoLiApy foliatest uctodata ucto frogdata frog frogtests foliautils'
exes='ucto frog FoLiA-stats FoLiA-alto FoLiA-hocr'
#sanity check
for app in $dirs
do
if ! test -d $app
then
echo "$app dir not found. Could become troublesome"
exit
fi
done
# configure and make all
for app in $dirs
do
if test -d $app
then
name=$app
name=${name/\//_}
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