Compare commits

...

4 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
4 changed files with 30 additions and 23 deletions

View File

@ -2,8 +2,6 @@ name: CI
on: on:
push: push:
branches:
- master
pull_request: pull_request:
branches: branches:
- master - master
@ -35,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+1", .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+1#02abfefee4e4eda28ce53c637b3c0d204ace8a6d", .url = "git+https://github.com/allyourcodebase/libressl.git?ref=4.0.0+1#fd0fe777153a75217e97ba22cd8b32005bb90d08",
.hash = "12201f5cc06c88f191696106723797449baacb6ea38b07b6cf31c18c0382a6bea33e", .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=stable#3c6da4b8c27c7d546746eadabc9e2dd6c1fdfc2c", .url = "git+https://github.com/jedisct1/libsodium.git?ref=stable#59a98bc7f9d507175f551a53bfc0b2081f06e3ba",
.hash = "12207667c06c40826838b57922ec9c7f90ab2613bf317c6717d0ed2cdf6ca91df718", .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+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> 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. 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+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 [nats.c]: https://github.com/nats-io/nats.c
[libressl]: https://github.com/allyourcodebase/libressl [libressl]: https://github.com/allyourcodebase/libressl