-
Notifications
You must be signed in to change notification settings - Fork 0
/
trycompile
executable file
·79 lines (71 loc) · 2.13 KB
/
trycompile
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
#!/bin/bash
echo "trycompile 0.1"
echo ""
echo "This script tries to compile Haggle with different configurations to see"
echo "to it that Haggle does compile. Each test will take a while. Please be"
echo "patient."
echo ""
echo "WARNING: THIS TEST WILL DELETE MANY FILES IN THE HAGGLE DIRECTORY, AND"
echo "YOU WILL NEED TO RECONFIGURE HAGGLE AFTER RUNNING THIS SCRIPT."
echo ""
echo "DO YOU STILL WISH TO PROCEED? [y/n]"
func_askpermission()
{
read -s -n 1 answer
if [ $answer = "y" -o $answer = "yes" ] ; then
echo "Starting test...";
elif [ $answer = "n" -o $answer = "no" ] ; then
echo "Exiting..."
exit 0
else
echo "Please answer \"y\" for yes or \"n\" for no"
func_askpermission
fi
}
func_askpermission
# This code does not pipe unwanted outut to /dev/null because that didn't seem
# to work. Piping it to a grep that finds all empty lines, and then to one that
# finds the nonempty lines does seem to work.
# Remove all files generated by making:
func_realclean()
{
# This executes the actual code inside the "realclean" make target, but
# doesn't call "make realclean", since this function may be called when
# there is no makefile.
svn status --no-ignore | grep "I " | awk '{print $2}' | xargs rm -rf 2>&1 | grep "^$" | grep -v "^$"
}
# Try to compile with a given set of parameters:
func_trycompile()
{
echo -n "Attempting to compile with parameters \""$@"\""
echo -n "."
autoreconf --install 2>&1 | grep "^$" | grep -v "^$"
if [ -e configure ] ; then
echo -n "."
./configure $@ 2>&1 | grep "^$" | grep -v "^$"
if [ -e Makefile ] ; then
echo -n "."
make 2>&1 | grep "^$" | grep -v "^$"
if [ -e ./bin/haggle ] ; then
echo " Passed!"
else
echo " FAILED! (make)"
fi
else
echo " FAILED! (configure)"
fi
else
echo " FAILED! (autoreconf)"
fi
func_realclean
}
# Clean up first, so we don't get a wrong result because of old files:
func_realclean
# Perform tests:
func_trycompile
func_trycompile --enable-debug
func_trycompile --enable-debug-leaks
func_trycompile --enable-debug --enable-debug-leaks
func_trycompile --disable-ethernet
func_trycompile --disable-bluetooth
func_trycompile --disable-media