build: link LibreSSL for SSL support
I don't have a single clue in heck if this actually works, but it at least does compile. At some point I will probably add a test or two to find out how broken this is.
This commit is contained in:
parent
741af6f976
commit
29966dc838
@ -1,5 +1,10 @@
|
|||||||
.{
|
.{
|
||||||
.name = "nats-client",
|
.name = "nats-client",
|
||||||
.version = "0.0.1",
|
.version = "0.0.1",
|
||||||
.dependencies = .{},
|
.dependencies = .{
|
||||||
|
.libressl = .{
|
||||||
|
.url = "https://github.com/epicyclic-dev/LibreSSL-portable/archive/cedfc5580d2e665d66d8f357469e472bc12a099b.tar.gz",
|
||||||
|
.hash = "12204315709cc148a4c51661aa76db76bbe5192fbc762336f405c9069e95c5abf1ec",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,11 @@ pub fn nats_c_lib(
|
|||||||
// lib.addIncludePath(.{ .path = nats_src_prefix ++ "stan" });
|
// lib.addIncludePath(.{ .path = nats_src_prefix ++ "stan" });
|
||||||
// lib.addCSourceFiles(&streaming_sources, &cflags);
|
// lib.addCSourceFiles(&streaming_sources, &cflags);
|
||||||
|
|
||||||
|
const ssl_dep = b.dependency("libressl", .{
|
||||||
|
.target = options.target,
|
||||||
|
.optimize = options.optimize,
|
||||||
|
});
|
||||||
|
|
||||||
const tinfo = lib.target_info.target;
|
const tinfo = lib.target_info.target;
|
||||||
switch (tinfo.os.tag) {
|
switch (tinfo.os.tag) {
|
||||||
.windows => {
|
.windows => {
|
||||||
@ -48,18 +53,23 @@ pub fn nats_c_lib(
|
|||||||
lib.addCSourceFiles(&unix_sources, &cflags);
|
lib.addCSourceFiles(&unix_sources, &cflags);
|
||||||
lib.defineCMacro("_GNU_SOURCE", null);
|
lib.defineCMacro("_GNU_SOURCE", null);
|
||||||
lib.defineCMacro("LINUX", null);
|
lib.defineCMacro("LINUX", null);
|
||||||
// may need to link pthread and rt. Not sure if those are inluded with linkLibC
|
// may need to link pthread and rt. Not sure if those are included with linkLibC
|
||||||
lib.linkSystemLibrary("pthread");
|
lib.linkSystemLibrary("pthread");
|
||||||
lib.linkSystemLibrary("rt");
|
lib.linkSystemLibrary("rt");
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lib.defineCMacro("NATS_HAS_TLS", null);
|
||||||
|
lib.defineCMacro("NATS_USE_OPENSSL_1_1", null);
|
||||||
|
lib.defineCMacro("NATS_FORCE_HOST_VERIFICATION", null);
|
||||||
lib.defineCMacro("_REENTRANT", null);
|
lib.defineCMacro("_REENTRANT", null);
|
||||||
|
|
||||||
inline for (install_headers) |header| {
|
inline for (install_headers) |header| {
|
||||||
lib.installHeader(nats_src_prefix ++ header, "nats/" ++ header);
|
lib.installHeader(nats_src_prefix ++ header, "nats/" ++ header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lib.linkLibrary(ssl_dep.artifact("ssl"));
|
||||||
|
|
||||||
b.installArtifact(lib);
|
b.installArtifact(lib);
|
||||||
|
|
||||||
return lib;
|
return lib;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user