mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
build: dupe library, rpath, and framework LazyPaths
Without duping, users could get some unexpected behavior if they used a string with a lifetime that didn't persist throughout the full build, i.e. if it wasn't heap allocated, or if it was explicitly freed.
This commit is contained in:
parent
89d660c3eb
commit
76f7b40e15
1 changed files with 6 additions and 3 deletions
|
|
@ -1072,17 +1072,20 @@ pub fn addConfigHeader(self: *Compile, config_header: *Step.ConfigHeader) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addLibraryPath(self: *Compile, directory_source: LazyPath) void {
|
pub fn addLibraryPath(self: *Compile, directory_source: LazyPath) void {
|
||||||
self.lib_paths.append(directory_source) catch @panic("OOM");
|
const b = self.step.owner;
|
||||||
|
self.lib_paths.append(directory_source.dupe(b)) catch @panic("OOM");
|
||||||
directory_source.addStepDependencies(&self.step);
|
directory_source.addStepDependencies(&self.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addRPath(self: *Compile, directory_source: LazyPath) void {
|
pub fn addRPath(self: *Compile, directory_source: LazyPath) void {
|
||||||
self.rpaths.append(directory_source) catch @panic("OOM");
|
const b = self.step.owner;
|
||||||
|
self.rpaths.append(directory_source.dupe(b)) catch @panic("OOM");
|
||||||
directory_source.addStepDependencies(&self.step);
|
directory_source.addStepDependencies(&self.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void {
|
pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void {
|
||||||
self.framework_dirs.append(directory_source) catch @panic("OOM");
|
const b = self.step.owner;
|
||||||
|
self.framework_dirs.append(directory_source.dupe(b)) catch @panic("OOM");
|
||||||
directory_source.addStepDependencies(&self.step);
|
directory_source.addStepDependencies(&self.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue