summaryrefslogtreecommitdiff
path: root/build-packages.sh
diff options
context:
space:
mode:
authorJarret Shook <jashoo@microsoft.com>2019-02-21 13:16:33 -0800
committerGitHub <noreply@github.com>2019-02-21 13:16:33 -0800
commita006c44d06d56829a230bbbce17b74b21a0b8842 (patch)
tree6add588c73a3812ed4fb013c03ab0d22a0698910 /build-packages.sh
parentd559d44e02471854748763a6c7eb52cbdc56168f (diff)
downloadcoreclr-a006c44d06d56829a230bbbce17b74b21a0b8842.tar.gz
coreclr-a006c44d06d56829a230bbbce17b74b21a0b8842.tar.bz2
coreclr-a006c44d06d56829a230bbbce17b74b21a0b8842.zip
[Unix|*] Rework and share the logic for determining __DistroRid (#22628)
* [Unix|*] Rework and share the logic for determining __DistroRid This will consolidate all of our different functions which determine the __DistroRid into one file. In addition, it will remove the unused __HostDistroRid file. Lastly, it corrects the rid choice when crossbuilding musl-arm64 as the cross-rootfs non-portable build will correctly be picked up. * Fix typo and use __BuildArch in place of __Arch * Correct non-portable build decision * Add error for missing redhat-release * Fix redhat comparison * Correct previous rhel or * Fix cross scenerio * Fix missed $ * Set __RuntimeId for runtest.proj * Correct naming convention of file * Address feedback and support -portablebuild=0 With this change: 1. build.sh and build-test.sh should build portable by default. 2. init-distro-rid.sh checks __PortableBuild=1. If so, then it must force rhel 6 and freebsd to __PortableBuild=0 and use the non-portable build - For __PortableBuild=0 init-distro-rid.sh sets the non-portable rid correctly to "${ID}.${VERSION_ID}-${buildArch}" * Correct arguments * Fix if to include then * A few more changes to correct linux-musl-arm64 * Add error for non-cross build and correctly pass ROOTFS_DIR * Correctly exit instead of echo * Correct isCrossBuild and use rootfsDir only * Add documentation * Address feedback * Rework rhel if
Diffstat (limited to 'build-packages.sh')
-rwxr-xr-xbuild-packages.sh57
1 files changed, 12 insertions, 45 deletions
diff --git a/build-packages.sh b/build-packages.sh
index 1c36dfb4f3..50ca4d8750 100755
--- a/build-packages.sh
+++ b/build-packages.sh
@@ -10,38 +10,18 @@ usage()
exit 1
}
-initHostDistroRid()
+initDistroRid()
{
- __HostDistroRid=""
- if [ "$__HostOS" == "Linux" ]; then
- if [ -e /etc/os-release ]; then
- source /etc/os-release
- if [[ $ID == "rhel" ]]; then
- # remove the last version digit
- VERSION_ID=${VERSION_ID%.*}
- fi
- __HostDistroRid="$ID.$VERSION_ID-$__Arch"
- if [[ $ID == "alpine" ]]; then
- __HostDistroRid="linux-musl-$__Arch"
- fi
- elif [ -e /etc/redhat-release ]; then
- local redhatRelease=$(</etc/redhat-release)
- if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
- __HostDistroRid="rhel.6-$__Arch"
- fi
- if [[ $redhatRelease == "CentOS Linux release 7."* ]]; then
- __HostDistroRid="rhel.7-$__Arch"
- fi
- fi
- fi
- if [ "$__HostOS" == "FreeBSD" ]; then
- __freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'.'`
- __HostDistroRid="freebsd.$__freebsd_version-$__Arch"
- fi
+ source init-distro-rid.sh
+
+ local passedRootfsDir=""
- if [ "$__HostDistroRid" == "" ]; then
- echo "WARNING: Cannot determine runtime id for current distro."
+ # Only pass ROOTFS_DIR if __DoCrossArchBuild is specified.
+ if [ -z "${__CrossBuild}" ]; then
+ passedRootfsDir=${ROOTFS_DIR}
fi
+
+ initDistroRidGlobal ${__BuildOS} ${__BuildArch} ${__IsPortableBuild} ${passedRootfsDir}
}
__ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -103,8 +83,8 @@ while :; do
exit 1
;;
-BuildArch=*)
- __Arch=$(echo $1| cut -d'=' -f 2)
- buildArgs="$buildArgs /p:__BuildArch=$__Arch"
+ __BuildArch=$(echo $1| cut -d'=' -f 2)
+ buildArgs="$buildArgs /p:__BuildArch=$__BuildArch"
;;
-BuildType=*)
__Type=$(echo $1| cut -d'=' -f 2)
@@ -130,20 +110,7 @@ while :; do
shift
done
-# Portable builds target the base RID
-if [ $__IsPortableBuild == 1 ]; then
- if [ "$__BuildOS" == "Linux" ]; then
- export __DistroRid="linux-$__Arch"
- elif [ "$__BuildOS" == "OSX" ]; then
- export __DistroRid="osx-$__Arch"
- elif [ "$__BuildOS" == "FreeBSD" ]; then
- export __DistroRid="freebsd-$__Arch"
- fi
-else
- # init the host distro name
- initHostDistroRid
- export __DistroRid="$__HostDistroRid"
-fi
+initDistroRid
$__ProjectRoot/dotnet.sh msbuild /nologo /verbosity:minimal /clp:Summary \
/p:__BuildOS=$__BuildOS /flp:v=detailed\;Append\;LogFile=build-packages.log \