diff --git a/build.zig b/build.zig index 427a51e..c121bea 100644 --- a/build.zig +++ b/build.zig @@ -58,12 +58,12 @@ const LibreSslLibs = struct { } if (std.mem.endsWith(u8, child.basename, ".h")) { - const full = try std.mem.concat(b.allocator, u8, &.{ base, child.path }); - defer b.allocator.free(full); + const full = b.pathJoin(&.{ base, child.path }); - self.libcrypto.installHeader(full, child.path); - self.libssl.installHeader(full, child.path); - self.libtls.installHeader(full, child.path); + const path = b.path(full); + self.libcrypto.installHeader(path, child.path); + self.libssl.installHeader(path, child.path); + self.libtls.installHeader(path, child.path); } } } @@ -229,14 +229,19 @@ pub fn libresslBuild( else => @panic("unsupported target OS"), } - const conf_header = switch (tinfo.cpu.arch) { + const conf_header = b.path(switch (tinfo.cpu.arch) { .aarch64, .aarch64_be, .aarch64_32 => source_header_prefix ++ "arch/aarch64/opensslconf.h", .x86 => source_header_prefix ++ "arch/i386/opensslconf.h", .riscv64 => source_header_prefix ++ "arch/riscv64/opensslconf.h", .x86_64 => source_header_prefix ++ "arch/amd64/opensslconf.h", else => @panic("unsupported target CPU arch"), - }; + }); + + const install_conf = b.addInstallHeaderFile(conf_header, "openssl/opensslconf.h"); + libressl_libs.libcrypto.step.dependOn(&install_conf.step); + libressl_libs.libssl.step.dependOn(&install_conf.step); + libressl_libs.libtls.step.dependOn(&install_conf.step); libressl_libs.libcrypto.installHeader(conf_header, "openssl/opensslconf.h"); libressl_libs.libssl.installHeader(conf_header, "openssl/opensslconf.h");