Compare commits

...

8 Commits

Author SHA1 Message Date
6555477c31
build: fix for zig-0.14 dev
Some checks failed
CI / build (macos-latest, 0.13.0) (push) Has been cancelled
CI / build (true, ubuntu-latest, master) (push) Has been cancelled
CI / build (ubuntu-latest, 0.12.1) (push) Has been cancelled
CI / build (ubuntu-latest, 0.13.0) (push) Has been cancelled
CI / build (windows-latest, 0.13.0) (push) Has been cancelled
`defineCMacro` was removed. Dependencies had to be updated for this as
well.
2025-02-03 23:49:01 -07:00
be5a084d6e
readme: update with 3.9.1 info 2024-12-05 22:51:06 -07:00
b585eecc38
build: update to nats.c 3.9.1 and update dependencies
This updates libressl-portable to v4.0.0 and it also bumps the
libsodium stable ref to the current tip of the branch.
2024-12-05 22:51:06 -07:00
dd33fa168c
ci: run on all branches 2024-11-26 23:03:16 -07:00
b0e28ff9cb
package: bump version
Some checks failed
CI / build (macos-latest, 0.13.0) (push) Has been cancelled
CI / build (true, ubuntu-latest, master) (push) Has been cancelled
CI / build (ubuntu-latest, 0.12.1) (push) Has been cancelled
CI / build (ubuntu-latest, 0.13.0) (push) Has been cancelled
CI / build (windows-latest, 0.13.0) (push) Has been cancelled
2024-10-14 19:23:42 -06:00
538c40246e
ci: reenable libsodium on zig master build 2024-10-14 19:15:16 -06:00
2c3124598e
deps: update libressl to 3.9.2+1
This change doesn't impact this library, but since the libsodium
dependency also updated, we might as well bump this now also.
2024-10-14 19:09:06 -06:00
Coleman McFarland
5e0cdc81ed build fix: update libsodium to get a build definition without aarch64_32
On recommendation from the libsodium dev, thir commit is from the "stable"
branch of libsodium, not a release tag. Update this to a release when one
containing this fix is available.
2024-10-14 18:56:24 -04:00
4 changed files with 33 additions and 27 deletions

View File

@ -2,8 +2,6 @@ name: CI
on: on:
push: push:
branches:
- master
pull_request: pull_request:
branches: branches:
- master - master
@ -21,7 +19,6 @@ 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:
@ -36,7 +33,7 @@ jobs:
- if: ${{ matrix.check-format }} - if: ${{ matrix.check-format }}
name: Check Formatting name: Check Formatting
run: zig fmt --ast-check --check . run: zig fmt --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.defineCMacro("_WIN32", null); lib.root_module.addCMacro("_WIN32", "");
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.defineCMacro("DARWIN", null); lib.root_module.addCMacro("DARWIN", "");
lib.addCSourceFiles(.{ lib.addCSourceFiles(.{
.root = src_root, .root = src_root,
.files = unix_sources, .files = unix_sources,
.flags = cflags, .flags = cflags,
}); });
} else { } else {
lib.defineCMacro("_GNU_SOURCE", null); lib.root_module.addCMacro("_GNU_SOURCE", "");
lib.defineCMacro("LINUX", null); lib.root_module.addCMacro("LINUX", "");
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.defineCMacro("_REENTRANT", null); lib.root_module.addCMacro("_REENTRANT", "");
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.defineCMacro("NATS_HAS_TLS", null); lib.root_module.addCMacro("NATS_HAS_TLS", "");
lib.defineCMacro("NATS_USE_OPENSSL_1_1", null); lib.root_module.addCMacro("NATS_USE_OPENSSL_1_1", "");
if (tls_verify) if (tls_verify)
lib.defineCMacro("NATS_FORCE_HOST_VERIFICATION", null); lib.root_module.addCMacro("NATS_FORCE_HOST_VERIFICATION", "");
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.defineCMacro("NATS_HAS_STREAMING", null); lib.root_module.addCMacro("NATS_HAS_STREAMING", "");
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.defineCMacro("NATS_USE_LIBSODIUM", null); lib.root_module.addCMacro("NATS_USE_LIBSODIUM", "");
// 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,6 +129,14 @@ 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.8.2", .version = "3.9.1",
.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.8.2#d58bb6b5bf205684bb72bb28407687aacf6ff498", .url = "git+https://github.com/nats-io/nats.c?ref=v3.9.1#97056709d07fd83700f459e7ea9ea2e5c34ff6bb",
.hash = "12207f10bd4b38309c79eadf22dfb3d9f134f1359dda01f9df6d9b42734ee2330b72", .hash = "12203347177845724e82819c0243caa502b054427c75f29e7f22988c67f5a91bd504",
}, },
.libressl = .{ .libressl = .{
.url = "git+https://github.com/allyourcodebase/libressl.git?ref=3.9.2#a373b82991947b694196ee630bd6a648d71e2b3f", .url = "git+https://github.com/allyourcodebase/libressl.git?ref=4.0.0+1#fd0fe777153a75217e97ba22cd8b32005bb90d08",
.hash = "1220b1536d43ed8ce79ee05c53929f90b67dd299e61dfa249fa8f476f17eee46a95f", .hash = "1220c6521dd6d37f0426fbe6c3b3c3f4282f28495311abc08fb4cebf21ea2346ba2f",
.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=1.0.20-RELEASE#9511c982fb1d046470a8b42aa36556cdb7da15de", .url = "git+https://github.com/jedisct1/libsodium.git?ref=stable#59a98bc7f9d507175f551a53bfc0b2081f06e3ba",
.hash = "1220d265dc673167ffe4a3cefe2840893d2910cfd773cfb1893ff768d5f1351d2a1f", .hash = "1220297067945b08f44a20b3b20e5e0fd39e178a30d96d4a3531fed5999252f52eea",
.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.8.2 # 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> zig fetch --save git+https://github.com/allyourcodebase/nats.c.git#<refname>
``` ```
@ -43,15 +43,16 @@ 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 1.0.20`][libsodium] when building with `enable-libsodium` - [`libsodium stable branch`][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.
## Version Support Matrix ## Zig 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.8.2` | `3.8.2` | ✅ | ✅ | with `-Denable-libsodium=false` | | `3.9.1` | `3.9.1` | ✅ | ✅ | ✅ |
| `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