Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Packaging support for portable Linux binaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkhanna79 committed Dec 16, 2016
1 parent bedc2a0 commit 7753631
Show file tree
Hide file tree
Showing 16 changed files with 225 additions and 2 deletions.
20 changes: 18 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ usage()
echo "skipmscorlib - do not build mscorlib.dll."
echo "skiptests - skip the tests in the 'tests' subdirectory."
echo "skipnuget - skip building nuget packages."
echo "portableLinux - build for Portable Linux Distribution"
echo "verbose - optional argument to enable verbose build output."
echo "-skiprestore: skip restoring packages ^(default: packages are restored during build^)."
echo "-disableoss: Disable Open Source Signing for System.Private.CoreLib."
Expand Down Expand Up @@ -84,6 +85,11 @@ initTargetDistroRid()
else
export __DistroRid="$__HostDistroRid"
fi

# Portable builds target the base RID only for Linux based platforms
if [ $__PortableLinux == 1 ]; then
export __DistroRid="linux-$__BuildArch"
fi
}

setup_dirs()
Expand Down Expand Up @@ -520,6 +526,7 @@ __DistroRid=""
__cmakeargs=""
__SkipGenerateVersion=0
__DoCrossArchBuild=0
__PortableLinux=0

while :; do
if [ $# -le 0 ]; then
Expand Down Expand Up @@ -572,8 +579,17 @@ while :; do
cross)
__CrossBuild=1
;;

verbose)

portablelinux)
if [ "$__BuildOS" == "Linux" ]; then
__PortableLinux=1
else
echo "ERROR: portableLinux not supported for non-Linux platforms."
exit 1
fi
;;

verbose)
__VerboseBuild=1
;;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<OSGroup>Windows_NT</OSGroup>
<Platform>arm</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'linux-x64'" Include="linux/Microsoft.NETCore.ILAsm.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'debian.8-x64'" Include="debian/Microsoft.NETCore.ILAsm.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<ProjectReference Include="win\Microsoft.NETCore.ILAsm.pkgproj">
<Platform>arm</Platform>
</ProjectReference>
<ProjectReference Include="linux\Microsoft.NETCore.ILAsm.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="debian\Microsoft.NETCore.ILAsm.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<PackageTargetRuntime>linux-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
</PropertyGroup>
<ItemGroup>
<NativeSplittableBinary Include="$(BinDir)ilasm" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
</File>
</ItemGroup>
<ItemGroup Condition="'$(__BuildType)' == 'Release'">
<ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" />
<AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" />
<ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" />
<File Include="@(ArchitectureSpecificNativeSymbol)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
<IsSymbolFile>true</IsSymbolFile>
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<OSGroup>Windows_NT</OSGroup>
<Platform>arm</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'linux-x64'" Include="linux/Microsoft.NETCore.ILDAsm.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'debian.8-x64'" Include="debian/Microsoft.NETCore.ILDAsm.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<ProjectReference Include="win\Microsoft.NETCore.ILDAsm.pkgproj">
<Platform>arm</Platform>
</ProjectReference>
<ProjectReference Include="linux\Microsoft.NETCore.ILDAsm.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="debian\Microsoft.NETCore.ILDAsm.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<PackageTargetRuntime>linux-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
</PropertyGroup>
<ItemGroup>
<NativeSplittableBinary Include="$(BinDir)ildasm" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
</File>
</ItemGroup>
<ItemGroup Condition="'$(__BuildType)' == 'Release'">
<ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" />
<AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" />
<ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" />
<File Include="@(ArchitectureSpecificNativeSymbol)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
<IsSymbolFile>true</IsSymbolFile>
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
4 changes: 4 additions & 0 deletions src/.nuget/Microsoft.NETCore.Jit/Microsoft.NETCore.Jit.builds
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<OSGroup>Windows_NT</OSGroup>
<Platform>arm</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'linux-x64'" Include="linux/Microsoft.NETCore.Jit.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'debian.8-x64'" Include="debian/Microsoft.NETCore.Jit.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<ProjectReference Include="win\Microsoft.NETCore.Jit.pkgproj">
<Platform>arm</Platform>
</ProjectReference>
<ProjectReference Include="linux\Microsoft.NETCore.Jit.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="debian\Microsoft.NETCore.Jit.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<PackageTargetRuntime>linux-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
</PropertyGroup>
<ItemGroup>
<NativeSplittableBinary Include="$(BinDir)libclrjit.so" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
</File>
</ItemGroup>
<ItemGroup Condition="'$(__BuildType)' == 'Release'">
<ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" />
<AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" />
<ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" />
<File Include="@(ArchitectureSpecificNativeSymbol)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
<IsSymbolFile>true</IsSymbolFile>
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<OSGroup>Windows_NT</OSGroup>
<Platform>arm</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'linux-x64'" Include="linux/Microsoft.NETCore.Runtime.CoreCLR.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'debian.8-x64'" Include="debian/Microsoft.NETCore.Runtime.CoreCLR.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<ProjectReference Include="win\Microsoft.NETCore.Runtime.CoreCLR.pkgproj">
<Platform>arm</Platform>
</ProjectReference>
<ProjectReference Include="linux\Microsoft.NETCore.Runtime.CoreCLR.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="debian\Microsoft.NETCore.Runtime.CoreCLR.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<PackageTargetRuntime>linux-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
</PropertyGroup>
<ItemGroup>
<NativeSplittableBinary Include="$(BinDir)libcoreclr.so" />
<NativeSplittableBinary Include="$(BinDir)libcoreclrtraceptprovider.so" />
<NativeSplittableBinary Include="$(BinDir)libdbgshim.so" />
<NativeSplittableBinary Include="$(BinDir)libmscordaccore.so" />
<NativeSplittableBinary Include="$(BinDir)libmscordbi.so" />
<NativeSplittableBinary Include="$(BinDir)libsos.so" />
<NativeSplittableBinary Include="$(BinDir)libsosplugin.so" />
<NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" />
<ArchitectureSpecificNativeFile Include="$(BinDir)sosdocsunix.txt" />
<ArchitectureSpecificNativeFile Include="$(BinDir)mscorlib.ni.dll" />
<ArchitectureSpecificNativeFile Include="$(BinDir)System.Private.CoreLib.ni.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
</File>
<!-- Using lib/netstandard1.0 here. There is no TFM for this since it is a runtime itself. -->
<File Include="@(ArchitectureSpecificLibFile)">
<TargetPath>runtimes/$(PackageTargetRuntime)/lib/netstandard1.0</TargetPath>
</File>
<!-- No reference: don't permit reference to the implementation from lib -->
<File Include="$(PlaceholderFile)">
<TargetPath>ref/netstandard1.0</TargetPath>
</File>
<File Include="@(ArchitectureSpecificToolFile)">
<TargetPath>tools</TargetPath>
</File>
</ItemGroup>
<ItemGroup Condition="'$(__BuildType)' == 'Release'">
<ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" />
<AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\sosdocsunix.txt" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\crossgen" />
<ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" />
<File Include="@(ArchitectureSpecificNativeSymbol)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
<IsSymbolFile>true</IsSymbolFile>
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<OSGroup>Windows_NT</OSGroup>
<Platform>arm</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'linux-x64'" Include="linux/Microsoft.NETCore.TestHost.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
</Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'debian.8-x64'" Include="debian/Microsoft.NETCore.TestHost.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<ProjectReference Include="win\Microsoft.NETCore.TestHost.pkgproj">
<Platform>arm</Platform>
</ProjectReference>
<ProjectReference Include="linux\Microsoft.NETCore.TestHost.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="debian\Microsoft.NETCore.TestHost.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<PackageTargetRuntime>linux-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
</PropertyGroup>
<ItemGroup>
<NativeSplittableBinary Include="$(BinDir)corerun" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
</File>
</ItemGroup>
<ItemGroup Condition="'$(__BuildType)' == 'Release'">
<ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" />
<AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" />
<ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" />
<File Include="@(ArchitectureSpecificNativeSymbol)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
<IsSymbolFile>true</IsSymbolFile>
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

0 comments on commit 7753631

Please sign in to comment.