diff options
author | Milan P. Stanić <mps@arvanta.net> | 2019-10-09 10:52:05 +0200 |
---|---|---|
committer | Milan P. Stanić <mps@arvanta.net> | 2019-10-09 11:01:16 +0200 |
commit | 2c0e656d52c4c97324aeaeedeb7724ca98b5ca46 (patch) | |
tree | e8a6e8c6a984f4f0f1f271435059686484d2474f /testing/zig/fix-build.zig.patch | |
parent | c653c42eb37ded50d1c09658b1bd559e61f79785 (diff) | |
download | aports-2c0e656d52c4c97324aeaeedeb7724ca98b5ca46.tar.bz2 aports-2c0e656d52c4c97324aeaeedeb7724ca98b5ca46.tar.xz |
testing/zig: new aport
https://ziglang.org/
general-purpose programming language designed for robustness, optimality, and maintainability
Diffstat (limited to 'testing/zig/fix-build.zig.patch')
-rw-r--r-- | testing/zig/fix-build.zig.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/testing/zig/fix-build.zig.patch b/testing/zig/fix-build.zig.patch new file mode 100644 index 0000000000..fa6f45448a --- /dev/null +++ b/testing/zig/fix-build.zig.patch @@ -0,0 +1,41 @@ +diff --git a/build.zig b/build.zig +index 390f1594..ca78bdf1 100644 +--- a/build.zig ++++ b/build.zig +@@ -373,6 +373,7 @@ fn addLibUserlandStep(b: *Builder, mode: builtin.Mode) void { + artifact.bundle_compiler_rt = true; + artifact.setTarget(builtin.arch, builtin.os, builtin.abi); + artifact.setBuildMode(mode); ++ artifact.force_pic = true; + if (mode != .Debug) { + artifact.strip = true; + } +diff --git a/lib/std/build.zig b/lib/std/build.zig +index c640f6e8..cc062f3a 100644 +--- a/lib/std/build.zig ++++ b/lib/std/build.zig +@@ -1488,6 +1488,9 @@ pub const LibExeObjStep = struct { + + dynamic_linker: ?[]const u8 = null, + ++ /// Position Independent Code ++ force_pic: ?bool = null, ++ + const LinkObject = union(enum) { + StaticPath: []const u8, + OtherStep: *LibExeObjStep, +@@ -2314,6 +2317,14 @@ pub const LibExeObjStep = struct { + try zig_args.append(builder.pathFromRoot(dir)); + } + ++ if (self.force_pic) |pic| { ++ if (pic) { ++ try zig_args.append("-fPIC"); ++ } else { ++ try zig_args.append("-fno-PIC"); ++ } ++ } ++ + if (self.kind == Kind.Test) { + try builder.spawnChild(zig_args.toSliceConst()); + } else { |