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."
39 while [[ $# > 0 ]]; do
40 opt
="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
47 properties
="$properties $1 $2"
67 autogen_params
="$autogen_params --enable-llvm"
70 properties
="$properties $1"
73 properties
="$properties $1"
76 properties
="$properties $1"
79 properties
="$properties $1"
82 echo "Invalid argument: $1"
91 CPU_COUNT
=$
(getconf _NPROCESSORS_ONLN ||
echo 4)
93 if [[ "$configuration" == "Debug" ]]; then
94 EXTRA_CFLAGS
="-O0 -ggdb3 -fno-omit-frame-pointer"
95 EXTRA_CXXFLAGS
="-O0 -ggdb3 -fno-omit-frame-pointer"
96 elif [[ "$configuration" == "Release" ]]; then
98 EXTRA_CXXFLAGS
="-O2 -g"
101 # run .././autogen.sh only once or if "--rebuild" argument is provided
102 if [[ "$force_rebuild" == "true" ||
! -f .configured
]]; then
103 (cd ..
&& .
/autogen.sh
--with-core=only
$autogen_params CFLAGS
="$EXTRA_CFLAGS" CXXFLAGS
="$EXTRA_CXXFLAGS")
108 if [ "$skipnative" = "false" ]; then
109 make runtime
-j$CPU_COUNT
112 # build System.Private.CoreLib (../mcs/class/System.Private.CoreLib)
113 if [ "$skipmscorlib" = "false" ]; then
114 make bcl CORLIB_BUILD_FLAGS
="$properties"
117 # create a nupkg with runtime and System.Private.CoreLib
118 if [ "$pack" = "true" ]; then
122 # run all xunit tests
123 if [ "$test" = "true" ]; then
124 make update-tests-corefx
125 for testdir
in corefx
/tests
/extracted
/*; do
126 ..
/scripts
/ci
/.
/run-step.sh
--label=$
(basename $testdir) --timeout=15m
make run-tests-corefx-$
(basename $testdir)