-
Notifications
You must be signed in to change notification settings - Fork 11
/
check_build_structure.sh
executable file
·64 lines (47 loc) · 1.3 KB
/
check_build_structure.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
#!/bin/sh
#
# Script to generate a snapshot package and then use that to test if
# various Makefile targets work as expected.
set -e
GITURL="https://github.com/DOMjudge/domjudge.git"
#DEBUG=1
[ "$DEBUG" ] && set -x
quiet()
{
if [ "$DEBUG" ]; then
"$@"
else
"$@" > /dev/null 2>&1
fi
}
TEMPDIR=$(mktemp -d /tmp/domjudge-check_build-XXXXXX)
cd "$TEMPDIR"
git clone -q --no-checkout --depth 1 "$GITURL" dj-clone
( cd dj-clone && git archive --prefix=domjudge/ --format=tar refs/heads/main ) | tar x
# Add released tag for revision information:
sed -i "s/PUBLISHED =.*/PUBLISHED = $(date +%Y-%m-%d)/" domjudge/paths.mk.in
quiet make -C domjudge dist
# Remove date output from generated file tags to make diffs cleaner:
# shellcheck disable=SC2016
sed -i 's/ on `date`//' domjudge/paths.mk.in
cp -a domjudge configured
( cd configured && ./configure )
# Test if all the "build-like" targets work independently:
for i in all build domserver judgehost docs ; do
cp -a configured $i
( cd $i && make $i )
done
# Test cleanup targets:
for i in clean distclean ; do
cp -a all $i
( cd $i && make $i )
done
# Check that ./configure && make all && make distclean returns
# to original state:
diff -r -u2 domjudge distclean
if [ "$DEBUG" ]; then
echo "Generated files left in $TEMPDIR"
else
rm -rf "$TEMPDIR"
fi
exit 0