Compare commits

..

No commits in common. "master" and "3.8.2" have entirely different histories.

4 changed files with 27 additions and 33 deletions

View File

@ -2,6 +2,8 @@ name: CI
on: on:
push: push:
branches:
- master
pull_request: pull_request:
branches: branches:
- master - master
@ -19,6 +21,7 @@ jobs:
os: ubuntu-latest os: ubuntu-latest
- zig-version: "master" - zig-version: "master"
check-format: true check-format: true
build-options: "-Denable-libsodium=false"
os: ubuntu-latest os: ubuntu-latest
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@ -33,7 +36,7 @@ jobs:
- if: ${{ matrix.check-format }} - if: ${{ matrix.check-format }}
name: Check Formatting name: Check Formatting
run: zig fmt --check . run: zig fmt --ast-check --check .
- name: Build - name: Build
run: zig build ${{ matrix.build-options }} --summary all run: zig build ${{ matrix.build-options }} --summary all

View File

@ -49,7 +49,7 @@ pub fn build(b: *std.Build) void {
const tinfo = target.result; const tinfo = target.result;
switch (tinfo.os.tag) { switch (tinfo.os.tag) {
.windows => { .windows => {
lib.root_module.addCMacro("_WIN32", ""); lib.defineCMacro("_WIN32", null);
lib.addCSourceFiles(.{ lib.addCSourceFiles(.{
.root = src_root, .root = src_root,
.files = win_sources, .files = win_sources,
@ -58,15 +58,15 @@ pub fn build(b: *std.Build) void {
lib.linkSystemLibrary("ws2_32"); lib.linkSystemLibrary("ws2_32");
}, },
else => if (tinfo.isDarwin()) { else => if (tinfo.isDarwin()) {
lib.root_module.addCMacro("DARWIN", ""); lib.defineCMacro("DARWIN", null);
lib.addCSourceFiles(.{ lib.addCSourceFiles(.{
.root = src_root, .root = src_root,
.files = unix_sources, .files = unix_sources,
.flags = cflags, .flags = cflags,
}); });
} else { } else {
lib.root_module.addCMacro("_GNU_SOURCE", ""); lib.defineCMacro("_GNU_SOURCE", null);
lib.root_module.addCMacro("LINUX", ""); lib.defineCMacro("LINUX", null);
lib.addCSourceFiles(.{ lib.addCSourceFiles(.{
.root = src_root, .root = src_root,
.files = unix_sources, .files = unix_sources,
@ -80,7 +80,7 @@ pub fn build(b: *std.Build) void {
}, },
} }
lib.root_module.addCMacro("_REENTRANT", ""); lib.defineCMacro("_REENTRANT", null);
for (install_headers) |header| { for (install_headers) |header| {
lib.installHeader( lib.installHeader(
@ -90,17 +90,17 @@ pub fn build(b: *std.Build) void {
} }
if (tls_dep) |dep| { if (tls_dep) |dep| {
lib.root_module.addCMacro("NATS_HAS_TLS", ""); lib.defineCMacro("NATS_HAS_TLS", null);
lib.root_module.addCMacro("NATS_USE_OPENSSL_1_1", ""); lib.defineCMacro("NATS_USE_OPENSSL_1_1", null);
if (tls_verify) if (tls_verify)
lib.root_module.addCMacro("NATS_FORCE_HOST_VERIFICATION", ""); lib.defineCMacro("NATS_FORCE_HOST_VERIFICATION", null);
lib.linkLibrary(dep.artifact("ssl")); lib.linkLibrary(dep.artifact("ssl"));
} }
if (protobuf_runtime) |dep| { if (protobuf_runtime) |dep| {
lib.addIncludePath(upstream.path("deps")); lib.addIncludePath(upstream.path("deps"));
lib.addIncludePath(upstream.path("stan")); lib.addIncludePath(upstream.path("stan"));
lib.root_module.addCMacro("NATS_HAS_STREAMING", ""); lib.defineCMacro("NATS_HAS_STREAMING", null);
lib.addCSourceFiles(.{ lib.addCSourceFiles(.{
.root = src_root, .root = src_root,
@ -111,7 +111,7 @@ pub fn build(b: *std.Build) void {
} }
if (libsodium_dep) |dep| { if (libsodium_dep) |dep| {
lib.root_module.addCMacro("NATS_USE_LIBSODIUM", ""); lib.defineCMacro("NATS_USE_LIBSODIUM", null);
// yep // yep
lib.linkLibrary(dep.artifact(if (tinfo.isMinGW()) "libsodium-static" else "sodium")); lib.linkLibrary(dep.artifact(if (tinfo.isMinGW()) "libsodium-static" else "sodium"));
} }
@ -129,14 +129,6 @@ const common_sources: []const []const u8 = &.{
"asynccb.c", "asynccb.c",
"comsock.c", "comsock.c",
"crypto.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", "js.c",
"kv.c", "kv.c",
"nats.c", "nats.c",

View File

@ -1,15 +1,15 @@
.{ .{
.name = "nats_c", .name = "nats_c",
.version = "3.9.1", .version = "3.8.2",
.minimum_zig_version = "0.12.0", .minimum_zig_version = "0.12.0",
.dependencies = .{ .dependencies = .{
.nats_c = .{ .nats_c = .{
.url = "git+https://github.com/nats-io/nats.c?ref=v3.9.1#97056709d07fd83700f459e7ea9ea2e5c34ff6bb", .url = "git+https://github.com/nats-io/nats.c?ref=v3.8.2#d58bb6b5bf205684bb72bb28407687aacf6ff498",
.hash = "12203347177845724e82819c0243caa502b054427c75f29e7f22988c67f5a91bd504", .hash = "12207f10bd4b38309c79eadf22dfb3d9f134f1359dda01f9df6d9b42734ee2330b72",
}, },
.libressl = .{ .libressl = .{
.url = "git+https://github.com/allyourcodebase/libressl.git?ref=4.0.0+1#fd0fe777153a75217e97ba22cd8b32005bb90d08", .url = "git+https://github.com/allyourcodebase/libressl.git?ref=3.9.2#a373b82991947b694196ee630bd6a648d71e2b3f",
.hash = "1220c6521dd6d37f0426fbe6c3b3c3f4282f28495311abc08fb4cebf21ea2346ba2f", .hash = "1220b1536d43ed8ce79ee05c53929f90b67dd299e61dfa249fa8f476f17eee46a95f",
.lazy = true, .lazy = true,
}, },
.protobuf_c = .{ .protobuf_c = .{
@ -18,8 +18,8 @@
.lazy = true, .lazy = true,
}, },
.libsodium = .{ .libsodium = .{
.url = "git+https://github.com/jedisct1/libsodium.git?ref=stable#59a98bc7f9d507175f551a53bfc0b2081f06e3ba", .url = "git+https://github.com/jedisct1/libsodium.git?ref=1.0.20-RELEASE#9511c982fb1d046470a8b42aa36556cdb7da15de",
.hash = "1220297067945b08f44a20b3b20e5e0fd39e178a30d96d4a3531fed5999252f52eea", .hash = "1220d265dc673167ffe4a3cefe2840893d2910cfd773cfb1893ff768d5f1351d2a1f",
.lazy = true, .lazy = true,
}, },
}, },

View File

@ -19,7 +19,7 @@ First, update your `build.zig.zon`:
```sh ```sh
# Initialize a `zig build` project if you haven't already # Initialize a `zig build` project if you haven't already
zig init zig init
# replace <refname> with the version you want to use, e.g. 3.9.1 # replace <refname> with the version you want to use, e.g. 3.8.2
zig fetch --save git+https://github.com/allyourcodebase/nats.c.git#<refname> zig fetch --save git+https://github.com/allyourcodebase/nats.c.git#<refname>
``` ```
@ -43,16 +43,15 @@ The NATS.c library has optional dependencies:
- [`libressl 3.9.2`][libressl] when building with `enable-tls` - [`libressl 3.9.2`][libressl] when building with `enable-tls`
- [`protobuf-c 1.5.0`][protobuf-c] when building with `enable-streaming` - [`protobuf-c 1.5.0`][protobuf-c] when building with `enable-streaming`
- [`libsodium stable branch`][libsodium] when building with `enable-libsodium` - [`libsodium 1.0.20`][libsodium] when building with `enable-libsodium`
These dependencies are currently automatically retrieved and compiled as static libraries by the Zig build system. These dependencies are currently automatically retrieved and compiled as static libraries by the Zig build system.
## Zig Version Support Matrix ## Version Support Matrix
| Refname | NATS.c Version | Zig `0.12.x` | Zig `0.13.x` | Zig `0.14.0-dev` | | Refname | NATS.c Version | Zig `0.12.x` | Zig `0.13.x` | Zig `0.14.0-dev` |
|-----------|----------------|--------------|--------------|------------------| |----------|----------------|--------------|--------------|------------------|
| `3.9.1` | `3.9.1` | ✅ | ✅ | ✅ | | `3.8.2` | `3.8.2` | ✅ | ✅ | with `-Denable-libsodium=false` |
| `3.8.2+1` | `3.8.2` | ✅ | ✅ | ✅ |
[nats.c]: https://github.com/nats-io/nats.c [nats.c]: https://github.com/nats-io/nats.c
[libressl]: https://github.com/allyourcodebase/libressl [libressl]: https://github.com/allyourcodebase/libressl