Remove OpenSuse13.2 from runtime section in all Project.Jsons
[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 [portableLinux]"
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 "portableLinux - build for Portable Linux Distribution"
10     echo
11     exit 1
12 }
13
14 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
15 __PortableLinux=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         portableLinux)
75             if [ "$__BuildOS" == "Linux" ]; then
76                 __PortableLinux=1
77             else
78                 echo "ERROR: portableLinux not supported for non-Linux platforms."
79                 exit 1
80             fi
81             ;;
82         *)
83         unprocessedBuildArgs="$unprocessedBuildArgs $1"
84     esac
85     shift
86 done
87
88 # Portable builds target the base RID only for Linux based platforms
89 if [ $__PortableLinux == 1 ]; then
90     export __DistroRid="linux-$__Arch"
91 else
92     export __DistroRid="\${OSRid}-$__Arch"
93 fi
94
95 $__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/packages.builds -DistroRid=$__DistroRid -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs
96 if [ $? -ne 0 ]
97 then
98     echo "ERROR: An error occurred while building packages; See build-packages.log for more details."
99     exit 1
100 fi
101
102 echo "Done building packages."
103 exit 0