summaryrefslogtreecommitdiff
path: root/build-test.sh
diff options
context:
space:
mode:
authorJarret Shook <jashoo@microsoft.com>2019-02-21 21:16:33 (GMT)
committerGitHub <noreply@github.com>2019-02-21 21:16:33 (GMT)
commita006c44d06d56829a230bbbce17b74b21a0b8842 (patch)
tree6add588c73a3812ed4fb013c03ab0d22a0698910 /build-test.sh
parentd559d44e02471854748763a6c7eb52cbdc56168f (diff)
downloadcoreclr-a006c44d06d56829a230bbbce17b74b21a0b8842.zip
coreclr-a006c44d06d56829a230bbbce17b74b21a0b8842.tar.gz
coreclr-a006c44d06d56829a230bbbce17b74b21a0b8842.tar.bz2
[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-test.sh')
-rwxr-xr-xbuild-test.sh90
1 files changed, 9 insertions, 81 deletions
diff --git a/build-test.sh b/build-test.sh
index 75c8570..8e38bae 100755
--- a/build-test.sh
+++ b/build-test.sh
@@ -1,85 +1,17 @@
#!/usr/bin/env bash
-initHostDistroRid()
-{
- __HostDistroRid=""
-
- # Some OS groups should default to use the portable packages
- if [ "$__BuildOS" == "OSX" ]; then
- __PortableBuild=1
- fi
-
- if [ "$__HostOS" == "Linux" ]; then
- if [ -e /etc/redhat-release ]; then
- __PortableBuild=1
- elif [ -e /etc/os-release ]; then
- source /etc/os-release
- if [[ $ID == "alpine" ]]; then
- __HostDistroRid="linux-musl-$__HostArch"
- else
- __PortableBuild=1
- __HostDistroRid="$ID.$VERSION_ID-$__HostArch"
- fi
- fi
- elif [ "$__HostOS" == "FreeBSD" ]; then
- __freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'.'`
- __HostDistroRid="freebsd.$__freebsd_version-$__HostArch"
- fi
-
- # Portable builds target the base RID
- if [ "$__PortableBuild" == 1 ]; then
- if [ "$__BuildOS" == "OSX" ]; then
- export __HostDistroRid="osx-$__BuildArch"
- elif [ "$__BuildOS" == "Linux" ]; then
- export __HostDistroRid="linux-$__BuildArch"
- fi
- fi
-
- if [ "$__HostDistroRid" == "" ]; then
- echo "WARNING: Cannot determine runtime id for current distro."
- fi
-
- echo "Setting __HostDistroRid to $__HostDistroRid"
-}
+__PortableBuild=1
initTargetDistroRid()
{
- if [ $__CrossBuild == 1 ]; then
- if [ "$__BuildOS" == "Linux" ]; then
- if [ ! -e $ROOTFS_DIR/etc/os-release ]; then
- if [ -e $ROOTFS_DIR/android_platform ]; then
- source $ROOTFS_DIR/android_platform
- export __DistroRid="$RID"
- else
- echo "WARNING: Cannot determine runtime id for current distro."
- export __DistroRid=""
- fi
- else
- source $ROOTFS_DIR/etc/os-release
- export __DistroRid="$ID.$VERSION_ID-$__BuildArch"
- fi
- fi
- else
- export __DistroRid="$__HostDistroRid"
- export __RuntimeId="$__HostDistroRid"
- fi
-
- if [ "$ID.$VERSION_ID" == "ubuntu.16.04" ]; then
- export __DistroRid="ubuntu.14.04-$__BuildArch"
- fi
+ source init-distro-rid.sh
- # Portable builds target the base RID
- if [ "$__PortableBuild" == 1 ]; then
- if [ "$__BuildOS" == "Linux" ]; then
- export __DistroRid="linux-$__BuildArch"
- export __RuntimeId="linux-$__BuildArch"
- elif [ "$__BuildOS" == "OSX" ]; then
- export __DistroRid="osx-$__BuildArch"
- export __RuntimeId="osx-$__BuildArch"
- fi
+ # Only pass ROOTFS_DIR if cross is specified.
+ if (( ${__CrossBuild} == 1 )); then
+ passedRootfsDir=${ROOTFS_DIR}
fi
- echo "__DistroRid: " $__DistroRid
+ initDistroRidGlobal ${__BuildOS} ${__BuildArch} ${__PortableBuild} ${passedRootfsDir}
}
isMSBuildOnNETCoreSupported()
@@ -96,7 +28,7 @@ isMSBuildOnNETCoreSupported()
UNSUPPORTED_RIDS=("debian.9-x64" "ubuntu.17.04-x64")
for UNSUPPORTED_RID in "${UNSUPPORTED_RIDS[@]}"
do
- if [ "$__HostDistroRid" == "$UNSUPPORTED_RID" ]; then
+ if [ "${__DistroRid}" == "$UNSUPPORTED_RID" ]; then
__isMSBuildOnNETCoreSupported=0
break
fi
@@ -678,7 +610,6 @@ __CrossBuild=0
__ClangMajorVersion=0
__ClangMinorVersion=0
__NuGetPath="$__PackagesDir/NuGet.exe"
-__HostDistroRid=""
__SkipRestorePackages=0
__DistroRid=""
__cmakeargs=""
@@ -747,8 +678,8 @@ while :; do
__CrossBuild=1
;;
- portableBuild)
- __PortableBuild=1
+ portablebuild=false)
+ __PortableBuild=0
;;
portablelinux)
@@ -914,9 +845,6 @@ fi
__LogsDir="$__RootBinDir/Logs"
__MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"
-# init the host distro name
-initHostDistroRid
-
# Set the remaining variables based upon the determined build configuration
__BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType"
__PackagesBinDir="$__BinDir/.nuget"