From aa9e1ae8c163818ca19555437a7a209e377b0c80 Mon Sep 17 00:00:00 2001 From: Khitiara Date: Mon, 24 Jun 2024 18:57:14 -0400 Subject: [PATCH 1/2] Fix windows build --- .gitattributes | 1 + .gitignore | 4 ++-- build.zig | 46 +++++++++++++++++++++++----------------------- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.gitattributes b/.gitattributes index d94c5fb3a..1f810bece 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ /version -merge +/config/config.h.in eol=LF \ No newline at end of file diff --git a/.gitignore b/.gitignore index 93c1b5f43..73f0bc012 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/zig-cache -/zig-out +/.zig-cache +/zig-out \ No newline at end of file diff --git a/build.zig b/build.zig index f85620f0c..1abaa74e9 100644 --- a/build.zig +++ b/build.zig @@ -89,11 +89,11 @@ pub fn build(b: *std.Build) void { .HAVE_DECL_STRICMP = 0, .HAVE_DECL_STRLCPY = 0, .HAVE_DECL_STRNCASECMP = 0, - .HAVE_DECL_STRNICMP = 0, - .HAVE_DECL_STRNLEN = 0, + .HAVE_DECL_STRNICMP = @as(u32, if(target.result.os.tag == .windows) 1 else 0), + .HAVE_DECL_STRNLEN = @as(u32, if(target.result.os.tag == .windows) 1 else 0), .HAVE_DECL_STRRCHRNUL = 0, .HAVE_DECL_STRSEP = 0, - .HAVE_ENDIAN_H = 1, + .HAVE_ENDIAN_H = have(target.result.os.tag != .windows), .HAVE_FACCESSAT = 1, .HAVE_FCNTL_H = 1, .HAVE_FILENO = 1, @@ -132,16 +132,16 @@ pub fn build(b: *std.Build) void { .HAVE_HTOLE64 = null, .HAVE_INTRIN_H = 1, .HAVE_INTTYPES_H = 1, - .HAVE_IO_H = null, + .HAVE_IO_H = have(target.result.os.tag == .windows), .HAVE_ISASCII = 1, .HAVE_ISCNTRL = 1, - .HAVE_MACHINE_ENDIAN_H = 1, + .HAVE_MACHINE_ENDIAN_H = have(target.result.os.tag != .windows), .HAVE_MEMPCPY = 1, .HAVE_MEMPSET = null, .HAVE_MINIX_CONFIG_H = null, - .HAVE_MMAP = 1, + .HAVE_MMAP = have(target.result.os.tag != .windows), .HAVE_PATHCONF = null, - .HAVE_REALPATH = 1, + .HAVE_REALPATH = have(target.result.os.tag != .windows), .HAVE_SNPRINTF = 1, .HAVE_STAT = 1, .HAVE_STDARG_H = 1, @@ -151,21 +151,21 @@ pub fn build(b: *std.Build) void { .HAVE_STDIO_H = 1, .HAVE_STDLIB_H = 1, .HAVE_STDNORETURN_H = 1, - .HAVE_STRCASECMP = 1, - .HAVE_STRICMP = 1, + .HAVE_STRCASECMP = have(target.result.os.tag != .windows), + .HAVE_STRICMP = have(target.result.os.tag != .windows), .HAVE_STRINGS_H = 1, .HAVE_STRING_H = 1, .HAVE_STRLCPY = null, - .HAVE_STRNCASECMP = 1, - .HAVE_STRNICMP = 1, - .HAVE_STRNLEN = 1, + .HAVE_STRNCASECMP = have(target.result.os.tag != .windows), + .HAVE_STRNICMP = have(target.result.os.tag != .windows), + .HAVE_STRNLEN = have(target.result.os.tag == .windows), .HAVE_STRRCHRNUL = null, .HAVE_STRSEP = null, .HAVE_STRUCT_STAT = null, - .HAVE_STRUCT__STATI64 = null, + .HAVE_STRUCT__STATI64 = have(target.result.os.tag == .windows), .HAVE_SYSCONF = null, - .HAVE_SYS_ENDIAN_H = 1, - .HAVE_SYS_MMAN_H = 1, + .HAVE_SYS_ENDIAN_H = have(target.result.os.tag != .windows), + .HAVE_SYS_MMAN_H = have(target.result.os.tag != .windows), .HAVE_SYS_PARAM_H = null, .HAVE_SYS_RESOURCE_H = null, .HAVE_SYS_STAT_H = 1, @@ -174,7 +174,7 @@ pub fn build(b: *std.Build) void { .HAVE_TYPEOF = null, .HAVE_UINTPTR_T = 1, .HAVE_UNISTD_H = null, - .HAVE_VSNPRINTF = null, + .HAVE_VSNPRINTF = have(target.result.os.tag == .windows), .HAVE_WCHAR_H = null, .HAVE__ACCESS = null, .HAVE__BITSCANREVERSE = null, @@ -183,13 +183,13 @@ pub fn build(b: *std.Build) void { .HAVE__BYTESWAP_UINT64 = null, .HAVE__BYTESWAP_ULONG = null, .HAVE__BYTESWAP_USHORT = null, - .HAVE__CHSIZE = null, - .HAVE__CHSIZE_S = null, - .HAVE__FILENO = null, - .HAVE__FSEEKI64 = null, - .HAVE__FSTATI64 = null, - .HAVE__FULLPATH = null, - .HAVE__STATI64 = null, + .HAVE__CHSIZE = have(target.result.os.tag == .windows), + .HAVE__CHSIZE_S = have(target.result.os.tag == .windows), + .HAVE__FILENO = have(target.result.os.tag == .windows), + .HAVE__FSEEKI64 = have(target.result.os.tag == .windows), + .HAVE__FSTATI64 = have(target.result.os.tag == .windows), + .HAVE__FULLPATH = have(target.result.os.tag == .windows), + .HAVE__STATI64 = have(target.result.os.tag == .windows), .HAVE___BSWAP_16 = 1, .HAVE___BSWAP_32 = 1, .HAVE___BSWAP_64 = 1, From d5f7ae9cd10474effb60fab64954d9886c9b82af Mon Sep 17 00:00:00 2001 From: Khitiara Date: Fri, 28 Jun 2024 11:28:24 -0400 Subject: [PATCH 2/2] test something --- build.zig | 33 +++++++++++++++++---------------- config/config.h.in | 3 +++ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/build.zig b/build.zig index 1abaa74e9..774ee567a 100644 --- a/build.zig +++ b/build.zig @@ -89,17 +89,17 @@ pub fn build(b: *std.Build) void { .HAVE_DECL_STRICMP = 0, .HAVE_DECL_STRLCPY = 0, .HAVE_DECL_STRNCASECMP = 0, - .HAVE_DECL_STRNICMP = @as(u32, if(target.result.os.tag == .windows) 1 else 0), - .HAVE_DECL_STRNLEN = @as(u32, if(target.result.os.tag == .windows) 1 else 0), + .HAVE_DECL_STRNICMP = @as(u32, if (target.result.os.tag == .windows) 1 else 0), + .HAVE_DECL_STRNLEN = @as(u32, if (target.result.os.tag == .windows) 1 else 0), .HAVE_DECL_STRRCHRNUL = 0, .HAVE_DECL_STRSEP = 0, .HAVE_ENDIAN_H = have(target.result.os.tag != .windows), - .HAVE_FACCESSAT = 1, + .HAVE_FACCESSAT = have(target.result.os.tag != .windows), .HAVE_FCNTL_H = 1, .HAVE_FILENO = 1, - .HAVE_FSEEKO = 1, - .HAVE_FSTAT = 1, - .HAVE_FTRUNCATE = 1, + .HAVE_FSEEKO = have(target.result.os.tag != .windows), + .HAVE_FSTAT = have(target.result.os.tag != .windows), + .HAVE_FTRUNCATE = have(target.result.os.tag != .windows), .HAVE_FUNC_ATTRIBUTE1_ALLOC_SIZE = 1, .HAVE_FUNC_ATTRIBUTE2_ALLOC_SIZE = null, .HAVE_FUNC_ATTRIBUTE3_FORMAT = 1, @@ -133,27 +133,27 @@ pub fn build(b: *std.Build) void { .HAVE_INTRIN_H = 1, .HAVE_INTTYPES_H = 1, .HAVE_IO_H = have(target.result.os.tag == .windows), - .HAVE_ISASCII = 1, - .HAVE_ISCNTRL = 1, + .HAVE_ISASCII = have(target.result.os.tag != .windows), + .HAVE_ISCNTRL = have(target.result.os.tag != .windows), .HAVE_MACHINE_ENDIAN_H = have(target.result.os.tag != .windows), - .HAVE_MEMPCPY = 1, + .HAVE_MEMPCPY = have(target.result.os.tag != .windows), .HAVE_MEMPSET = null, .HAVE_MINIX_CONFIG_H = null, .HAVE_MMAP = have(target.result.os.tag != .windows), .HAVE_PATHCONF = null, .HAVE_REALPATH = have(target.result.os.tag != .windows), .HAVE_SNPRINTF = 1, - .HAVE_STAT = 1, - .HAVE_STDARG_H = 1, + .HAVE_STAT = have(target.result.os.tag != .windows), + .HAVE_STDARG_H = have(target.result.os.tag != .windows), .HAVE_STDBOOL_H = 1, - .HAVE_STDC_INLINE = 1, - .HAVE_STDINT_H = 1, - .HAVE_STDIO_H = 1, + .HAVE_STDC_INLINE = have(target.result.os.tag != .windows), + .HAVE_STDINT_H = have(target.result.os.tag != .windows), + .HAVE_STDIO_H = have(target.result.os.tag != .windows), .HAVE_STDLIB_H = 1, - .HAVE_STDNORETURN_H = 1, + .HAVE_STDNORETURN_H = have(target.result.os.tag != .windows), .HAVE_STRCASECMP = have(target.result.os.tag != .windows), .HAVE_STRICMP = have(target.result.os.tag != .windows), - .HAVE_STRINGS_H = 1, + .HAVE_STRINGS_H = have(target.result.os.tag != .windows), .HAVE_STRING_H = 1, .HAVE_STRLCPY = null, .HAVE_STRNCASECMP = have(target.result.os.tag != .windows), @@ -190,6 +190,7 @@ pub fn build(b: *std.Build) void { .HAVE__FSTATI64 = have(target.result.os.tag == .windows), .HAVE__FULLPATH = have(target.result.os.tag == .windows), .HAVE__STATI64 = have(target.result.os.tag == .windows), + .HAVE__FILELENGTHI64 = have(target.result.os.tag == .windows), .HAVE___BSWAP_16 = 1, .HAVE___BSWAP_32 = 1, .HAVE___BSWAP_64 = 1, diff --git a/config/config.h.in b/config/config.h.in index eb991906e..21bac5125 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -514,6 +514,9 @@ /* Define to 1 if you have the `_fullpath' function. */ #undef HAVE__FULLPATH +/* Define to 1 if you have the `_filelengthi64' function. */ +#undef HAVE__FILELENGTHI64 + /* Define to 1 if you have the `_stati64' function. */ #undef HAVE__STATI64