Skip to content

Commit efe395e

Browse files
committed
[mono-sdks] Fix Linux build
LLVM would fail to build on Linux because it would try to compile with a --host finishing with "apple-darwin10". The fix consist in testing if we are currently building on macOS (apple-darwin10) or Linux (linux-gnu). We also make sure to pass to the Mono SDKs the path to `external/llvm`, thus avoiding cloning it again in `external/mono/sdks/builds/toolchains/llvm`.
1 parent 0f0f783 commit efe395e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/mono-runtimes/mono-runtimes.targets

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
<PropertyGroup>
3737
<_MonoSdksConfiguration Condition=" '$(Configuration)' == 'Release' ">release</_MonoSdksConfiguration>
3838
<_MonoSdksConfiguration Condition=" '$(Configuration)' != 'Release' ">debug</_MonoSdksConfiguration>
39+
40+
<_MonoSdksAndroidToolchainPrefix>$([System.IO.Path]::GetFullPath ('$(AndroidToolchainDirectory)\toolchains'))</_MonoSdksAndroidToolchainPrefix>
41+
<_MonoSdksLlvmSrc>$([System.IO.Path]::GetFullPath ('$(MSBuildThisFileDirectory)..\..\external\llvm'))</_MonoSdksLlvmSrc>
42+
<_MonoSdksMxePrefix>$(AndroidMxeFullPath)</_MonoSdksMxePrefix>
43+
<_MonoSdksMxeSrc>$([System.IO.Path]::GetFullPath ('$(MSBuildThisFileDirectory)..\..\external\mxe'))</_MonoSdksMxeSrc>
44+
45+
<_MonoSdksParameters>CONFIGURATION=$(_MonoSdksConfiguration) IGNORE_PACKAGE_MXE=true IGNORE_PACKAGE_LLVM=true ANDROID_TOOLCHAIN_PREFIX=&quot;$(_MonoSdksAndroidToolchainPrefix)&quot; LLVM_SRC=&quot;$(_MonoSdksLlvmSrc)&quot; MXE_PREFIX=&quot;$(_MonoSdksMxePrefix)&quot; MXE_SRC=&quot;$(_MonoSdksMxeSrc)&quot;</_MonoSdksParameters>
3946
</PropertyGroup>
4047
<PropertyGroup>
4148
<ForceBuildDependsOn>
@@ -199,7 +206,7 @@
199206
Condition=" '$(_LlvmNeeded)' != '' ">
200207
<Exec
201208
Condition=" '%(_LlvmRuntime.UseMonoSdks)' != 'False' "
202-
Command="make $(MakeConcurrency) package-llvm-%(_LlvmRuntime.Identity) CONFIGURATION=$(_MonoSdksConfiguration)"
209+
Command="make $(MakeConcurrency) package-llvm-%(_LlvmRuntime.Identity) $(_MonoSdksParameters)"
203210
IgnoreStandardErrorWarningFormat="True"
204211
WorkingDirectory="$(MonoSourceFullPath)\sdks\builds"
205212
/>
@@ -441,7 +448,7 @@
441448
Outputs="@(_RuntimeSource);@(_MonoBinarySource);@(_ProfilerSource);@(_MonoPosixHelperSource);@(_RuntimeEglibHeaderSource);@(_MonoBtlsSource);@(_BclTestOutput)">
442449
<Exec
443450
Condition=" '%(_MonoRuntime.UseMonoSdks)' != 'False' And '%(_MonoRuntime.DoBuild)' == 'true' "
444-
Command="make $(MakeConcurrency) package-android-%(_MonoRuntime.Identity) CONFIGURATION=$(_MonoSdksConfiguration) ANDROID_TOOLCHAIN_PREFIX=&quot;$(AndroidToolchainDirectory)\toolchains&quot;"
451+
Command="make $(MakeConcurrency) package-android-%(_MonoRuntime.Identity) $(_MonoSdksParameters)"
445452
IgnoreStandardErrorWarningFormat="True"
446453
WorkingDirectory="$(MonoSourceFullPath)\sdks\builds"
447454
/>
@@ -881,13 +888,13 @@
881888
AfterTargets="Clean">
882889
<Exec
883890
Condition=" '%(_MonoRuntime.UseMonoSdks)' != 'False' "
884-
Command="make $(MakeConcurrency) clean-android-%(_MonoRuntime.Identity) CONFIGURATION=$(_MonoSdksConfiguration)"
891+
Command="make $(MakeConcurrency) clean-android-%(_MonoRuntime.Identity) $(_MonoSdksParameters)"
885892
IgnoreStandardErrorWarningFormat="True"
886893
WorkingDirectory="$(MonoSourceFullPath)\sdks\builds"
887894
/>
888895
<Exec
889896
Condition=" '%(_LlvmRuntime.UseMonoSdks)' != 'False' "
890-
Command="make $(MakeConcurrency) clean-llvm-%(_LlvmRuntime.Identity) CONFIGURATION=$(_MonoSdksConfiguration)"
897+
Command="make $(MakeConcurrency) clean-llvm-%(_LlvmRuntime.Identity) $(_MonoSdksParameters)"
891898
IgnoreStandardErrorWarningFormat="True"
892899
WorkingDirectory="$(MonoSourceFullPath)\sdks\builds"
893900
/>

0 commit comments

Comments
 (0)