build: handle architecture include more gracefully
The "openssl/opensslconf.h" header is copied from an architecture-specific source file, which means that specific path is not valid within the source tree. I previously hacked around this by copying the file within the source tree, but that had the major downside of invalidating various cache layers after the copy was performed. Since we install this header with the right name, a slightly better solution, hopefully, is to add the header install path as an include directory. In theory, this will not invalidate any caching and improve the build process slightly.
This commit is contained in:
parent
e2db88c634
commit
e68d5f484b
14
build.zig
14
build.zig
@ -243,13 +243,6 @@ pub fn libresslBuild(
|
|||||||
else => @panic("unsupported target CPU arch"),
|
else => @panic("unsupported target CPU arch"),
|
||||||
};
|
};
|
||||||
|
|
||||||
try b.build_root.handle.copyFile(
|
|
||||||
conf_header,
|
|
||||||
b.build_root.handle,
|
|
||||||
source_header_prefix ++ "openssl/opensslconf.h",
|
|
||||||
.{},
|
|
||||||
);
|
|
||||||
|
|
||||||
libressl_libs.libcrypto.installHeader(conf_header, "openssl/opensslconf.h");
|
libressl_libs.libcrypto.installHeader(conf_header, "openssl/opensslconf.h");
|
||||||
libressl_libs.libssl.installHeader(conf_header, "openssl/opensslconf.h");
|
libressl_libs.libssl.installHeader(conf_header, "openssl/opensslconf.h");
|
||||||
libressl_libs.libtls.installHeader(conf_header, "openssl/opensslconf.h");
|
libressl_libs.libtls.installHeader(conf_header, "openssl/opensslconf.h");
|
||||||
@ -296,6 +289,13 @@ pub fn libresslBuild(
|
|||||||
else => @panic("unsupported target CPU arch"),
|
else => @panic("unsupported target CPU arch"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add the header install path to the include path so that compilation will pick
|
||||||
|
// up "openssl/opensslconf.h". This is added last to avoid interfering with the
|
||||||
|
// somewhat messy include handling that libressl does.
|
||||||
|
libressl_libs.libcrypto.addIncludePath(.{ .path = b.getInstallPath(.header, "") });
|
||||||
|
libressl_libs.libssl.addIncludePath(.{ .path = b.getInstallPath(.header, "") });
|
||||||
|
libressl_libs.libtls.addIncludePath(.{ .path = b.getInstallPath(.header, "") });
|
||||||
|
|
||||||
libressl_libs.libssl.linkLibrary(libressl_libs.libcrypto);
|
libressl_libs.libssl.linkLibrary(libressl_libs.libcrypto);
|
||||||
|
|
||||||
// cmake builds libtls with libcrypto and libssl symbols jammed into it. However,
|
// cmake builds libtls with libcrypto and libssl symbols jammed into it. However,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user