Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
6555477c31 | |||
be5a084d6e | |||
b585eecc38 | |||
dd33fa168c |
4
.github/workflows/ci.yaml
vendored
4
.github/workflows/ci.yaml
vendored
@ -2,8 +2,6 @@ name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
@ -35,7 +33,7 @@ jobs:
|
||||
|
||||
- if: ${{ matrix.check-format }}
|
||||
name: Check Formatting
|
||||
run: zig fmt --ast-check --check .
|
||||
run: zig fmt --check .
|
||||
|
||||
- name: Build
|
||||
run: zig build ${{ matrix.build-options }} --summary all
|
||||
|
28
build.zig
28
build.zig
@ -49,7 +49,7 @@ pub fn build(b: *std.Build) void {
|
||||
const tinfo = target.result;
|
||||
switch (tinfo.os.tag) {
|
||||
.windows => {
|
||||
lib.defineCMacro("_WIN32", null);
|
||||
lib.root_module.addCMacro("_WIN32", "");
|
||||
lib.addCSourceFiles(.{
|
||||
.root = src_root,
|
||||
.files = win_sources,
|
||||
@ -58,15 +58,15 @@ pub fn build(b: *std.Build) void {
|
||||
lib.linkSystemLibrary("ws2_32");
|
||||
},
|
||||
else => if (tinfo.isDarwin()) {
|
||||
lib.defineCMacro("DARWIN", null);
|
||||
lib.root_module.addCMacro("DARWIN", "");
|
||||
lib.addCSourceFiles(.{
|
||||
.root = src_root,
|
||||
.files = unix_sources,
|
||||
.flags = cflags,
|
||||
});
|
||||
} else {
|
||||
lib.defineCMacro("_GNU_SOURCE", null);
|
||||
lib.defineCMacro("LINUX", null);
|
||||
lib.root_module.addCMacro("_GNU_SOURCE", "");
|
||||
lib.root_module.addCMacro("LINUX", "");
|
||||
lib.addCSourceFiles(.{
|
||||
.root = src_root,
|
||||
.files = unix_sources,
|
||||
@ -80,7 +80,7 @@ pub fn build(b: *std.Build) void {
|
||||
},
|
||||
}
|
||||
|
||||
lib.defineCMacro("_REENTRANT", null);
|
||||
lib.root_module.addCMacro("_REENTRANT", "");
|
||||
|
||||
for (install_headers) |header| {
|
||||
lib.installHeader(
|
||||
@ -90,17 +90,17 @@ pub fn build(b: *std.Build) void {
|
||||
}
|
||||
|
||||
if (tls_dep) |dep| {
|
||||
lib.defineCMacro("NATS_HAS_TLS", null);
|
||||
lib.defineCMacro("NATS_USE_OPENSSL_1_1", null);
|
||||
lib.root_module.addCMacro("NATS_HAS_TLS", "");
|
||||
lib.root_module.addCMacro("NATS_USE_OPENSSL_1_1", "");
|
||||
if (tls_verify)
|
||||
lib.defineCMacro("NATS_FORCE_HOST_VERIFICATION", null);
|
||||
lib.root_module.addCMacro("NATS_FORCE_HOST_VERIFICATION", "");
|
||||
lib.linkLibrary(dep.artifact("ssl"));
|
||||
}
|
||||
|
||||
if (protobuf_runtime) |dep| {
|
||||
lib.addIncludePath(upstream.path("deps"));
|
||||
lib.addIncludePath(upstream.path("stan"));
|
||||
lib.defineCMacro("NATS_HAS_STREAMING", null);
|
||||
lib.root_module.addCMacro("NATS_HAS_STREAMING", "");
|
||||
|
||||
lib.addCSourceFiles(.{
|
||||
.root = src_root,
|
||||
@ -111,7 +111,7 @@ pub fn build(b: *std.Build) void {
|
||||
}
|
||||
|
||||
if (libsodium_dep) |dep| {
|
||||
lib.defineCMacro("NATS_USE_LIBSODIUM", null);
|
||||
lib.root_module.addCMacro("NATS_USE_LIBSODIUM", "");
|
||||
// yep
|
||||
lib.linkLibrary(dep.artifact(if (tinfo.isMinGW()) "libsodium-static" else "sodium"));
|
||||
}
|
||||
@ -129,6 +129,14 @@ const common_sources: []const []const u8 = &.{
|
||||
"asynccb.c",
|
||||
"comsock.c",
|
||||
"crypto.c",
|
||||
"dispatch.c",
|
||||
"glib/glib.c",
|
||||
"glib/glib_async_cb.c",
|
||||
"glib/glib_dispatch_pool.c",
|
||||
"glib/glib_gc.c",
|
||||
"glib/glib_last_error.c",
|
||||
"glib/glib_ssl.c",
|
||||
"glib/glib_timer.c",
|
||||
"js.c",
|
||||
"kv.c",
|
||||
"nats.c",
|
||||
|
@ -1,15 +1,15 @@
|
||||
.{
|
||||
.name = "nats_c",
|
||||
.version = "3.8.2+1",
|
||||
.version = "3.9.1",
|
||||
.minimum_zig_version = "0.12.0",
|
||||
.dependencies = .{
|
||||
.nats_c = .{
|
||||
.url = "git+https://github.com/nats-io/nats.c?ref=v3.8.2#d58bb6b5bf205684bb72bb28407687aacf6ff498",
|
||||
.hash = "12207f10bd4b38309c79eadf22dfb3d9f134f1359dda01f9df6d9b42734ee2330b72",
|
||||
.url = "git+https://github.com/nats-io/nats.c?ref=v3.9.1#97056709d07fd83700f459e7ea9ea2e5c34ff6bb",
|
||||
.hash = "12203347177845724e82819c0243caa502b054427c75f29e7f22988c67f5a91bd504",
|
||||
},
|
||||
.libressl = .{
|
||||
.url = "git+https://github.com/allyourcodebase/libressl.git?ref=3.9.2+1#02abfefee4e4eda28ce53c637b3c0d204ace8a6d",
|
||||
.hash = "12201f5cc06c88f191696106723797449baacb6ea38b07b6cf31c18c0382a6bea33e",
|
||||
.url = "git+https://github.com/allyourcodebase/libressl.git?ref=4.0.0+1#fd0fe777153a75217e97ba22cd8b32005bb90d08",
|
||||
.hash = "1220c6521dd6d37f0426fbe6c3b3c3f4282f28495311abc08fb4cebf21ea2346ba2f",
|
||||
.lazy = true,
|
||||
},
|
||||
.protobuf_c = .{
|
||||
@ -18,8 +18,8 @@
|
||||
.lazy = true,
|
||||
},
|
||||
.libsodium = .{
|
||||
.url = "git+https://github.com/jedisct1/libsodium.git?ref=stable#3c6da4b8c27c7d546746eadabc9e2dd6c1fdfc2c",
|
||||
.hash = "12207667c06c40826838b57922ec9c7f90ab2613bf317c6717d0ed2cdf6ca91df718",
|
||||
.url = "git+https://github.com/jedisct1/libsodium.git?ref=stable#59a98bc7f9d507175f551a53bfc0b2081f06e3ba",
|
||||
.hash = "1220297067945b08f44a20b3b20e5e0fd39e178a30d96d4a3531fed5999252f52eea",
|
||||
.lazy = true,
|
||||
},
|
||||
},
|
||||
|
@ -19,7 +19,7 @@ First, update your `build.zig.zon`:
|
||||
```sh
|
||||
# Initialize a `zig build` project if you haven't already
|
||||
zig init
|
||||
# replace <refname> with the version you want to use, e.g. 3.8.2+1
|
||||
# replace <refname> with the version you want to use, e.g. 3.9.1
|
||||
zig fetch --save git+https://github.com/allyourcodebase/nats.c.git#<refname>
|
||||
```
|
||||
|
||||
@ -47,11 +47,12 @@ The NATS.c library has optional dependencies:
|
||||
|
||||
These dependencies are currently automatically retrieved and compiled as static libraries by the Zig build system.
|
||||
|
||||
## Version Support Matrix
|
||||
## Zig Version Support Matrix
|
||||
|
||||
| Refname | NATS.c Version | Zig `0.12.x` | Zig `0.13.x` | Zig `0.14.0-dev` |
|
||||
|-----------|----------------|--------------|--------------|------------------|
|
||||
| `3.8.2+1` | `3.8.2+1` | ✅ | ✅ | ✅ |
|
||||
| `3.9.1` | `3.9.1` | ✅ | ✅ | ✅ |
|
||||
| `3.8.2+1` | `3.8.2` | ✅ | ✅ | ✅ |
|
||||
|
||||
[nats.c]: https://github.com/nats-io/nats.c
|
||||
[libressl]: https://github.com/allyourcodebase/libressl
|
||||
|
Loading…
x
Reference in New Issue
Block a user