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