Fix linux stubs linking

This commit is contained in:
cra0zy 2017-10-30 00:23:56 +01:00
parent cfc794c3bd
commit ac7ea69ce8
32 changed files with 21 additions and 13 deletions

View file

@ -83,22 +83,28 @@ public class GAssembly
public void GenerateLinuxStubs() public void GenerateLinuxStubs()
{ {
var basedir = P.Combine("..", "..", Dir);
Cake.DeleteDirectory(P.Combine(basedir, "linux-x86"), new DeleteDirectorySettings { Recursive = true, Force = true });
Cake.DeleteDirectory(P.Combine(basedir, "linux-x64"), new DeleteDirectorySettings { Recursive = true, Force = true });
Cake.DeleteDirectory(P.Combine(basedir, "linux-arm"), new DeleteDirectorySettings { Recursive = true, Force = true });
for (int i = 0; i < NativeDeps.Length; i += 2) for (int i = 0; i < NativeDeps.Length; i += 2)
{ {
// Generate x64 stubs
Cake.CreateDirectory(P.Combine(Dir, "linux-x64"));
Cake.StartProcess("gcc", "-shared -o BuildOutput/LinuxStubs/" + NativeDeps[i] + " BuildOutput/LinuxStubs/empty.c");
Cake.StartProcess("gcc", "-Wl,--no-as-needed -shared -o " + P.Combine(Dir, "linux-x64", NativeDeps[i + 1] + ".so") + " -fPIC -L. -l:BuildOutput/LinuxStubs/" + NativeDeps[i] + "");
// Generate x86 stubs // Generate x86 stubs
Cake.CreateDirectory(P.Combine(Dir, "linux-x86")); Cake.CreateDirectory(P.Combine(basedir, "linux-x86"));
Cake.StartProcess("gcc", "-m32 -shared -o BuildOutput/LinuxStubs/" + NativeDeps[i] + " BuildOutput/LinuxStubs/empty.c"); Cake.StartProcess("gcc", "-m32 -shared -o " + NativeDeps[i] + " empty.c");
Cake.StartProcess("gcc", "-m32 -Wl,--no-as-needed -shared -o " + P.Combine(Dir, "linux-x86", NativeDeps[i + 1] + ".so") + " -fPIC -L. -l:BuildOutput/LinuxStubs/" + NativeDeps[i] + ""); Cake.StartProcess("gcc", "-m32 -Wl,--no-as-needed -shared -o " + P.Combine(basedir, "linux-x86", NativeDeps[i + 1] + ".so") + " -fPIC -L. -l:" + NativeDeps[i] + "");
// Generate x64 stubs
Cake.CreateDirectory(P.Combine(basedir, "linux-x64"));
Cake.StartProcess("gcc", "-shared -o " + NativeDeps[i] + " empty.c");
Cake.StartProcess("gcc", "-Wl,--no-as-needed -shared -o " + P.Combine(basedir, "linux-x64", NativeDeps[i + 1] + ".so") + " -fPIC -L. -l:" + NativeDeps[i] + "");
// Generate arm stubs // Generate arm stubs
Cake.CreateDirectory(P.Combine(Dir, "linux-arm")); Cake.CreateDirectory(P.Combine(basedir, "linux-arm"));
Cake.StartProcess("arm-none-eabi-gcc", "-shared -o BuildOutput/LinuxStubs/" + NativeDeps[i] + " BuildOutput/LinuxStubs/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(Dir, "linux-arm", NativeDeps[i + 1] + ".so") + " -fPIC -L. -l:BuildOutput/LinuxStubs/" + 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] + "");
} }
} }
} }

View file

@ -18,7 +18,7 @@ Task("Init")
.Does(() => .Does(() =>
{ {
// Assign some common properties // Assign some common properties
msbuildsettings = msbuildsettings.WithProperty("Version", "3.22.24.0"); msbuildsettings = msbuildsettings.WithProperty("Version", "3.22.24.7");
msbuildsettings = msbuildsettings.WithProperty("Authors", "'GtkSharp Contributors'"); msbuildsettings = msbuildsettings.WithProperty("Authors", "'GtkSharp Contributors'");
msbuildsettings = msbuildsettings.WithProperty("PackageLicenseUrl", "'https://github.com/cra0zy/GtkSharp/blob/cakecore/LICENSE'"); msbuildsettings = msbuildsettings.WithProperty("PackageLicenseUrl", "'https://github.com/cra0zy/GtkSharp/blob/cakecore/LICENSE'");
@ -51,9 +51,11 @@ Task("GenerateLinuxStubs")
.Does(() => .Does(() =>
{ {
CreateDirectory("BuildOutput/LinuxStubs"); CreateDirectory("BuildOutput/LinuxStubs");
FileWriteText("BuildOutput/LinuxStubs/empty.c", ""); System.IO.Directory.SetCurrentDirectory("BuildOutput/LinuxStubs");
FileWriteText("empty.c", "");
foreach(var gassembly in list) foreach(var gassembly in list)
gassembly.GenerateLinuxStubs(); gassembly.GenerateLinuxStubs();
System.IO.Directory.SetCurrentDirectory("../..");
DeleteDirectory("BuildOutput/LinuxStubs", new DeleteDirectorySettings { Recursive = true, Force = true }); DeleteDirectory("BuildOutput/LinuxStubs", new DeleteDirectorySettings { Recursive = true, Force = true });
}); });