-
Notifications
You must be signed in to change notification settings - Fork 1
/
entrypoint.sh
executable file
·110 lines (96 loc) · 2.2 KB
/
entrypoint.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
#!/bin/sh
set -e
echo Build script running.
export CI=true
JOBS=$(if X=$(nproc 2>&1); then echo $X; else echo 1; fi)
export MAKEFLAGS="-j$JOBS"
case "$INPUT_COMMAND" in
setup)
case "$INPUT_C" in
gcc)
CC=gcc
CXX=g++
;;
clang)
CC=clang
CXX=clang++
;;
*)
echo "Unknown C compiler $INPUT_C"
exit 1
;;
esac
BUILD_TYPE=$INPUT_BUILDTYPE
case "$INPUT_BUILDTYPE" in
dev)
C_CXX_FLAGS='$(C_CXX_FLAGS_BASE) -O1 -DDEBUG -DPZ_DEV'
MCFLAGS="-O1"
;;
rel)
C_CXX_FLAGS='$(C_CXX_FLAGS_BASE) -O3'
MCFLAGS="-O4 --intermodule-optimisation"
;;
*)
echo "Unknown build type $INPUT_BUILDTYPE"
;;
esac
case "$INPUT_LINT" in
lint)
C_CXX_FLAGS="$C_CXX_FLAGS -Wall -Werror"
# TODO: Add -Werror for Mercury after we upgrade to stable.
;;
esac
echo C compiler
echo ----------
$CC --version
echo C_CXX_FLAGS is $C_CXX_FLAGS
echo
echo Mercury compiler
echo ----------------
mmc --version
echo MCFLAGS is $MCFLAGS
echo
echo Other
echo -----
echo JOBS is $JOBS
echo MAKEFLAGS is $MAKEFLAGS
echo
cat > build.mk << END
JOBS=$JOBS
CC=$CC
CXX=$CXX
C_CXX_FLAGS=$C_CXX_FLAGS
MCFLAGS=$MCFLAGS
BUILD_TYPE=$BUILD_TYPE
END
echo build.mk:
cat build.mk
echo
cat > build.sh << END
export BUILD_TYPE=$BUILD_TYPE
END
chmod a+x build.sh
;;
build)
exec make progs
;;
test)
# New tests
. ./build.sh
./tests/run-tests.lua examples tests
# Old tests
cd tests-old
exec ./run_tests.sh $BUILD_TYPE
;;
gctest)
cd tests-old
exec ./run_tests.sh gc
;;
extra)
exec make tags
;;
*)
echo "Unknown command"
exit 1
;;
esac