Merge pull request #11406 from sdmaclea/PR-ARM64-ENABLE-FEATURE_TAILCALL_OPT
[platform/upstream/coreclr.git] / build-packages.sh
1 #!/usr/bin/env bash
2
3 usage()
4 {
5     echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step."
6     echo "Usage: build-packages -BuildArch -BuildType [-portable]"
7     echo "BuildArch can be x64, x86, arm, arm64 (default is x64)"
8     echo "BuildType can be release, checked, debug (default is debug)"
9     echo "-portable - build for Portable Distribution"
10     echo
11     exit 1
12 }
13
14 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
15 __PortableBuild=0
16
17 # Use uname to determine what the OS is.
18 OSName=$(uname -s)
19 case $OSName in
20     Linux)
21         __BuildOS=Linux
22         __HostOS=Linux
23         ;;
24
25     Darwin)
26         __BuildOS=OSX
27         __HostOS=OSX
28         ;;
29
30     FreeBSD)
31         __BuildOS=FreeBSD
32         __HostOS=FreeBSD
33         ;;
34
35     OpenBSD)
36         __BuildOS=OpenBSD
37         __HostOS=OpenBSD
38         ;;
39
40     NetBSD)
41         __BuildOS=NetBSD
42         __HostOS=NetBSD
43         ;;
44
45     SunOS)
46         __BuildOS=SunOS
47         __HostOS=SunOS
48         ;;
49
50     *)
51         echo "Unsupported OS $OSName detected, configuring as if for Linux"
52         __BuildOS=Linux
53         __HostOS=Linux
54         ;;
55 esac
56
57 unprocessedBuildArgs=
58
59 while :; do
60     if [ $# -le 0 ]; then
61         break
62     fi
63
64     case "$1" in
65         -\?|-h|--help)
66         usage
67         exit 1
68         ;;
69         -BuildArch=*)
70         unprocessedBuildArgs="$unprocessedBuildArgs $1"
71         __Arch=$(echo $1| cut -d'=' -f 2)
72         ;;
73
74         -portableBuild)
75             __PortableBuild=1
76             ;;
77         *)
78         unprocessedBuildArgs="$unprocessedBuildArgs $1"
79     esac
80     shift
81 done
82
83 # Portable builds target the base RID
84 if [ $__PortableBuild == 1 ]; then
85     if [ "$__BuildOS" == "Linux" ]; then
86         export __DistroRid="linux-$__Arch"
87     elif [ "$__BuildOS" == "OSX" ]; then
88         export __DistroRid="osx-$__Arch"
89     fi
90 else
91     export __DistroRid="\${OSRid}-$__Arch"
92 fi
93
94 $__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/packages.builds -DistroRid=$__DistroRid -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs
95 if [ $? -ne 0 ]
96 then
97     echo "ERROR: An error occurred while building packages; See build-packages.log for more details."
98     exit 1
99 fi
100
101 echo "Done building packages."
102 exit 0