build.zig: fix erroneous cwd references

This worked fine building libressl by itself, but it references the
wrong directory when executed as a dependency of another library. The
builder object seems to have its build root set correctly, so use
that.
This commit is contained in:
torque 2023-08-31 21:45:39 -07:00
parent 6582b5efe9
commit dd538e896b
Signed by: torque
SSH Key Fingerprint: SHA256:nCrXefBNo6EbjNSQhv0nXmEg/VuNq3sMF5b8zETw3Tk

View File

@ -205,8 +205,8 @@ pub fn libresslBuild(
// TODO: can we just add this as an install header instead? It's needed during this
// build. This mutates the source tree, which is really gross.
const include_dir = try std.fs.cwd().openDir(install_header_prefix ++ "openssl", .{});
try std.fs.cwd().copyFile(header, include_dir, "opensslconf.h", .{});
const include_dir = try b.build_root.handle.openDir(install_header_prefix ++ "openssl", .{});
try b.build_root.handle.copyFile(header, include_dir, "opensslconf.h", .{});
try header_search(
b,
@ -312,7 +312,7 @@ pub fn header_search(
base: []const u8,
skiplist: []const SkipSpec,
) !void {
const dir = try std.fs.cwd().openIterableDir(base, .{});
const dir = try b.build_root.handle.openIterableDir(base, .{});
var walker = try dir.walk(b.allocator);
defer walker.deinit();