3 # resolve python-version to use
4 if [ "$PYTHON" == "" ] ; then
5 if ! PYTHON=$(command -v python || command -v python2 || command -v python 2.7)
7 echo "Unable to locate build-dependency python2.x!" 1>&2
12 # validate python-dependency
13 # useful in case of explicitly set option.
14 if ! command -v $PYTHON > /dev/null
16 echo "Unable to locate build-dependency python2.x ($PYTHON)!" 1>&2
22 echo "Usage: $0 [BuildArch] [BuildType] [verbose] [coverage] [cross] [clangx.y] [ninja] [configureonly] [skipconfigure] [skipnative] [skipmscorlib] [skiptests] [stripsymbols] [ignorewarnings] [cmakeargs] [bindir]"
23 echo "BuildArch can be: x64, x86, arm, armel, arm64"
24 echo "BuildType can be: debug, checked, release"
25 echo "coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)."
26 echo "ninja - target ninja instead of GNU make"
27 echo "clangx.y - optional argument to build using clang version x.y."
28 echo "cross - optional argument to signify cross compilation,"
29 echo " - will use ROOTFS_DIR environment variable if set."
30 echo "crosscomponent - optional argument to build cross-architecture component,"
31 echo " - will use CAC_ROOTFS_DIR environment variable if set."
32 echo "nopgooptimize - do not use profile guided optimizations."
33 echo "pgoinstrument - generate instrumented code for profile guided optimization enabled binaries."
34 echo "ibcinstrument - generate IBC-tuning-enabled native images when invoking crossgen."
35 echo "configureonly - do not perform any builds; just configure the build."
36 echo "skipconfigure - skip build configuration."
37 echo "skipnative - do not build native components."
38 echo "skipmscorlib - do not build mscorlib.dll."
39 echo "skiptests - skip the tests in the 'tests' subdirectory."
40 echo "skipnuget - skip building nuget packages."
41 echo "skiprestoreoptdata - skip restoring optimization data used by profile-based optimizations."
42 echo "skipcrossgen - skip native image generation"
43 echo "verbose - optional argument to enable verbose build output."
44 echo "-skiprestore: skip restoring packages ^(default: packages are restored during build^)."
45 echo "-disableoss: Disable Open Source Signing for System.Private.CoreLib."
46 echo "-sequential: force a non-parallel build ^(default is to build in parallel"
47 echo " using all processors^)."
48 echo "-officialbuildid=^<ID^>: specify the official build ID to be used by this build."
49 echo "-Rebuild: passes /t:rebuild to the build projects."
50 echo "stripSymbols - Optional argument to strip native symbols during the build."
51 echo "skipgenerateversion - disable version generation even if MSBuild is supported."
52 echo "ignorewarnings - do not treat warnings as errors"
53 echo "cmakeargs - user-settable additional arguments passed to CMake."
54 echo "bindir - output directory (defaults to $__ProjectRoot/bin)"
55 echo "buildstandalonegc - builds the GC in a standalone mode. Can't be used with \"cmakeargs\"."
56 echo "msbuildonunsupportedplatform - build managed binaries even if distro is not officially supported."
57 echo "numproc - set the number of build processes."
63 if [ "$__HostOS" == "Linux" ]; then
64 if [ ! -e /etc/os-release ]; then
65 echo "WARNING: Can not determine runtime id for current distro."
68 source /etc/os-release
69 __HostDistroRid="$ID.$VERSION_ID-$__HostArch"
76 if [ $__CrossBuild == 1 ]; then
77 if [ "$__BuildOS" == "Linux" ]; then
78 if [ ! -e $ROOTFS_DIR/etc/os-release ]; then
79 if [ -e $ROOTFS_DIR/android_platform ]; then
80 source $ROOTFS_DIR/android_platform
81 export __DistroRid="$RID"
83 echo "WARNING: Can not determine runtime id for current distro."
87 source $ROOTFS_DIR/etc/os-release
88 export __DistroRid="$ID.$VERSION_ID-$__BuildArch"
92 export __DistroRid="$__HostDistroRid"
95 # Portable builds target the base RID
96 if [ $__PortableBuild == 1 ]; then
97 if [ "$__BuildOS" == "Linux" ]; then
98 export __DistroRid="linux-$__BuildArch"
99 elif [ "$__BuildOS" == "OSX" ]; then
100 export __DistroRid="osx-$__BuildArch"
107 echo Setting up directories for build
109 mkdir -p "$__RootBinDir"
111 mkdir -p "$__LogsDir"
112 mkdir -p "$__IntermediatesDir"
114 if [ $__CrossBuild == 1 ]; then
115 mkdir -p "$__CrossComponentBinDir"
116 mkdir -p "$__CrossCompIntermediatesDir"
120 # Check the system to ensure the right prereqs are in place
124 echo "Checking prerequisites..."
126 # Check presence of CMake on the path
127 hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
130 # Minimum required version of clang is version 3.9 for arm/armel cross build
131 if [[ $__CrossBuild == 1 && ("$__BuildArch" == "arm" || "$__BuildArch" == "armel") ]]; then
132 if ! [[ "$__ClangMajorVersion" -gt "3" || ( $__ClangMajorVersion == 3 && $__ClangMinorVersion == 9 ) ]]; then
133 echo "Please install clang3.9 or latest for arm/armel cross build"; exit 1;
138 hash clang-$__ClangMajorVersion.$__ClangMinorVersion 2>/dev/null || hash clang$__ClangMajorVersion$__ClangMinorVersion 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang-$__ClangMajorVersion.$__ClangMinorVersion before running this script"; exit 1; }
144 # we only need optdata on a Release build
145 if [[ "$__BuildType" != "Release" ]]; then __SkipRestoreOptData=1; fi
147 if [[ ( $__SkipRestoreOptData == 0 ) && ( $__isMSBuildOnNETCoreSupported == 1 ) ]]; then
148 echo "Restoring the OptimizationData package"
149 "$__ProjectRoot/run.sh" sync -optdata
151 echo "Failed to restore the optimization data package."
156 if [ $__isMSBuildOnNETCoreSupported == 1 ]; then
157 # Parse the optdata package versions out of msbuild so that we can pass them on to CMake
158 local DotNetCli="$__ProjectRoot/Tools/dotnetcli/dotnet"
159 if [ ! -f $DotNetCli ]; then
160 "$__ProjectRoot/init-tools.sh"
162 echo "Failed to restore buildtools."
166 local OptDataProjectFilePath="$__ProjectRoot/src/.nuget/optdata/optdata.csproj"
167 __PgoOptDataVersion=$(DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 $DotNetCli msbuild $OptDataProjectFilePath /t:DumpPgoDataPackageVersion /nologo | sed 's/^\s*//')
168 __IbcOptDataVersion=$(DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 $DotNetCli msbuild $OptDataProjectFilePath /t:DumpIbcDataPackageVersion /nologo | sed 's/^\s*//')
172 generate_event_logging_sources()
174 if [ $__SkipCoreCLR == 1 ]; then
178 # Event Logging Infrastructure
179 __GeneratedIntermediate="$__IntermediatesDir/Generated"
180 __GeneratedIntermediateEventProvider="$__GeneratedIntermediate/eventprovider_new"
181 __GeneratedIntermediateEventPipe="$__GeneratedIntermediate/eventpipe_new"
183 if [[ -d "$__GeneratedIntermediateEventProvider" ]]; then
184 rm -rf "$__GeneratedIntermediateEventProvider"
187 if [[ -d "$__GeneratedIntermediateEventPipe" ]]; then
188 rm -rf "$__GeneratedIntermediateEventPipe"
191 if [[ ! -d "$__GeneratedIntermediate/eventprovider" ]]; then
192 mkdir -p "$__GeneratedIntermediate/eventprovider"
195 if [[ ! -d "$__GeneratedIntermediate/eventpipe" ]]; then
196 mkdir -p "$__GeneratedIntermediate/eventpipe"
199 mkdir -p "$__GeneratedIntermediateEventProvider"
200 mkdir -p "$__GeneratedIntermediateEventPipe"
202 __PythonWarningFlags="-Wall"
203 if [[ $__IgnoreWarnings == 0 ]]; then
204 __PythonWarningFlags="$__PythonWarningFlags -Werror"
208 if [[ $__SkipCoreCLR == 0 || $__ConfigureOnly == 1 ]]; then
209 echo "Laying out dynamically generated files consumed by the build system "
210 echo "Laying out dynamically generated Event Logging Test files"
211 $PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genXplatEventing.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst" --testdir "$__GeneratedIntermediateEventProvider/tests"
213 if [[ $? != 0 ]]; then
219 echo "Laying out dynamically generated EventPipe Implementation"
220 $PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genEventPipe.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventPipe" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst"
221 if [[ $? != 0 ]]; then
229 #determine the logging system
232 echo "Laying out dynamically generated Event Logging Implementation of Lttng"
233 $PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genXplatLttng.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventProvider"
234 if [[ $? != 0 ]]; then
243 echo "Cleaning the temp folder of dynamically generated Event Logging files"
244 $PYTHON -B $__PythonWarningFlags -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediate/eventprovider\",\"$__GeneratedIntermediateEventProvider\")"
245 if [[ $? != 0 ]]; then
249 rm -rf "$__GeneratedIntermediateEventProvider"
251 echo "Cleaning the temp folder of dynamically generated EventPipe files"
252 $PYTHON -B $__PythonWarningFlags -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediate/eventpipe\",\"$__GeneratedIntermediateEventPipe\")"
253 if [[ $? != 0 ]]; then
257 rm -rf "$__GeneratedIntermediateEventPipe"
264 intermediatesForBuild="$3"
265 extraCmakeArguments="$4"
268 if [ $skipCondition == 1 ]; then
269 echo "Skipping $message build."
273 # All set to commence the build
274 echo "Commencing build of $message for $__BuildOS.$__BuildArch.$__BuildType in $intermediatesForBuild"
279 if [ $__UseNinja == 1 ]; then
281 buildFile="build.ninja"
282 if ! buildTool=$(command -v ninja || command -v ninja-build); then
283 echo "Unable to locate ninja!" 1>&2
288 if [ $__SkipConfigure == 0 ]; then
289 # if msbuild is not supported, then set __SkipGenerateVersion to 1
290 if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
291 # Drop version.cpp file
292 __versionSourceFile="$intermediatesForBuild/version.cpp"
293 if [ $__SkipGenerateVersion == 0 ]; then
295 "$__ProjectRoot/run.sh" build -Project=$__ProjectDir/build.proj -generateHeaderUnix -NativeVersionSourceFile=$__versionSourceFile $__RunArgs $__UnprocessedBuildArgs
297 # Generate the dummy version.cpp, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
298 __versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
299 if [ -e $__versionSourceFile ]; then
300 read existingVersionSourceLine < $__versionSourceFile
302 if [ "$__versionSourceLine" != "$existingVersionSourceLine" ]; then
303 echo $__versionSourceLine > $__versionSourceFile
308 pushd "$intermediatesForBuild"
309 # Regenerate the CMake solution
310 echo "Invoking \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__ProjectRoot\" $__ClangMajorVersion $__ClangMinorVersion $platformArch $__BuildType $__CodeCoverage $__IncludeTests $generator $extraCmakeArguments $__cmakeargs"
311 "$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh" "$__ProjectRoot" $__ClangMajorVersion $__ClangMinorVersion $platformArch $__BuildType $__CodeCoverage $__IncludeTests $generator "$extraCmakeArguments" "$__cmakeargs"
315 if [ ! -f "$intermediatesForBuild/$buildFile" ]; then
316 echo "Failed to generate $message build project!"
321 if [ $__ConfigureOnly == 1 ]; then
322 echo "Finish configuration & skipping $message build."
326 # Check that the makefiles were created.
327 pushd "$intermediatesForBuild"
329 echo "Executing $buildTool install -j $__NumProc"
331 $buildTool install -j $__NumProc
333 echo "Failed to build $message."
340 build_cross_arch_component()
342 __SkipCrossArchBuild=1
344 # check supported cross-architecture components host(__HostArch)/target(__BuildArch) pair
345 if [[ "$__BuildArch" == "arm" && "$__CrossArch" == "x86" ]]; then
346 export CROSSCOMPILE=0
347 __SkipCrossArchBuild=0
349 # building x64-host/arm-target cross-architecture component need to use cross toolchain of x86
350 if [ "$__HostArch" == "x64" ]; then
351 export CROSSCOMPILE=1
358 export __CMakeBinDir="$__CrossComponentBinDir"
359 export CROSSCOMPONENT=1
362 if [ $CROSSCOMPILE == 1 ]; then
363 TARGET_ROOTFS="$ROOTFS_DIR"
364 if [ -n "$CAC_ROOTFS_DIR" ]; then
365 export ROOTFS_DIR="$CAC_ROOTFS_DIR"
367 export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__CrossArch"
371 __ExtraCmakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__BuildArch -DCLR_CMAKE_TARGET_OS=$__BuildOS -DCLR_CMAKE_PACKAGES_DIR=$__PackagesDir -DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_VERSION=$__PgoOptDataVersion -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize"
372 build_native $__SkipCrossArchBuild "$__CrossArch" "$__CrossCompIntermediatesDir" "$__ExtraCmakeArgs" "cross-architecture component"
374 # restore ROOTFS_DIR, CROSSCOMPONENT, and CROSSCOMPILE
375 if [ -n "$TARGET_ROOTFS" ]; then
376 export ROOTFS_DIR="$TARGET_ROOTFS"
378 export CROSSCOMPONENT=
379 export CROSSCOMPILE=1
382 isMSBuildOnNETCoreSupported()
384 __isMSBuildOnNETCoreSupported=$__msbuildonunsupportedplatform
386 if [ $__isMSBuildOnNETCoreSupported == 1 ]; then
390 if [ "$__HostArch" == "x64" ]; then
391 if [ "$__HostOS" == "Linux" ]; then
392 __isMSBuildOnNETCoreSupported=1
393 UNSUPPORTED_RIDS=("debian.9-x64" "ubuntu.17.04-x64")
394 for UNSUPPORTED_RID in "${UNSUPPORTED_RIDS[@]}"
396 if [ "$__HostDistroRid" == "$UNSUPPORTED_RID" ]; then
397 __isMSBuildOnNETCoreSupported=0
401 elif [ "$__HostOS" == "OSX" ]; then
402 __isMSBuildOnNETCoreSupported=1
410 if [ $__SkipCrossgen == 1 ]; then
411 echo "Skipping generating native image"
415 if [ $__SkipCoreCLR == 0 -a -e $__BinDir/crossgen ]; then
416 echo "Generating native image for System.Private.CoreLib."
417 $__BinDir/crossgen /Platform_Assemblies_Paths $__BinDir/IL $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__BinDir/IL/System.Private.CoreLib.dll
418 if [ $? -ne 0 ]; then
419 echo "Failed to generate native image for System.Private.CoreLib."
423 if [ "$__BuildOS" == "Linux" ]; then
424 echo "Generating symbol file for System.Private.CoreLib."
425 $__BinDir/crossgen /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll
426 if [ $? -ne 0 ]; then
427 echo "Failed to generate symbol file for System.Private.CoreLib."
437 if [ $__isMSBuildOnNETCoreSupported == 0 ]; then
438 echo "System.Private.CoreLib.dll build unsupported."
442 if [ $__SkipMSCorLib == 1 ]; then
443 echo "Skipping building System.Private.CoreLib."
447 echo "Commencing build of managed components for $__BuildOS.$__BuildArch.$__BuildType"
451 if [[ "$__IbcTuning" -eq "" ]]; then
452 __ExtraBuildArgs="$__ExtraBuildArgs -OptimizationDataDir=\"$__PackagesDir/optimization.$__BuildOS-$__BuildArch.IBC.CoreCLR/$__IbcOptDataVersion/data/\""
453 __ExtraBuildArgs="$__ExtraBuildArgs -EnableProfileGuidedOptimization=true"
455 $__ProjectRoot/run.sh build -Project=$__ProjectDir/build.proj -MsBuildLog="/flp:Verbosity=normal;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log" -BuildTarget -__IntermediatesDir=$__IntermediatesDir -__RootBinDir=$__RootBinDir -BuildNugetPackage=false -UseSharedCompilation=false $__RunArgs $__ExtraBuildArgs $__UnprocessedBuildArgs
457 if [ $? -ne 0 ]; then
458 echo "Failed to build managed components."
462 # The cross build generates a crossgen with the target architecture.
463 if [ $__CrossBuild != 1 ]; then
464 # The architecture of host pc must be same architecture with target.
465 if [[ ( "$__HostArch" == "$__BuildArch" ) ]]; then
467 elif [[ ( "$__HostArch" == "x64" ) && ( "$__BuildArch" == "x86" ) ]]; then
469 elif [[ ( "$__HostArch" == "arm64" ) && ( "$__BuildArch" == "arm" ) ]]; then
477 generate_NugetPackages()
479 # We can only generate nuget package if we also support building mscorlib as part of this build.
480 if [ $__isMSBuildOnNETCoreSupported == 0 ]; then
481 echo "Nuget package generation unsupported."
485 # Since we can build mscorlib for this OS, did we build the native components as well?
486 if [ $__SkipCoreCLR == 1 ]; then
487 echo "Unable to generate nuget packages since native components were not built."
491 echo "Generating nuget packages for "$__BuildOS
492 echo "DistroRid is "$__DistroRid
493 echo "ROOTFS_DIR is "$ROOTFS_DIR
495 $__ProjectRoot/run.sh build -Project=$__SourceDir/.nuget/packages.builds -MsBuildLog="/flp:Verbosity=normal;LogFile=$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.log" -BuildTarget -__IntermediatesDir=$__IntermediatesDir -__RootBinDir=$__RootBinDir -BuildNugetPackage=false -UseSharedCompilation=false $__RunArgs $__UnprocessedBuildArgs
497 if [ $? -ne 0 ]; then
498 echo "Failed to generate Nuget packages."
503 echo "Commencing CoreCLR Repo build"
505 # Argument types supported by this script:
507 # Build architecture - valid values are: x64, ARM.
508 # Build Type - valid values are: Debug, Checked, Release
510 # Set the default arguments for build
512 # Obtain the location of the bash script to figure out where the root of the repo is.
513 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
515 # Use uname to determine what the CPU is.
517 # Some Linux platforms report unknown for platform, but the arch for machine.
518 if [ "$CPUName" == "unknown" ]; then
524 echo "Unsupported CPU $CPUName detected, build might not succeed!"
535 echo "Unsupported CPU $CPUName detected, build might not succeed!"
546 echo "Unknown CPU $CPUName detected, configuring as if for x64"
552 # Use uname to determine what the OS is.
586 echo "Unsupported OS $OSName detected, configuring as if for Linux"
594 __IncludeTests=Include_Tests
597 # Set the various build properties here so that CMake and MSBuild can pick them up
598 __ProjectDir="$__ProjectRoot"
599 __SourceDir="$__ProjectDir/src"
600 __PackagesDir="$__ProjectDir/packages"
601 __RootBinDir="$__ProjectDir/bin"
602 __UnprocessedBuildArgs=
616 __SkipRestoreOptData=0
619 __ClangMajorVersion=0
620 __ClangMinorVersion=0
621 __NuGetPath="$__PackagesDir/NuGet.exe"
625 __SkipGenerateVersion=0
628 __msbuildonunsupportedplatform=0
629 __PgoOptDataVersion=""
630 __IbcOptDataVersion=""
632 # Get the number of processors available to the scheduler
633 # Other techniques such as `nproc` only get the number of
634 # processors available to a single process.
635 if [ `uname` = "FreeBSD" ]; then
636 __NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
637 elif [ `uname` = "NetBSD" ]; then
638 __NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
640 __NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
644 if [ $# -le 0 ]; then
648 lowerI="$(echo $1 | awk '{print tolower($0)}')"
688 __CodeCoverage=Coverage
695 -portablebuild=false)
704 __cmakeargs="$__cmakeargs -DSTRIP_SYMBOLS=true"
708 __ClangMajorVersion=3
709 __ClangMinorVersion=5
713 __ClangMajorVersion=3
714 __ClangMinorVersion=6
718 __ClangMajorVersion=3
719 __ClangMinorVersion=7
723 __ClangMajorVersion=3
724 __ClangMinorVersion=8
728 __ClangMajorVersion=3
729 __ClangMinorVersion=9
733 __ClangMajorVersion=4
734 __ClangMinorVersion=0
747 __SkipRestoreOptData=1
751 __IbcTuning="/Tuning"
765 # Use "skipnative" to use the same option name as build.cmd.
770 # Accept "skipcoreclr" for backwards-compatibility.
783 __SkipGenerateVersion=1
787 __SkipRestoreOptData=1
807 __cmakeargs="$__cmakeargs -DCLR_CMAKE_WARNINGS_ARE_ERRORS=OFF"
812 __cmakeargs="$__cmakeargs $2"
815 echo "ERROR: 'cmakeargs' requires a non-empty option argument"
823 if [ ! -d $__RootBinDir ]; then
826 __RootBinParent=$(dirname $__RootBinDir)
827 __RootBinName=${__RootBinDir##*/}
828 __RootBinDir="$(cd $__RootBinParent &>/dev/null && printf %s/%s $PWD $__RootBinName)"
831 echo "ERROR: 'bindir' requires a non-empty option argument"
836 __cmakeargs="$__cmakeargs -DFEATURE_STANDALONE_GC=1 -DFEATURE_STANDALONE_GC_ONLY=1"
838 msbuildonunsupportedplatform)
839 __msbuildonunsupportedplatform=1
846 echo "ERROR: 'numproc' requires a non-empty option argument"
851 __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
858 __RunArgs="-BuildArch=$__BuildArch -BuildType=$__BuildType -BuildOS=$__BuildOS"
860 # Configure environment if we are doing a verbose build
861 if [ $__VerboseBuild == 1 ]; then
863 __RunArgs="$__RunArgs -verbose"
866 # Set default clang version
867 if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then
868 if [ $__CrossBuild == 1 ]; then
869 if [[ "$__BuildArch" == "arm" || "$__BuildArch" == "armel" ]]; then
870 __ClangMajorVersion=3
871 __ClangMinorVersion=9
873 __ClangMajorVersion=3
874 __ClangMinorVersion=6
878 __ClangMajorVersion=3
879 __ClangMinorVersion=5
883 if [[ "$__BuildArch" == "armel" ]]; then
884 # Armel cross build is Tizen specific and does not support Portable RID build
888 if [ $__PortableBuild == 0 ]; then
889 __RunArgs="$__RunArgs -PortableBuild=false"
892 # Set dependent variables
893 __LogsDir="$__RootBinDir/Logs"
895 # init the host distro name
898 # Set the remaining variables based upon the determined build configuration
899 __BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType"
900 __PackagesBinDir="$__BinDir/.nuget"
901 __ToolsDir="$__RootBinDir/tools"
902 __TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType"
903 export __IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType"
904 __TestIntermediatesDir="$__RootBinDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType"
905 __isMSBuildOnNETCoreSupported=0
906 __CrossComponentBinDir="$__BinDir"
907 __CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
909 __CrossArch="$__HostArch"
910 if [[ "$__HostArch" == "x64" && "$__BuildArch" == "arm" ]]; then
913 if [ $__CrossBuild == 1 ]; then
914 __CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
916 __CrossgenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__BuildOS.$BuildArch.$__BuildType.log"
917 __CrossgenExe="$__CrossComponentBinDir/crossgen"
919 # Init if MSBuild for .NET Core is supported for this platform
920 isMSBuildOnNETCoreSupported
922 # CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to set.
923 # This is needed by CLI to function.
924 if [ -z "$HOME" ]; then
925 if [ ! -d "$__ProjectDir/temp_home" ]; then
928 export HOME=$__ProjectDir/temp_home
929 echo "HOME not defined; setting it to $HOME"
932 # Specify path to be set for CMAKE_INSTALL_PREFIX.
933 # This is where all built CoreClr libraries will copied to.
934 export __CMakeBinDir="$__BinDir"
936 # Configure environment if we are doing a cross compile.
937 if [ $__CrossBuild == 1 ]; then
938 export CROSSCOMPILE=1
939 if ! [[ -n "$ROOTFS_DIR" ]]; then
940 export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__BuildArch"
944 # init the target distro name
947 # Make the directories necessary for build if they don't exist
953 # Restore the package containing profile counts for profile-guided optimizations
956 # Generate event logging infrastructure sources
957 generate_event_logging_sources
959 # Build the coreclr (native) components.
960 __ExtraCmakeArgs="-DCLR_CMAKE_TARGET_OS=$__BuildOS -DCLR_CMAKE_PACKAGES_DIR=$__PackagesDir -DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_VERSION=$__PgoOptDataVersion -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize"
961 build_native $__SkipCoreCLR "$__BuildArch" "$__IntermediatesDir" "$__ExtraCmakeArgs" "CoreCLR component"
963 # Build cross-architecture components
964 if [[ $__CrossBuild == 1 && $__DoCrossArchBuild == 1 ]]; then
965 build_cross_arch_component
968 # Build System.Private.CoreLib.
972 # Generate nuget packages
973 if [ $__SkipNuget != 1 ]; then
974 generate_NugetPackages
980 echo "Repo successfully built."
981 echo "Product binaries are available at $__BinDir"