Skip to content

Commit 846ff25

Browse files
authored
Fix non-portable build (#38095)
1 parent 4aacf93 commit 846ff25

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

eng/build.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ usage()
7373
echo " --cmakeargs User-settable additional arguments passed to CMake."
7474
echo " --gcc Optional argument to build using gcc in PATH (default)."
7575
echo " --gccx.y Optional argument to build using gcc version x.y."
76+
echo " --portablebuild Optional argument: set to false to force a non-portable build."
7677
echo ""
7778

7879
echo "Command line arguments starting with '/p:' are passed through to MSBuild."
@@ -121,9 +122,7 @@ initDistroRid()
121122
local targetOs="$1"
122123
local buildArch="$2"
123124
local isCrossBuild="$3"
124-
# For RID calculation purposes, say we are always a portable build
125-
# All of our packages that use the distro rid (CoreCLR packages) are portable.
126-
local isPortableBuild=1
125+
local isPortableBuild="$4"
127126

128127
# Only pass ROOTFS_DIR if __DoCrossArchBuild is specified.
129128
if (( isCrossBuild == 1 )); then
@@ -141,6 +140,7 @@ arguments=''
141140
cmakeargs=''
142141
extraargs=''
143142
crossBuild=0
143+
portableBuild=1
144144

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

@@ -361,6 +361,19 @@ while [[ $# > 0 ]]; do
361361
shift 1
362362
;;
363363

364+
-portablebuild)
365+
if [ -z ${2+x} ]; then
366+
echo "No value for portablebuild is supplied. See help (--help) for supported values." 1>&2
367+
exit 1
368+
fi
369+
passedPortable="$(echo "$2" | awk '{print tolower($0)}')"
370+
if [ "$passedPortable" = false ]; then
371+
portableBuild=0
372+
arguments="$arguments /p:PortableBuild=false"
373+
fi
374+
shift 2
375+
;;
376+
364377
*)
365378
extraargs="$extraargs $1"
366379
shift 1
@@ -372,7 +385,7 @@ if [ ${#actInt[@]} -eq 0 ]; then
372385
arguments="-restore -build $arguments"
373386
fi
374387

375-
initDistroRid $os $arch $crossBuild
388+
initDistroRid $os $arch $crossBuild $portableBuild
376389

377390
# URL-encode space (%20) to avoid quoting issues until the msbuild call in /eng/common/tools.sh.
378391
# In *proj files (XML docs), URL-encoded string are rendered in their decoded form.

src/coreclr/crossgen-corelib.proj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<_CoreClrBuildArg Condition="'$(TargetArchitecture)' != ''" Include="-$(TargetArchitecture)" />
88
<_CoreClrBuildArg Include="-$(Configuration.ToLower())" />
99
<_CoreClrBuildArg Condition="!$([MSBuild]::IsOsPlatform(Windows))" Include="-os $(TargetOS)" />
10+
<_CoreClrBuildArg Condition="'$(CrossBuild)' == 'true'" Include="-cross" />
11+
<_CoreClrBuildArg Condition="'$(PortableBuild)' != 'true'" Include="-portablebuild=false" />
1012
</ItemGroup>
1113

1214
<PropertyGroup>

src/coreclr/runtime.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<_CoreClrBuildArg Include="$(Compiler)" />
1111
<_CoreClrBuildArg Condition="'$(ContinuousIntegrationBuild)' == 'true'" Include="-ci" />
1212
<_CoreClrBuildArg Condition="'$(CrossBuild)' == 'true'" Include="-cross" />
13+
<_CoreClrBuildArg Condition="'$(PortableBuild)' != 'true'" Include="-portablebuild=false" />
1314
<_CoreClrBuildArg Condition="!$([MSBuild]::IsOsPlatform(Windows))" Include="-os $(TargetOS)" />
1415

1516
<_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and

0 commit comments

Comments
 (0)