Skip to content

Commit 3f38d48

Browse files
committed
Update build.zig for zig 0.15
1 parent 59f246c commit 3f38d48

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ jobs:
2020
runs-on: ${{ matrix.os }}
2121

2222
steps:
23-
- name: Check out repository
24-
uses: actions/checkout@v4
25-
26-
- name: Set up Zig
27-
uses: mlugg/setup-zig@v1
23+
- uses: actions/checkout@v4
24+
- uses: mlugg/setup-zig@v2
2825
with:
2926
version: ${{ matrix.zig-version }}
30-
31-
- name: Run `build`
32-
run: zig build --summary all
27+
- run: zig build --summary all

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ Provides a package to be used by the zig package manager for C programs.
66

77
For now the hard-coded config assumes linux.
88

9-
| Refname | json-c version | Zig `0.12.x` | Zig `0.13.x` | Zig `0.14.x` |
10-
|----------|------------------------|--------------|--------------|--------------|
11-
| `0.17` | `json-c-0.17-20230812` ||||
12-
| `0.18` | `json-c-0.18-20240915` ||||
13-
| `0.18+1` | `json-c-0.18-20240915` ||||
9+
| Refname | json-c version | Zig `0.15.0-dev` | Zig `0.14.x` | Zig `0.13.x` | Zig `0.12.x` |
10+
|----------|------------------------|------------------|--------------|--------------|--------------|
11+
| `0.18+2` | `json-c-0.18-20240915` |||||
12+
| `0.18+1` | `json-c-0.18-20240915` |||||
13+
| `0.18` | `json-c-0.18-20240915` |||||
14+
| `0.17` | `json-c-0.17-20230812` |||||
1415

1516
## Use
1617

1718
Add the dependency in your `build.zig.zon` by running the following command:
1819
```bash
19-
zig fetch --save git+https://github.com/allyourcodebase/json-c#0.18+1
20+
zig fetch --save git+https://github.com/allyourcodebase/json-c#master
2021
```
2122

2223
Then, in your `build.zig`:

build.zig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ pub fn build(b: *std.Build) !void {
4848
.SIZEOF_SSIZE_T = @sizeOf(isize),
4949
});
5050

51-
const lib = b.addStaticLibrary(.{
51+
const lib = b.addLibrary(.{
5252
.name = "json-c",
53-
.target = target,
54-
.optimize = optimize,
55-
.link_libc = true,
53+
.root_module = b.createModule(.{
54+
.target = target,
55+
.optimize = optimize,
56+
.link_libc = true,
57+
}),
5658
});
5759
lib.addIncludePath(upstream.path(""));
5860
lib.addConfigHeader(config);

0 commit comments

Comments
 (0)