1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 04:25:10 -07:00

Zig 0.12 compat

This commit is contained in:
Frank Denis 2023-11-02 06:51:29 +01:00
parent 51126865d0
commit 6c05a64bfe

View File

@ -103,9 +103,17 @@ pub fn build(b: *std.build.Builder) !void {
lib.defineCMacro("HAVE_TI_MODE", "1"); lib.defineCMacro("HAVE_TI_MODE", "1");
if (target.cpu_arch) |arch| { if (target.cpu_arch) |arch| {
switch (arch.endian()) { const endian = arch.endian();
.Big => lib.defineCMacro("NATIVE_BIG_ENDIAN", "1"), if (@hasField(@TypeOf(endian), "big")) {
.Little => lib.defineCMacro("NATIVE_LITTLE_ENDIAN", "1"), switch (endian) {
.big => lib.defineCMacro("NATIVE_BIG_ENDIAN", "1"),
.little => lib.defineCMacro("NATIVE_LITTLE_ENDIAN", "1"),
}
} else {
switch (endian) {
.Big => lib.defineCMacro("NATIVE_BIG_ENDIAN", "1"),
.Little => lib.defineCMacro("NATIVE_LITTLE_ENDIAN", "1"),
}
} }
} }