diff --git a/README.md b/README.md index 9406e90..1b81d84 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ To update this project dependencies: ```bash zig fetch --save=upstream git+https://github.com/postgres/postgres#REL_16_4 zig fetch --save git+https://github.com/allyourcodebase/openssl#3.3.0 -zig fetch --save git+https://github.com/allyourcodebase/libressl#3.9.2+1 +zig fetch --save git+https://github.com/allyourcodebase/libressl#4.0.0+1 zig fetch --save git+https://github.com/allyourcodebase/zlib#1.3.1 -zig fetch --save git+https://github.com/allyourcodebase/zstd#1.5.6-1 +zig fetch --save git+https://github.com/allyourcodebase/zstd#1.5.6-2 ``` diff --git a/build.zig b/build.zig index d42a2f9..ce2316e 100644 --- a/build.zig +++ b/build.zig @@ -62,7 +62,6 @@ pub fn build(b: *std.Build) !void { lib.addIncludePath(upstream.path("src/include")); lib.addIncludePath(b.path("include")); lib.addConfigHeader(config_path); - lib.root_module.addCMacro("_GNU_SOURCE", "1"); lib.root_module.addCMacro("FRONTEND", "1"); lib.linkLibC(); b.installArtifact(lib); @@ -187,13 +186,21 @@ pub fn build(b: *std.Build) !void { .HAVE_X86_64_POPCNTQ = is_amd64, }); + const is_gnu: ?u8 = if (target.result.isGnu()) 1 else null; + const not_gnu: ?u8 = if (is_gnu == null) 1 else null; + // While building with musl, defining _GNU_SOURCE makes musl declare extra things (e.g. struct ucred) + lib.root_module.addCMacro("_GNU_SOURCE", "1"); + + pg_config.addValues(.{ + .HAVE_SYNC_FILE_RANGE = is_gnu, + .STRERROR_R_INT = not_gnu, + }); + if (target.result.os.tag == .linux) { pg_config.addValues(.{ .HAVE_EXPLICIT_BZERO = 1, .HAVE_STRCHRNUL = 1, - .HAVE_STRERROR_R = 1, .HAVE_STRINGS_H = 1, - .HAVE_SYNC_FILE_RANGE = 1, .HAVE_MEMSET_S = null, .HAVE_SYS_UCRED_H = null, }); @@ -201,9 +208,7 @@ pub fn build(b: *std.Build) !void { pg_config.addValues(.{ .HAVE_EXPLICIT_BZERO = null, .HAVE_STRCHRNUL = null, - .HAVE_STRERROR_R = null, .HAVE_STRINGS_H = 0, - .HAVE_SYNC_FILE_RANGE = null, .HAVE_MEMSET_S = 1, .HAVE_SYS_UCRED_H = 1, }); @@ -456,6 +461,7 @@ const autoconf = .{ .HAVE_STDLIB_H = 1, .HAVE_STRING_H = 1, .HAVE_STRNLEN = 1, + .HAVE_STRERROR_R = 1, .HAVE_STRSIGNAL = 1, .HAVE_STRUCT_OPTION = 1, .HAVE_STRUCT_TM_TM_ZONE = 1, @@ -580,7 +586,6 @@ const autoconf = .{ .LOCALE_T_IN_XLOCALE = null, .PROFILE_PID_DIR = null, .PTHREAD_CREATE_JOINABLE = null, - .STRERROR_R_INT = null, // 1 if not _GNU_SOURCE .USE_ARMV8_CRC32C = null, .USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK = null, .USE_ASSERT_CHECKING = null, diff --git a/build.zig.zon b/build.zig.zon index 589f543..04702f9 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -12,8 +12,8 @@ .lazy = true, }, .libressl = .{ - .url = "git+https://github.com/allyourcodebase/libressl?ref=3.9.2+1#02abfefee4e4eda28ce53c637b3c0d204ace8a6d", - .hash = "12201f5cc06c88f191696106723797449baacb6ea38b07b6cf31c18c0382a6bea33e", + .url = "git+https://github.com/allyourcodebase/libressl?ref=4.0.0+1#fd0fe777153a75217e97ba22cd8b32005bb90d08", + .hash = "1220c6521dd6d37f0426fbe6c3b3c3f4282f28495311abc08fb4cebf21ea2346ba2f", .lazy = true, }, .zlib = .{ @@ -22,8 +22,8 @@ .lazy = true, }, .zstd = .{ - .url = "git+https://github.com/allyourcodebase/zstd?ref=1.5.6-1#3247ffbcbc31f014027a5776a25c4261054e9fe9", - .hash = "12200dbfe91946451bab186f584edbec9f9f7fdbcf818ad984b7182fea655b3c10e3", + .url = "git+https://github.com/allyourcodebase/zstd?ref=1.5.6-2#ea25e89037dc251a3ba50a5005e2c8566eb3c2bd", + .hash = "122040924472b1c510a7058596d43fb9461dcc20406f681eb9c2f6443375d2f571c4", .lazy = true, }, },