Skip to content

Commit 541d721

Browse files
committed
Zig 0.15
1 parent af570a5 commit 541d721

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ Provides a package to be used by the zig package manager for C programs.
1111

1212
| Refname | PostgreSQL version | Zig `0.15.x` | Zig `0.14.x` | Zig `0.13.x` |
1313
|------------|--------------------|--------------|--------------|--------------|
14-
| `5.16.4+3` | `REL_16_4` ||||
14+
| `5.16.4+4` | `REL_16_4` ||||
15+
| `5.16.4+3` | `REL_16_4` ||||
1516
| `5.16.4+2` | `REL_16_4` ||||
1617

1718
## Use
1819

1920
Add the dependency in your `build.zig.zon` by running the following command:
2021
```zig
21-
zig fetch --save git+https://github.com/allyourcodebase/libpq#5.16.4+3
22+
zig fetch --save git+https://github.com/allyourcodebase/libpq#master
2223
```
2324

2425
Then, in your `build.zig`:
@@ -49,7 +50,7 @@ To update this project dependencies:
4950
```bash
5051
zig fetch --save=upstream git+https://github.com/postgres/postgres#REL_16_4
5152
zig fetch --save git+https://github.com/allyourcodebase/openssl#main
52-
zig fetch --save git+https://github.com/allyourcodebase/libressl#4.0.0+2
53+
zig fetch --save git+https://github.com/allyourcodebase/libressl#master
5354
zig fetch --save git+https://github.com/allyourcodebase/zlib#main
54-
zig fetch --save git+https://github.com/allyourcodebase/zstd#1.5.7
55+
zig fetch --save git+https://github.com/allyourcodebase/zstd#master
5556
```

build.zig

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,26 @@ pub fn build(b: *std.Build) !void {
2323
const upstream = b.dependency("upstream", .{ .target = target, .optimize = optimize });
2424

2525
const config_ext = b.addConfigHeader(
26-
.{ .style = .{ .autoconf = upstream.path("src/include/pg_config_ext.h.in") }, .include_path = "pg_config_ext.h" },
26+
.{ .style = .{ .autoconf_undef = upstream.path("src/include/pg_config_ext.h.in") }, .include_path = "pg_config_ext.h" },
2727
.{ .PG_INT64_TYPE = .@"long int" },
2828
);
2929
const pg_config = b.addConfigHeader(
30-
.{ .style = .{ .autoconf = upstream.path("src/include/pg_config.h.in") }, .include_path = "pg_config.h" },
30+
.{ .style = .{ .autoconf_undef = upstream.path("src/include/pg_config.h.in") }, .include_path = "pg_config.h" },
3131
autoconf,
3232
);
3333
const config_os = b.addConfigHeader(
34-
.{ .style = .{ .autoconf = upstream.path(os_header) }, .include_path = "pg_config_os.h" },
34+
.{ .style = .{ .autoconf_at = upstream.path(os_header) }, .include_path = "pg_config_os.h" },
3535
.{},
3636
);
3737
const config_path = b.addConfigHeader(
3838
.{ .style = .blank, .include_path = "pg_config_paths.h" },
3939
default_paths,
4040
);
4141

42-
const lib = b.addStaticLibrary(.{ .name = "pq", .target = target, .optimize = optimize });
42+
const lib = b.addLibrary(.{
43+
.name = "pq",
44+
.root_module = b.createModule(.{ .target = target, .optimize = optimize }),
45+
});
4346

4447
lib.addCSourceFiles(.{
4548
.root = upstream.path(libpq_path),
@@ -252,11 +255,11 @@ pub fn build(b: *std.Build) !void {
252255
// Build executables to ensure no symbols are left undefined
253256
const test_step = b.step("examples", "Build example programs");
254257

255-
const test1 = b.addExecutable(.{ .name = "testlibpq", .target = target, .optimize = optimize });
256-
const test2 = b.addExecutable(.{ .name = "testlibpq2", .target = target, .optimize = optimize });
257-
const test3 = b.addExecutable(.{ .name = "testlibpq3", .target = target, .optimize = optimize });
258-
const test4 = b.addExecutable(.{ .name = "testlibpq4", .target = target, .optimize = optimize });
259-
const test5 = b.addExecutable(.{ .name = "testlo", .target = target, .optimize = optimize });
258+
const test1 = b.addExecutable(.{ .name = "testlibpq", .root_module = b.createModule(.{ .target = target, .optimize = optimize }) });
259+
const test2 = b.addExecutable(.{ .name = "testlibpq2", .root_module = b.createModule(.{ .target = target, .optimize = optimize }) });
260+
const test3 = b.addExecutable(.{ .name = "testlibpq3", .root_module = b.createModule(.{ .target = target, .optimize = optimize }) });
261+
const test4 = b.addExecutable(.{ .name = "testlibpq4", .root_module = b.createModule(.{ .target = target, .optimize = optimize }) });
262+
const test5 = b.addExecutable(.{ .name = "testlo", .root_module = b.createModule(.{ .target = target, .optimize = optimize }) });
260263

261264
test1.addCSourceFiles(.{ .root = upstream.path("src/test/examples"), .files = &.{"testlibpq.c"} });
262265
test2.addCSourceFiles(.{ .root = upstream.path("src/test/examples"), .files = &.{"testlibpq2.c"} });

build.zig.zon

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
.hash = "N-V-__8AAKeztweKsqUQCZESI7M-Rw2v-1IU1bTHR5SS-px6",
1010
},
1111
.openssl = .{
12-
.url = "git+https://github.com/allyourcodebase/openssl?ref=main#f348124c5382bcc377f1b3277357cbf2ed2fb8db",
13-
.hash = "openssl-3.3.1-2-TC9C3Se3ZACF5WO_CjoD7Bt_X94oCsAAbbwhOp1rTZBe",
12+
.url = "git+https://github.com/allyourcodebase/openssl?ref=main#cad7ccba47e42fa608ca655ec14ae33202df86e1",
13+
.hash = "openssl-3.3.2-TC9C3Wa3ZACgB1hZbrLOQCK9XccIBaW_F3imFfIeYP06",
1414
.lazy = true,
1515
},
1616
.libressl = .{
17-
.url = "git+https://github.com/allyourcodebase/libressl?ref=4.0.0+2#18d16b266328f3e568ab4ee614ae8c054b682c9e",
18-
.hash = "libressl-4.0.0--kqV4LnSAACWhbUEm8O5KHGuJpNJsN0xLIlbFun7ql-m",
17+
.url = "git+https://github.com/allyourcodebase/libressl?ref=master#43595de12da7fe58e4209560558bddfb0f195d0e",
18+
.hash = "libressl-4.0.0--kqV4OjTAADhw9rD-tZaxFy2KPrSU4Bt9FOi9UZe-Zjl",
1919
.lazy = true,
2020
},
2121
.zlib = .{
22-
.url = "git+https://github.com/allyourcodebase/zlib?ref=main#6c72830882690c1eb2567a537525c3f432c1da50",
23-
.hash = "zlib-1.3.1-ZZQ7lVgMAACwO4nUUd8GLhsuQ5JQq_VAhlEiENJTUv6h",
22+
.url = "git+https://github.com/allyourcodebase/zlib?ref=main#61e7df7e996ec5a5f13a653db3c419adb340d6ef",
23+
.hash = "zlib-1.3.1-ZZQ7lbYMAAB1hTSOKSXAKAgHsfDcyWNH_37ojw5WSpgR",
2424
.lazy = true,
2525
},
2626
.zstd = .{
27-
.url = "git+https://github.com/allyourcodebase/zstd?ref=1.5.7#01327d49cbc56dc24c20a167bb0055d7fc23de84",
27+
.url = "git+https://github.com/allyourcodebase/zstd?ref=master#01327d49cbc56dc24c20a167bb0055d7fc23de84",
2828
.hash = "zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0",
2929
.lazy = true,
3030
},

0 commit comments

Comments
 (0)