From dd538e896b2306e99e83cdc58fd5ae82463a4480 Mon Sep 17 00:00:00 2001 From: torque Date: Thu, 31 Aug 2023 21:45:39 -0700 Subject: [PATCH] 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. --- build.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.zig b/build.zig index 90f7090..1dcf28d 100644 --- a/build.zig +++ b/build.zig @@ -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();