3 # Stop script if unbound variable found (use ${var:-} if intentional)
6 # Stop script if command returns non-zero exit code.
7 # Prevents hidden errors caused by missing error code propagation.
12 echo "Common settings:"
13 echo " --configuration <value> Build configuration: 'Debug' or 'Release' (short: -c)"
14 echo " --help Print help and exit (short: -h)"
18 echo " --pack Package build outputs into NuGet packages"
19 echo " --test Run all unit tests in the solution (short: -t)"
20 echo " --rebuild Run ../.autogen.sh"
21 echo " --llvm Enable LLVM support"
22 echo " --skipnative Do not build runtime"
23 echo " --skipmscorlib Do not build System.Private.CoreLib"
26 echo "Command line arguments starting with '/p:' are passed through to MSBuild."
27 echo "Arguments can also be passed in with a single hyphen."
40 while [[ $# > 0 ]]; do
41 opt
="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
48 properties
="$properties $1 $2"
71 properties
="$properties $1"
74 properties
="$properties $1"
77 properties
="$properties $1"
80 properties
="$properties $1"
83 echo "Invalid argument: $1"
92 CPU_COUNT
=$
(getconf _NPROCESSORS_ONLN ||
echo 4)
94 if [[ "$configuration" == "Debug" ]]; then
95 EXTRA_CFLAGS
="-O0 -ggdb3 -fno-omit-frame-pointer"
96 EXTRA_CXXFLAGS
="-O0 -ggdb3 -fno-omit-frame-pointer"
97 elif [[ "$configuration" == "Release" ]]; then
99 EXTRA_CXXFLAGS
="-O2 -g"
102 if [ "$llvm" = "true" ]; then
103 git submodule update
--init -- ..
/external
/llvm
104 autogen_params
="$autogen_params --enable-llvm"
107 # run .././autogen.sh only once or if "--rebuild" argument is provided
108 if [[ "$force_rebuild" == "true" ||
! -f .configured
]]; then
109 (cd ..
&& .
/autogen.sh
--with-core=only
$autogen_params CFLAGS
="$EXTRA_CFLAGS" CXXFLAGS
="$EXTRA_CXXFLAGS")
114 if [ "$skipnative" = "false" ]; then
115 make runtime
-j$CPU_COUNT
118 # build System.Private.CoreLib (../mcs/class/System.Private.CoreLib)
119 if [ "$skipmscorlib" = "false" ]; then
120 make bcl CORLIB_BUILD_FLAGS
="$properties"
123 # create a nupkg with runtime and System.Private.CoreLib
124 if [ "$pack" = "true" ]; then
128 # run all xunit tests
129 if [ "$test" = "true" ]; then
130 make update-tests-corefx
131 for testdir
in corefx
/tests
/extracted
/*; do
132 ..
/scripts
/ci
/.
/run-step.sh
--label=$
(basename $testdir) --timeout=15m
make run-tests-corefx-$
(basename $testdir)