Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
</PropertyGroup>

<PropertyGroup>
<DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(OutputRid).$(Configuration)', 'corehost'))</DotNetHostBinDir>
<DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(PackageRID).$(Configuration)', 'corehost'))</DotNetHostBinDir>
</PropertyGroup>

<!--Feature switches -->
Expand Down
4 changes: 2 additions & 2 deletions eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
<InnerBuildArgs>$(InnerBuildArgs) --verbosity $(LogVerbosity)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --nodereuse false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --warnAsError false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:PackageRid=$(TargetRid)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --packagerid $(TargetRid)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:NoPgoOptimize=true</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:KeepNativeSymbols=true</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:RuntimeOS=$(TargetRidWithoutPlatform)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:PortableBuild=$(SourceBuildPortable)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --portablebuild $(SourceBuildPortable)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:BuildDebPackage=false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:EnableNgenOptimization=false</InnerBuildArgs>
</PropertyGroup>
Expand Down
17 changes: 15 additions & 2 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ usage()
echo " --os Target operating system: windows, Linux, FreeBSD, OSX, MacCatalyst, tvOS,"
echo " tvOSSimulator, iOS, iOSSimulator, Android, Browser, NetBSD, illumos or Solaris."
echo " [Default: Your machine's OS.]"
echo " --packagerid <rid> Optional argument that overrides the target rid name."
echo " --projects <value> Project or solution file(s) to build."
echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked."
echo " Checked is exclusive to the CLR runtime. It is the same as Debug, except code is"
Expand Down Expand Up @@ -134,12 +135,13 @@ initDistroRid()
local buildArch="$2"
local isCrossBuild="$3"
local isPortableBuild="$4"
local packageRid="$5"

# Only pass ROOTFS_DIR if __DoCrossArchBuild is specified and the current platform is not OSX that doesn't use rootfs
if [[ $isCrossBuild == 1 && "$targetOs" != "OSX" ]]; then
passedRootfsDir=${ROOTFS_DIR}
fi
initDistroRidGlobal ${targetOs} ${buildArch} ${isPortableBuild} ${passedRootfsDir}
initDistroRidGlobal ${targetOs} ${buildArch} ${isPortableBuild} "${packageRid}" ${passedRootfsDir}
}

showSubsetHelp()
Expand All @@ -152,6 +154,7 @@ cmakeargs=''
extraargs=''
crossBuild=0
portableBuild=1
packageRid=''

source $scriptroot/native/init-os-and-arch.sh

Expand Down Expand Up @@ -402,6 +405,16 @@ while [[ $# > 0 ]]; do
shift 1
;;

-packagerid)
if [ -z ${2+x} ]; then
echo "No value for packagerid is supplied. See help (--help) for supported values." 1>&2
exit 1
fi
packageRid="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
arguments="$arguments /p:PackageRid=$packageRid"
shift 2
;;

-portablebuild)
if [ -z ${2+x} ]; then
echo "No value for portablebuild is supplied. See help (--help) for supported values." 1>&2
Expand Down Expand Up @@ -468,7 +481,7 @@ if [[ "$os" == "Browser" && "$arch" != "wasm" ]]; then
arch=wasm
fi

initDistroRid $os $arch $crossBuild $portableBuild
initDistroRid $os $arch $crossBuild $portableBuild "$packageRid"

# Disable targeting pack caching as we reference a partially constructed targeting pack and update it later.
# The later changes are ignored when using the cache.
Expand Down
15 changes: 14 additions & 1 deletion eng/native/build-commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ initTargetDistroRid()
passedRootfsDir="$ROOTFS_DIR"
fi

initDistroRidGlobal "$__TargetOS" "$__TargetArch" "$__PortableBuild" "$passedRootfsDir"
initDistroRidGlobal "$__TargetOS" "$__TargetArch" "$__PortableBuild" "$packageRid" "$passedRootfsDir"
}

setup_dirs()
Expand Down Expand Up @@ -212,6 +212,7 @@ usage()
echo "-gccx.y: optional argument to build using gcc version x.y."
echo "-ninja: target ninja instead of GNU make"
echo "-numproc: set the number of build processes."
echo "-packagerid: optional argument that overrides the target rid name."
echo "-portablebuild: pass -portablebuild=false to force a non-portable build."
echo "-skipconfigure: skip build configuration."
echo "-keepnativesymbols: keep native/unmanaged debug symbols."
Expand Down Expand Up @@ -253,6 +254,8 @@ else
fi
fi

packageRid=''

while :; do
if [[ "$#" -le 0 ]]; then
break
Expand Down Expand Up @@ -396,6 +399,16 @@ while :; do
__TargetArch=wasm
;;

packagerid|-packagerid)
if [[ -n "$2" ]]; then
packageRid="$2"
shift
else
echo "ERROR: 'packageRid' requires a non-empty option argument"
exit 1
fi
;;

ppc64le|-ppc64le)
__TargetArch=ppc64le
;;
Expand Down
111 changes: 58 additions & 53 deletions eng/native/init-distro-rid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,71 +132,76 @@ initDistroRidGlobal()
local targetOs="$1"
local buildArch="$2"
local isPortable="$3"
local packageRid="$4"
local rootfsDir=""
if [ "$#" -ge 4 ]; then
rootfsDir="$4"
if [ "$#" -ge 5 ]; then
rootfsDir="$5"
fi

if [ -n "${rootfsDir}" ]; then
# We may have a cross build. Check for the existence of the rootfsDir
if [ ! -e "${rootfsDir}" ]; then
echo "Error rootfsDir has been passed, but the location is not valid."
exit 1
if [ -n "$packageRid" ]; then
export __DistroRid=$packageRid
else
if [ -n "${rootfsDir}" ]; then
# We may have a cross build. Check for the existence of the rootfsDir
if [ ! -e "${rootfsDir}" ]; then
echo "Error rootfsDir has been passed, but the location is not valid."
exit 1
fi
fi
fi

initNonPortableDistroRid "${targetOs}" "${buildArch}" "${isPortable}" "${rootfsDir}"
initNonPortableDistroRid "${targetOs}" "${buildArch}" "${isPortable}" "${rootfsDir}"

if [ "$buildArch" = "wasm" ]; then
__DistroRid=browser-wasm
export __DistroRid
fi
if [ "$buildArch" = "wasm" ]; then
__DistroRid=browser-wasm
export __DistroRid
fi

if [ -z "${__DistroRid}" ]; then
# The non-portable build rid was not set. Set the portable rid.
if [ -z "${__DistroRid}" ]; then
# The non-portable build rid was not set. Set the portable rid.

__PortableBuild=1
export __PortableBuild
local distroRid=""
__PortableBuild=1
export __PortableBuild
local distroRid=""

# Check for musl-based distros (e.g Alpine Linux, Void Linux).
if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl ||
strings "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl; then
distroRid="linux-musl-${buildArch}"
fi
# Check for musl-based distros (e.g Alpine Linux, Void Linux).
if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl ||
strings "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl; then
distroRid="linux-musl-${buildArch}"
fi

if [ -z "${distroRid}" ]; then
if [ "$targetOs" = "Linux" ]; then
distroRid="linux-$buildArch"
elif [ "$targetOs" = "linux-bionic" ]; then
distroRid="linux-bionic-$buildArch"
elif [ "$targetOs" = "OSX" ]; then
distroRid="osx-$buildArch"
elif [ "$targetOs" = "MacCatalyst" ]; then
distroRid="maccatalyst-$buildArch"
elif [ "$targetOs" = "tvOS" ]; then
distroRid="tvos-$buildArch"
elif [ "$targetOs" = "tvOSSimulator" ]; then
distroRid="tvossimulator-$buildArch"
elif [ "$targetOs" = "iOS" ]; then
distroRid="ios-$buildArch"
elif [ "$targetOs" = "iOSSimulator" ]; then
distroRid="iossimulator-$buildArch"
elif [ "$targetOs" = "Android" ]; then
distroRid="android-$buildArch"
elif [ "$targetOs" = "Browser" ]; then
distroRid="browser-$buildArch"
elif [ "$targetOs" = "FreeBSD" ]; then
distroRid="freebsd-$buildArch"
elif [ "$targetOs" = "illumos" ]; then
distroRid="illumos-$buildArch"
elif [ "$targetOs" = "Solaris" ]; then
distroRid="solaris-$buildArch"
if [ -z "${distroRid}" ]; then
if [ "$targetOs" = "Linux" ]; then
distroRid="linux-$buildArch"
elif [ "$targetOs" = "linux-bionic" ]; then
distroRid="linux-bionic-$buildArch"
elif [ "$targetOs" = "OSX" ]; then
distroRid="osx-$buildArch"
elif [ "$targetOs" = "MacCatalyst" ]; then
distroRid="maccatalyst-$buildArch"
elif [ "$targetOs" = "tvOS" ]; then
distroRid="tvos-$buildArch"
elif [ "$targetOs" = "tvOSSimulator" ]; then
distroRid="tvossimulator-$buildArch"
elif [ "$targetOs" = "iOS" ]; then
distroRid="ios-$buildArch"
elif [ "$targetOs" = "iOSSimulator" ]; then
distroRid="iossimulator-$buildArch"
elif [ "$targetOs" = "Android" ]; then
distroRid="android-$buildArch"
elif [ "$targetOs" = "Browser" ]; then
distroRid="browser-$buildArch"
elif [ "$targetOs" = "FreeBSD" ]; then
distroRid="freebsd-$buildArch"
elif [ "$targetOs" = "illumos" ]; then
distroRid="illumos-$buildArch"
elif [ "$targetOs" = "Solaris" ]; then
distroRid="solaris-$buildArch"
fi
fi
fi

__DistroRid="${distroRid}"
export __DistroRid
__DistroRid="${distroRid}"
export __DistroRid
fi
fi

if [ -z "$__DistroRid" ]; then
Expand Down
1 change: 1 addition & 0 deletions src/native/corehost/corehost.proj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<BuildArgs Condition="'$(Ninja)' == 'true'">$(BuildArgs) -ninja</BuildArgs>
<BuildArgs>$(BuildArgs) -runtimeflavor $(RuntimeFlavor)</BuildArgs>
<BuildArgs Condition="'$(OfficialBuildId)' != ''">$(BuildArgs) /p:OfficialBuildId="$(OfficialBuildId)"</BuildArgs>
<BuildArgs Condition="'$(PackageRid)' != ''">$(BuildArgs) -packagerid $(PackageRid)</BuildArgs>
</PropertyGroup>

<!--
Expand Down