-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mono-runtimes] Build required mono runtimes.
Add a new build-tools/mono-runtimes project to build the required Mono runtimes for Xamarin.Android app execution on Android devices. Xamarin.Android 6.0 ("cycle 6") includes Mono runtimes compiled for five architectures: * armeabi (armv5) * armeabi-v7a (armv7) * arm64-v8a (aarch64) * x86 * x86_64 An additional "host" architecture is also built to build the "monodroid" profile assemblies such as mscorlib.dll. In the interest of expediency and not requiring that *six* different runtimes be built -- which can greatly increase build times and storage requirements -- the initial xamarin-android open-source build will only build the armeabi-v7a (armv7) and "host" architectures. Additionally, the <UnzipDirectoryChildren/> task needed to be altered to use unzip(1) on OS X instead of using System.IO.Compression.ZipFile, because the ZipFile implementation included with Mono 4.4 doesn't respect file attributes such as the +x, causing all files to be extracted as 644 (rw-r--r--), resulting in an NDK toolchain which wouldn't work. To resolve this issue, execution on OS X and Linux now uses unzip(1). ~~ Adding new architectures ~~ To build Mono for a new architecture, edit build-tools/mono-runtimes/mono-runtimes.projitems and add a new @(_MonoRuntime) entry for the desired architecture. TODO: Figure out if there's a reasonable way to "opt-in" or "opt-out" of CPU architectures so that it isn't an "all or nothing" prospect.
- Loading branch information
Showing
11 changed files
with
258 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "external/mono"] | ||
path = external/mono | ||
url = [email protected]:mono/mono.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ItemType>GenericProject</ItemType> | ||
<ProjectGuid>{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}</ProjectGuid> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<OutputPath>..\..\bin\Debug</OutputPath> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<OutputPath>..\..\bin\Release</OutputPath> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<PropertyGroup> | ||
<BuildDependsOn> | ||
ResolveReferences; | ||
_Autogen; | ||
_ConfigureRuntimes; | ||
_BuildRuntimes; | ||
_InstallRuntimes; | ||
_InstallBcl; | ||
</BuildDependsOn> | ||
</PropertyGroup> | ||
<Import Project="mono-runtimes.targets" /> | ||
<ItemGroup> | ||
<ProjectReference Include="..\android-toolchain\android-toolchain.mdproj"> | ||
<Project>{8FF78EB6-6FC8-46A7-8A15-EBBA9045C5FA}</Project> | ||
<Name>android-toolchain</Name> | ||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly> | ||
</ProjectReference> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<_MonoRuntime Include="armeabi-v7a"> | ||
<Ar>$(_ArmAr)</Ar> | ||
<As>$(_ArmAs)</As> | ||
<Cc>$(_ArmCc)</Cc> | ||
<Cpp>$(_ArmCpp) $(_ArmCppFlags)</Cpp> | ||
<CFlags>$(_ArmCFlags) -mtune=cortex-a8 -march=armv7-a -mfpu=vfp -mfloat-abi=softfp $(_TargetCFlags)</CFlags> | ||
<Cxx>$(_ArmCxx)</Cxx> | ||
<CxxFlags>$(_ArmCxxFlags) -mtune=cortex-a8 -march=armv7-a -mfpu=vfp -mfloat-abi=softfp $(_TargetCxxFlags) </CxxFlags> | ||
<CxxCpp>$(_ArmCxxCpp) $(_ArmCppFlags)</CxxCpp> | ||
<Ld>$(_ArmLd)</Ld> | ||
<LdFlags>$(_ArmLdFlags)</LdFlags> | ||
<RanLib>$(_ArmRanLib)</RanLib> | ||
<Strip>$(_ArmStrip)</Strip> | ||
<ConfigureFlags>--host=armv5-linux-androideabi $(_TargetConfigureFlags)</ConfigureFlags> | ||
<OutputRuntime>libmonosgen-2.0.so</OutputRuntime> | ||
<OutputProfiler>libmono-profiler-log.so</OutputProfiler> | ||
<OutputMonoPosixHelper>libMonoPosixHelper.so</OutputMonoPosixHelper> | ||
</_MonoRuntime> | ||
<_MonoRuntime Include="host"> | ||
<Ar>ar</Ar> | ||
<As>as</As> | ||
<Cc>clang</Cc> | ||
<CFlags>$(_CommonCFlags) -mmacosx-version-min=10.9</CFlags> | ||
<Cxx>clang++</Cxx> | ||
<CxxCpp>cpp</CxxCpp> | ||
<CxxFlags></CxxFlags> | ||
<Ld>ld</Ld> | ||
<LdFlags></LdFlags> | ||
<RanLib>ranlib</RanLib> | ||
<Strip>strip -S</Strip> | ||
<ConfigureFlags>--enable-maintainer-mode --without-ikvm-native --with-monodroid --with-mcs-docs=no --disable-mono-debugger --with-profile2=no --with-profile4=no --with-profile4_5=yes --disable-boehm --enable-nls=no --disable-iconv</ConfigureFlags> | ||
<OutputRuntime>libmonosgen-2.0.dylib</OutputRuntime> | ||
<OutputProfiler>libmono-profiler-log.dylib</OutputProfiler> | ||
<OutputMonoPosixHelper>libMonoPosixHelper.dylib</OutputMonoPosixHelper> | ||
</_MonoRuntime> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<_CommonCFlags Condition=" '$(Configuration)' == 'Debug' ">-ggdb3 -O0 -fno-omit-frame-pointer</_CommonCFlags> | ||
<_CommonCFlags Condition=" '$(Configuration)' == 'Release' ">-g -O2</_CommonCFlags> | ||
<_CommonConfigureFlags>--without-ikvm-native --enable-maintainer-mode --with-profile2=no --with-profile4=no --with-profile4_5=no --with-monodroid --enable-nls=no --with-sigaltstack=yes --with-tls=pthread mono_cv_uscore=yes</_CommonConfigureFlags> | ||
<_TargetConfigureFlags>$(_CommonConfigureFlags) --enable-minimal=ssa,portability,attach,verifier,full_messages,sgen_remset,sgen_marksweep_par,sgen_marksweep_fixed,sgen_marksweep_fixed_par,sgen_copying,logging,security,shared_handles --disable-mcs-build --disable-executables</_TargetConfigureFlags> | ||
<_SecurityCFlags>-Wl,-z,now -Wl,-z,relro -Wl,-z,noexecstack -fstack-protector</_SecurityCFlags> | ||
<_TargetCFlags>$(_SecurityCFlags) -DMONODROID=1</_TargetCFlags> | ||
<_TargetCxxFlags>$(_SecurityCFlags) -DMONODROID=1</_TargetCxxFlags> | ||
<_TargetLdFlags>-ldl -lm -llog -lc -lgcc</_TargetLdFlags> | ||
<_ArmNdkPlatformPath>$(AndroidToolchainDirectory)\ndk\platforms\android-4</_ArmNdkPlatformPath> | ||
<_ArmAr>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-ar</_ArmAr> | ||
<_ArmAs>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-as</_ArmAs> | ||
<_ArmCc>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-clang</_ArmCc> | ||
<_ArmCFlags>$(_CommonCFlags) -D__POSIX_VISIBLE=201002 -DSK_RELEASE -DNDEBUG -UDEBUG -fpic</_ArmCFlags> | ||
<_ArmCpp>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-cpp</_ArmCpp> | ||
<_ArmCppFlags>-I$(_ArmNdkPlatformPath)\arch-arm\usr\include\</_ArmCppFlags> | ||
<_ArmCxx>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-clang++</_ArmCxx> | ||
<_ArmCxxFlags>-I$(_ArmNdkPlatformPath)\arch-arm\usr\include\</_ArmCxxFlags> | ||
<_ArmCxxCpp>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-cpp</_ArmCxxCpp> | ||
<_ArmLd>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-ld</_ArmLd> | ||
<_ArmLdFlags>$(_TargetLdFlags) -Wl,--fix-cortex-a8 -Wl,-rpath-link=$(_ArmNdkPlatformPath)\arch-arm\usr\lib,-dynamic-linker=/system/bin/linker -L$(_ArmNdkPlatformPath)\arch-arm\usr\lib</_ArmLdFlags> | ||
<_ArmRanLib>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-ranlib</_ArmRanLib> | ||
<_ArmStrip>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-strip</_ArmStrip> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\..\Configuration.props" /> | ||
<Import Project="mono-runtimes.props" /> | ||
<Import Project="mono-runtimes.projitems" /> | ||
<PropertyGroup> | ||
<_MonoPath>..\..\external\mono</_MonoPath> | ||
</PropertyGroup> | ||
<Target Name="_Autogen" | ||
Inputs="$(_MonoPath)\autogen.sh" | ||
Outputs="$(_MonoPath)\configure"> | ||
<Exec | ||
Command="NOCONFIGURE=1 ./autogen.sh" | ||
WorkingDirectory="$(_MonoPath)" | ||
/> | ||
</Target> | ||
<Target Name="_ConfigureRuntimes" | ||
Inputs="$(_MonoPath)\configure" | ||
Outputs="@(_MonoRuntime->'obj\%(Identity)\.stamp')"> | ||
<MakeDir Directories="@(_MonoRuntime->'obj\%(Identity)')" /> | ||
<Exec | ||
Command="..\..\$(_MonoPath)\configure LDFLAGS="%(_MonoRuntime.LdFlags)" CFLAGS="%(_MonoRuntime.CFlags)" CXXFLAGS="%(_MonoRuntime.CxxFlags)" CC="%(_MonoRuntime.Cc)" CXX="%(_MonoRuntime.Cxx)" CPP="%(_MonoRuntime.Cpp)" CXXCPP="%(_MonoRuntime.CxxCpp)" LD="%(_MonoRuntime.Ld)" AR="%(_MonoRuntime.Ar)" AS="%(_MonoRuntime.As)" RANLIB="%(_MonoRuntime.RanLib)" STRIP="%(_MonoRuntime.Strip)" --cache-file=..\%(_MonoRuntime.Identity).config.cache %(_MonoRuntime.ConfigureFlags)" | ||
WorkingDirectory="@(_MonoRuntime->'obj\%(Identity)')" | ||
/> | ||
<Touch | ||
Files="@(_MonoRuntime->'obj\%(Identity)\.stamp')" | ||
AlwaysCreate="True" | ||
/> | ||
</Target> | ||
<Target Name="_BuildRuntimes" | ||
Inputs="@(_MonoRuntime->'obj\%(Identity)\.stamp')" | ||
Outputs="@(_MonoRuntime->'obj\%(Identity)\mono\mini\.libs\%(OutputRuntime)');@(_MonoRuntime->'obj\%(Identity)\mono\profiler\.libs\%(OutputProfiler)');@(_MonoRuntime->'obj\%(Identity)\support\.libs\%(OutputMonoPosixHelper)')"> | ||
<Exec | ||
Command="make $(MAKEFLAGS) # %(_MonoRuntime.Identity)" | ||
WorkingDirectory="@(_MonoRuntime->'obj\%(Identity)')" | ||
/> | ||
</Target> | ||
<Target Name="_InstallRuntimes" | ||
Inputs="@(_MonoRuntime->'obj\%(Identity)\mono\mini\.libs\%(OutputRuntime)');@(_MonoRuntime->'obj\%(Identity)\mono\profiler\.libs\%(OutputProfiler)');@(_MonoRuntime->'obj\%(Identity)\support\.libs\%(OutputMonoPosixHelper)')" | ||
Outputs="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)');@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputProfiler)');@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputMonoPosixHelper)')"> | ||
<MakeDir Directories="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)')" /> | ||
<Copy | ||
SourceFiles="@(_MonoRuntime->'obj\%(Identity)\mono\mini\.libs\%(OutputRuntime)')" | ||
DestinationFiles="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)')" | ||
/> | ||
<Touch | ||
Files="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)')" | ||
/> | ||
<Copy | ||
SourceFiles="@(_MonoRuntime->'obj\%(Identity)\mono\mini\.libs\%(OutputRuntime)')" | ||
DestinationFiles="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)-unstripped')" | ||
/> | ||
<Exec | ||
Command="%(_MonoRuntime.Strip) "@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)')"" | ||
/> | ||
<Copy | ||
SourceFiles="@(_MonoRuntime->'obj\%(Identity)\mono\profiler\.libs\%(OutputProfiler)')" | ||
DestinationFiles="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputProfiler)')" | ||
/> | ||
<Touch | ||
Files="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputProfiler)')" | ||
/> | ||
<Copy | ||
SourceFiles="@(_MonoRuntime->'obj\%(Identity)\support\.libs\%(OutputMonoPosixHelper)')" | ||
DestinationFiles="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputMonoPosixHelper)')" | ||
/> | ||
<Touch | ||
Files="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputMonoPosixHelper)')" | ||
/> | ||
</Target> | ||
<Target Name="_InstallBcl" | ||
Inputs="$(_MonoPath)\mcs\class\lib\monodroid\mscorlib.dll" | ||
Outputs="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0\mscorlib.dll"> | ||
<MakeDir Directories="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0" /> | ||
<MakeDir Directories="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0\Facades" /> | ||
<ItemGroup> | ||
<_Assemblies Include="$(_MonoPath)\mcs\class\lib\monodroid\*.dll" /> | ||
<_Facades Include="$(_MonoPath)\mcs\class\lib\monodroid\Facades\*.dll" /> | ||
</ItemGroup> | ||
<Copy | ||
SourceFiles="@(_Assemblies)" | ||
DestinationFolder="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0" | ||
/> | ||
<Copy | ||
SourceFiles="@(_Facades)" | ||
DestinationFolder="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0\Facades" | ||
/> | ||
<Touch | ||
Files="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0\mscorlib.dll" | ||
/> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters