commit 9c8c9b7cc82d73293c5051f8b020e984eefb9e5a (tree)
parent 4cbf74bd9b839501a4fd4bc5f39a25e216237b3c
Author: Carl Ã…stholm <carl@astholm.se>
Date: Mon, 8 Jan 2024 18:57:37 +0100
Build: Use `LazyPath` for version scripts
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig
@@ -25,7 +25,7 @@ root_module: Module,
name: []const u8,
linker_script: ?LazyPath = null,
-version_script: ?[]const u8 = null,
+version_script: ?LazyPath = null,
out_filename: []const u8,
out_lib_filename: []const u8,
linkage: ?Linkage = null,
@@ -481,6 +481,12 @@ pub fn setLinkerScript(self: *Compile, source: LazyPath) void {
source.addStepDependencies(&self.step);
}
+pub fn setVersionScript(self: *Compile, source: LazyPath) void {
+ const b = self.step.owner;
+ self.version_script = source.dupe(b);
+ source.addStepDependencies(&self.step);
+}
+
pub fn forceUndefinedSymbol(self: *Compile, symbol_name: []const u8) void {
const b = self.step.owner;
self.force_undefined_symbols.put(b.dupe(symbol_name), {}) catch @panic("OOM");
@@ -1443,7 +1449,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
if (self.version_script) |version_script| {
try zig_args.append("--version-script");
- try zig_args.append(b.pathFromRoot(version_script));
+ try zig_args.append(version_script.getPath(b));
}
if (self.kind == .@"test") {