Compare commits
No commits in common. "32de7d35d9bf4c2a618fc514bc897568104c9f05" and "8d3d0a7df3baedf25f3bf581a326030768b2885a" have entirely different histories.
32de7d35d9
...
8d3d0a7df3
40
.github/workflows/ci.yaml
vendored
40
.github/workflows/ci.yaml
vendored
@ -1,40 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
zig-version: ["0.13.0"]
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
include:
|
|
||||||
- zig-version: "0.12.1"
|
|
||||||
os: ubuntu-latest
|
|
||||||
- zig-version: "master"
|
|
||||||
check-format: true
|
|
||||||
os: ubuntu-latest
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Zig
|
|
||||||
uses: mlugg/setup-zig@v1
|
|
||||||
with:
|
|
||||||
version: ${{ matrix.zig-version }}
|
|
||||||
|
|
||||||
- if: ${{ matrix.check-format }}
|
|
||||||
name: Check Formatting
|
|
||||||
run: zig fmt --ast-check --check .
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: zig build --summary all
|
|
@ -24,7 +24,9 @@ pub fn build(b: *std.Build) void {
|
|||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
const cflags: []const []const u8 = &.{};
|
const cflags: []const []const u8 = &.{
|
||||||
|
"-fno-sanitize=undefined",
|
||||||
|
};
|
||||||
|
|
||||||
const src_root = upstream.path("src");
|
const src_root = upstream.path("src");
|
||||||
|
|
||||||
@ -74,7 +76,7 @@ pub fn build(b: *std.Build) void {
|
|||||||
|
|
||||||
for (install_headers) |header| {
|
for (install_headers) |header| {
|
||||||
lib.installHeader(
|
lib.installHeader(
|
||||||
upstream.path(b.pathJoin(&.{ "src", header })),
|
src_root.path(b, header),
|
||||||
b.pathJoin(&.{ "nats", header }),
|
b.pathJoin(&.{ "nats", header }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,10 @@
|
|||||||
.libressl = .{
|
.libressl = .{
|
||||||
.url = "git+https://github.com/allyourcodebase/libressl.git?ref=3.9.2#a373b82991947b694196ee630bd6a648d71e2b3f",
|
.url = "git+https://github.com/allyourcodebase/libressl.git?ref=3.9.2#a373b82991947b694196ee630bd6a648d71e2b3f",
|
||||||
.hash = "1220b1536d43ed8ce79ee05c53929f90b67dd299e61dfa249fa8f476f17eee46a95f",
|
.hash = "1220b1536d43ed8ce79ee05c53929f90b67dd299e61dfa249fa8f476f17eee46a95f",
|
||||||
.lazy = true,
|
|
||||||
},
|
},
|
||||||
.protobuf_c = .{
|
.protobuf_c = .{
|
||||||
.url = "git+https://github.com/allyourcodebase/protobuf-c.git?ref=1.5.0#ae7587481485e615d3866861703d41d3efc22b82",
|
.url = "git+https://github.com/allyourcodebase/protobuf-c.git?ref=master#a84d562c7f3fa6ba7d6226a731371a54cab18b40",
|
||||||
.hash = "1220f454bf9412333c5d21b8c21b323fc7e4e37b02341bf2fa49f110b8bc5d97c972",
|
.hash = "1220621919007f94cb09c425ab0df5982f10c7effd0005a275046a608183574575fc",
|
||||||
.lazy = true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.paths = .{
|
.paths = .{
|
||||||
|
48
readme.md
48
readme.md
@ -1,57 +1,23 @@
|
|||||||
# NATS.c
|
# LibreSSL
|
||||||
|
|
||||||
This is the [NATS C client library][nats.c], packaged for [Zig](https://ziglang.org/).
|
This is the [NATS C client library](https://github.com/nats-io/nats.c), packaged for [Zig](https://ziglang.org/).
|
||||||
|
|
||||||
## Status
|
## Installation
|
||||||
|
|
||||||
This library only explicitly supports Linux, macOS, and Windows operating systems. Building for other platforms is currently untested, so your mileage may vary.
|
|
||||||
|
|
||||||
## Zig Bindings
|
|
||||||
|
|
||||||
The following projects provide zig language bindings to the NATS.c library:
|
|
||||||
|
|
||||||
- [`epicyclic-dev/nats-client`][epicyclic-dev-bindings]
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
First, update your `build.zig.zon`:
|
First, update your `build.zig.zon`:
|
||||||
|
|
||||||
```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
|
zig fetch --save <PLACEHOLDER>
|
||||||
zig fetch --save git+https://github.com/allyourcodebase/protobuf-c#<refname>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then import `nats_c` in your `build.zig` with:
|
You can then import `nats_c` in your `build.zig` with:
|
||||||
|
|
||||||
```zig
|
```zig
|
||||||
const nats_c_dep = b.dependency("nats_c", .{
|
const nats_c_dependency = b.dependency("nats_c", .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
.@"enable-tls" = true, // enable SSL/TLS support
|
|
||||||
.@"force-host-verify" = true, // force hostname verification for TLS connections
|
|
||||||
.@"enable-streaming" = true, // build with support for NATS streaming extensions
|
|
||||||
});
|
});
|
||||||
your_exe.linkLibrary(nats_c_dep.artifact("nats_c"));
|
your_exe.linkLibrary(nats_c_dependency.artifact("nats_c"));
|
||||||
```
|
```
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
The NATS.c library has two optional dependencies:
|
|
||||||
|
|
||||||
- [`libressl`][libressl] when building with `enable-tls`
|
|
||||||
- [`protobuf-c`][protobuf-c] when building with `enable-streaming`
|
|
||||||
|
|
||||||
These dependencies are currently automatically retrieved and compiled as static libraries by the zig build system.
|
|
||||||
|
|
||||||
## Version Support Matrix
|
|
||||||
|
|
||||||
| Refname | NATS.c Version | Zig `0.12.x` | Zig `0.13.x` | Zig `0.14.0-dev` |
|
|
||||||
|----------|----------------|--------------|--------------|------------------|
|
|
||||||
| `3.8.2` | `3.8.2` | ✅ | ✅ | ✅ |
|
|
||||||
|
|
||||||
[nats.c]: https://github.com/nats-io/nats.c
|
|
||||||
[libressl]: https://github.com/allyourcodebase/libressl
|
|
||||||
[protobuf-c]: https://github.com/allyourcodebase/protobuf-c
|
|
||||||
[epicyclic-dev-bindings]: https://github.com/epicyclic-dev/nats-client
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user