diff --git a/eng/build.sh b/eng/build.sh index 8ab3bf67e00..67f3cfeea47 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -158,7 +158,7 @@ extraargs='' crossBuild=0 portableBuild=1 -source $scriptroot/native/init-os-and-arch.sh +source $scriptroot/common/native/init-os-and-arch.sh hostArch=$arch diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index 60265718a35..3fa4d87a9e4 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -11,7 +11,7 @@ set -e os="$(echo "$1" | tr "[:upper:]" "[:lower:]")" if [ -z "$os" ]; then - . "$(dirname "$0")"/native/init-os-and-arch.sh + . "$(dirname "$0")"/common/native/init-os-and-arch.sh fi case "$os" in diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 1cd4ea0ed12..0916abb396f 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -282,7 +282,7 @@ usage() exit 1 } -source "$__RepoRootDir/eng/native/init-os-and-arch.sh" +source "$__RepoRootDir/eng/common/native/init-os-and-arch.sh" __TargetArch=$arch __TargetOS=$os diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh deleted file mode 100644 index e693617a6c2..00000000000 --- a/eng/native/init-os-and-arch.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env bash - -# Use uname to determine what the OS is. -OSName=$(uname -s | tr '[:upper:]' '[:lower:]') - -if command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then - OSName="android" -fi - -case "$OSName" in -freebsd|linux|netbsd|openbsd|sunos|android|haiku) - os="$OSName" ;; -darwin) - os=osx ;; -*) - echo "Unsupported OS $OSName detected!" - exit 1 ;; -esac - -# On Solaris, `uname -m` is discouraged, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html -# and `uname -p` returns processor type (e.g. i386 on amd64). -# The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html. -if [ "$os" = "sunos" ]; then - if uname -o 2>&1 | grep -q illumos; then - os="illumos" - else - os="solaris" - fi - CPUName=$(isainfo -n) -else - # For the rest of the operating systems, use uname(1) to determine what the CPU is. - CPUName=$(uname -m) -fi - -case "$CPUName" in - arm64|aarch64) - arch=arm64 - ;; - - loongarch64) - arch=loongarch64 - ;; - - riscv64) - arch=riscv64 - ;; - - amd64|x86_64) - arch=x64 - ;; - - armv7l|armv8l) - if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then - arch=armel - else - arch=arm - fi - ;; - - armv6l) - arch=armv6 - ;; - - i[3-6]86) - echo "Unsupported CPU $CPUName detected, build might not succeed!" - arch=x86 - ;; - - s390x) - arch=s390x - ;; - - ppc64le) - arch=ppc64le - ;; - *) - echo "Unknown CPU $CPUName detected!" - exit 1 - ;; -esac diff --git a/src/mono/sample/HelloWorld/Makefile b/src/mono/sample/HelloWorld/Makefile index bb380b0bc1c..afdfa16f351 100644 --- a/src/mono/sample/HelloWorld/Makefile +++ b/src/mono/sample/HelloWorld/Makefile @@ -3,8 +3,8 @@ DOTNET:=$(TOP)dotnet.sh DOTNET_Q_ARGS=--nologo -v:q -consoleloggerparameters:NoSummary MONO_CONFIG?=Debug -MONO_ARCH?=$(shell . $(TOP)eng/native/init-os-and-arch.sh && echo $${arch}) -TARGET_OS?=$(shell . $(TOP)eng/native/init-os-and-arch.sh && echo $${os}) +MONO_ARCH?=$(shell . $(TOP)eng/common/native/init-os-and-arch.sh && echo $${arch}) +TARGET_OS?=$(shell . $(TOP)eng/common/native/init-os-and-arch.sh && echo $${os}) AOT?=false USE_LLVM?=false StripILCode?=false diff --git a/src/mono/sample/iOS-NativeAOT/Makefile b/src/mono/sample/iOS-NativeAOT/Makefile index 0e203be2ddc..32da00a8358 100644 --- a/src/mono/sample/iOS-NativeAOT/Makefile +++ b/src/mono/sample/iOS-NativeAOT/Makefile @@ -3,7 +3,7 @@ TOP=../../../../ BUILD_CONFIG?=Debug -TARGET_ARCH?=$(shell . $(TOP)eng/native/init-os-and-arch.sh && echo $${arch}) +TARGET_ARCH?=$(shell . $(TOP)eng/common/native/init-os-and-arch.sh && echo $${arch}) TARGET_OS?=iossimulator DEPLOY_AND_RUN?=false STRIP_DEBUG_SYMBOLS?=false diff --git a/src/mono/sample/mbr/apple/Makefile b/src/mono/sample/mbr/apple/Makefile index f303ab5d18c..c84c2814b21 100644 --- a/src/mono/sample/mbr/apple/Makefile +++ b/src/mono/sample/mbr/apple/Makefile @@ -1,6 +1,6 @@ TOP=../../../../../ CONFIG?=Debug -MONO_ARCH?=$(shell . $(TOP)eng/native/init-os-and-arch.sh && echo $${arch}) +MONO_ARCH?=$(shell . $(TOP)eng/common/native/init-os-and-arch.sh && echo $${arch}) DOTNET:=$(TOP)dotnet.sh run-sim: diff --git a/src/mono/sample/mbr/console/Makefile b/src/mono/sample/mbr/console/Makefile index 7f2cddd6f5a..325c2b2e33a 100644 --- a/src/mono/sample/mbr/console/Makefile +++ b/src/mono/sample/mbr/console/Makefile @@ -6,8 +6,8 @@ DOTNET_Q_ARGS=--nologo -v:q -consoleloggerparameters:NoSummary CONFIG ?=Debug # How was dotnet/runtime built? should be the same as build.sh -c option BUILT_RUNTIME_CONFIG ?= Release -MONO_ARCH?=$(shell . $(TOP)eng/native/init-os-and-arch.sh && echo $${arch}) -TARGET_OS?=$(shell . $(TOP)eng/native/init-os-and-arch.sh && echo $${os}) +MONO_ARCH?=$(shell . $(TOP)eng/common/native/init-os-and-arch.sh && echo $${arch}) +TARGET_OS?=$(shell . $(TOP)eng/common/native/init-os-and-arch.sh && echo $${os}) MONO_ENV_OPTIONS = --interp diff --git a/src/tests/run.sh b/src/tests/run.sh index fe809ac3b6f..102bc0ba388 100755 --- a/src/tests/run.sh +++ b/src/tests/run.sh @@ -50,7 +50,7 @@ readonly EXIT_CODE_TEST_FAILURE=2 # Script completed successfully, but one or m scriptPath="$(cd "$(dirname "$BASH_SOURCE[0]")"; pwd -P)" repoRootDir="$(cd "$scriptPath"/../..; pwd -P)" -source "$repoRootDir/eng/native/init-os-and-arch.sh" +source "$repoRootDir/eng/common/native/init-os-and-arch.sh" # Argument variables buildArch="$arch"