LukasKastern/boringssl
boringssl packaged with Zig
b026ea2f0e2c900ed88e10de39884167a484081b.tar.gz
5622da92e1e7bacb5d0785ff5650a5a23b143b84.tar.gz
3e609dff44f5ddfc388b9498f72274466b8a677b
31622af89d7e90af49d2e610d7dcdf36f8e23c7a
This is BoringSSL, packaged for Zig.
First, update your build.zig.zon
:
# Initialize a `zig build` project if you haven't already
zig init
zig fetch --save git+https://github.com/lukaskastern/boringssl.git
You can then import boringssl
in your build.zig
with:
const boringssl_dependency = b.dependency("boringssl", .{
.target = target,
.optimize = optimize,
});
your_exe.linkLibrary(boringssl_dependency.artifact("bcm"));
your_exe.linkLibrary(boringssl_dependency.artifact("ssl"));
your_exe.linkLibrary(boringssl_dependency.artifact("crypto"));
And use the library like this:
const ssl = @cImport({
@cInclude("openssl/ssl.h");
});
const ctx = ssl.EVP_CIPHER_CTX_new();
...
...
At the moment only x86_64-windows-gnu is functional. MSVC doesn't work!
GNU doesn't seem an official target by boringssl for windows which is why we need the patch.
The target zig version is 0.14.0
We build boringssl by utilizing the sources.json it provides.
This file is used to generate the build graph. Sadly I haven't found a way to access it directly from the dependency.
Meaning it has to be manually copied into sources.json in this repository.