Generate .dll.config files for standard .NET projects

This commit is contained in:
cra0zy 2017-11-11 19:11:44 +01:00
parent ee57c26d77
commit a09f751b10
16 changed files with 54 additions and 1 deletions

View file

@ -1,5 +1,6 @@
using System; using System;
using P = System.IO.Path; using P = System.IO.Path;
using F = System.IO.File;
public class GAssembly public class GAssembly
{ {
@ -84,6 +85,7 @@ public class GAssembly
public void GenerateLinuxStubs() public void GenerateLinuxStubs()
{ {
var basedir = P.Combine("..", "..", Dir); var basedir = P.Combine("..", "..", Dir);
var lines = new List<string>();
if (Cake.DirectoryExists(P.Combine(basedir, "linux-x86"))) if (Cake.DirectoryExists(P.Combine(basedir, "linux-x86")))
Cake.DeleteDirectory(P.Combine(basedir, "linux-x86"), new DeleteDirectorySettings { Recursive = true, Force = true }); Cake.DeleteDirectory(P.Combine(basedir, "linux-x86"), new DeleteDirectorySettings { Recursive = true, Force = true });
@ -97,8 +99,11 @@ public class GAssembly
Cake.DeleteDirectory(P.Combine(basedir, "linux-arm"), new DeleteDirectorySettings { Recursive = true, Force = true }); Cake.DeleteDirectory(P.Combine(basedir, "linux-arm"), new DeleteDirectorySettings { Recursive = true, Force = true });
Cake.CreateDirectory(P.Combine(basedir, "linux-arm")); Cake.CreateDirectory(P.Combine(basedir, "linux-arm"));
lines.Add("<configuration>");
for (int i = 0; i < NativeDeps.Length; i += 2) for (int i = 0; i < NativeDeps.Length; i += 2)
{ {
lines.Add(" <dllmap dll=\"" + NativeDeps[i + 1] +"\" target=\"" + NativeDeps[i] + "\"/>");
// Generate x86 stubs // Generate x86 stubs
Cake.CreateDirectory(P.Combine(basedir, "linux-x86")); Cake.CreateDirectory(P.Combine(basedir, "linux-x86"));
Cake.StartProcess("gcc", "-m32 -shared -o " + NativeDeps[i] + " empty.c"); Cake.StartProcess("gcc", "-m32 -shared -o " + NativeDeps[i] + " empty.c");
@ -114,5 +119,8 @@ public class GAssembly
Cake.StartProcess("arm-none-eabi-gcc", "-shared -o " + NativeDeps[i] + " empty.c"); Cake.StartProcess("arm-none-eabi-gcc", "-shared -o " + NativeDeps[i] + " empty.c");
Cake.StartProcess("arm-none-eabi-gcc", "-Wl,--no-as-needed -shared -o " + P.Combine(basedir, "linux-arm", NativeDeps[i + 1] + ".so") + " -fPIC -L. -l:" + NativeDeps[i] + ""); Cake.StartProcess("arm-none-eabi-gcc", "-Wl,--no-as-needed -shared -o " + P.Combine(basedir, "linux-arm", NativeDeps[i + 1] + ".so") + " -fPIC -L. -l:" + NativeDeps[i] + "");
} }
lines.Add("</configuration>");
F.WriteAllLines(P.Combine(basedir, Name + ".dll.config"), lines.ToArray());
} }
} }

View file

@ -23,5 +23,8 @@
<Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" /> <Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" />
<Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" /> <Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" /> <Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" />
<Content Include="*.dll.config" PackagePath="lib\netstandard2.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -0,0 +1,3 @@
<configuration>
<dllmap dll="libatk-1.0-0.dll" target="libatk-1.0.so.0"/>
</configuration>

View file

@ -18,5 +18,8 @@
<Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" /> <Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" />
<Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" /> <Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" /> <Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" />
<Content Include="*.dll.config" PackagePath="lib\netstandard2.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -0,0 +1,3 @@
<configuration>
<dllmap dll="libcairo-2.dll" target="libcairo.so.2"/>
</configuration>

View file

@ -18,5 +18,8 @@
<Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" /> <Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" />
<Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" /> <Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" /> <Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" />
<Content Include="*.dll.config" PackagePath="lib\netstandard2.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -0,0 +1,5 @@
<configuration>
<dllmap dll="libglib-2.0-0.dll" target="libglib-2.0.so.0"/>
<dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0.so.0"/>
<dllmap dll="libgthread-2.0-0.dll" target="libgthread-2.0.so.0"/>
</configuration>

View file

@ -32,5 +32,8 @@
<Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" /> <Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" />
<Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" /> <Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" /> <Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" />
<Content Include="*.dll.config" PackagePath="lib\netstandard2.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -0,0 +1,4 @@
<configuration>
<dllmap dll="libgdk-3-0.dll" target="libgdk-3.so.0"/>
<dllmap dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0.so.0"/>
</configuration>

View file

@ -23,5 +23,8 @@
<Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" /> <Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" />
<Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" /> <Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" /> <Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" />
<Content Include="*.dll.config" PackagePath="lib\netstandard2.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -0,0 +1,3 @@
<configuration>
<dllmap dll="libgio-2.0-0.dll" target="libgio-2.0.so.0"/>
</configuration>

View file

@ -40,5 +40,8 @@
<Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" /> <Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" />
<Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" /> <Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" /> <Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" />
<Content Include="*.dll.config" PackagePath="lib\netstandard2.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -0,0 +1,3 @@
<configuration>
<dllmap dll="libgtk-3-0.dll" target="libgtk-3.so.0"/>
</configuration>

View file

@ -26,5 +26,8 @@
<Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" /> <Content Include="linux-x86\*" PackagePath="runtimes\linux-x86\native" Visible="false" />
<Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" /> <Content Include="linux-x64\*" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" /> <Content Include="linux-arm\*" PackagePath="runtimes\linux-arm\native" Visible="false" />
<Content Include="*.dll.config" PackagePath="lib\netstandard2.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -0,0 +1,3 @@
<configuration>
<dllmap dll="libpango-1.0-0.dll" target="libpango-1.0.so.0"/>
</configuration>

View file

@ -6,7 +6,7 @@
// VARS // VARS
Settings.Cake = Context; Settings.Cake = Context;
Settings.Version = "3.22.24.12"; Settings.Version = "3.22.24.13";
Settings.BuildTarget = Argument("BuildTarget", "Default"); Settings.BuildTarget = Argument("BuildTarget", "Default");
Settings.Assembly = Argument("Assembly", ""); Settings.Assembly = Argument("Assembly", "");