diff options
| author | Sundaram Ramaswamy <legends2k@yahoo.com> | 2025-12-28 22:42:56 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-28 22:42:56 +0530 |
| commit | 93b008ac73006119b207ef4e6b96d335c9800b69 (patch) | |
| tree | b6b3e63fd340710109362aacbb1a6fa589c2d759 | |
| parent | 22a80257aa34a91d209f5ca9ae4dfcdd13ca8c2e (diff) | |
feat(server): add MSYS2 UCRT64 environment support
Support the newer UCRT64 MSYS2 environment (recommended default per msys2.org).
- Add UCRT64 detection to server/autobuild
- Fix vasprintf implicit declaration error on Windows (synctex_parser.c)
- Update configure.ac for Windows compatibility
Fixes #282, #286
Supersedes #295
Tested by multiple users on Windows 10/11 with MSYS2.
Co-authored-by: legends2k
| -rwxr-xr-x | server/autobuild | 10 | ||||
| -rw-r--r-- | server/configure.ac | 2 | ||||
| -rw-r--r-- | server/synctex_parser.c | 12 |
3 files changed, 16 insertions, 8 deletions
diff --git a/server/autobuild b/server/autobuild index 91ee3a5..46c254e 100755 --- a/server/autobuild +++ b/server/autobuild @@ -332,6 +332,16 @@ os_msys2() { mingw-w64-i686-toolchain mingw-w64-i686-openssl mingw-w64-i686-zlib" ;; + UCRT64) + PACKAGES="base-devel + autoconf + automake + mingw-w64-ucrt-x86_64-libpng + mingw-w64-ucrt-x86_64-poppler + mingw-w64-ucrt-x86_64-imagemagick + mingw-w64-ucrt-x86_64-toolchain + mingw-w64-ucrt-x86_64-openssl + mingw-w64-ucrt-x86_64-zlib" ;; MSYS) case $(uname -m) in x86_64) diff --git a/server/configure.ac b/server/configure.ac index 9a8c46d..19369f6 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -36,7 +36,7 @@ AC_COMPILE_IFELSE( AM_CONDITIONAL(HAVE_W32, [test "$have_w32" = true]) if test "$have_w32" = true; then - if test "$MSYSTEM" = MINGW32 -o "$MSYSTEM" = MINGW64; then + if test "$MSYSTEM" = MINGW32 -o "$MSYSTEM" = MINGW64 -o "$MSYSTEM" = UCRT64; then # glib won't work properly on msys2 without it. CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $CFLAGS" fi diff --git a/server/synctex_parser.c b/server/synctex_parser.c index 27be608..865c629 100644 --- a/server/synctex_parser.c +++ b/server/synctex_parser.c @@ -8415,7 +8415,8 @@ static int _synctex_updater_print(synctex_updater_p updater, const char * format } return result; } -#if defined(_MSC_VER) +#if defined(_WIN32) +// define vasprintf as it’s available only on Linux and macOS. #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -8424,17 +8425,14 @@ static int vasprintf(char **ret, const char *format, va_list ap) { - int len; - len = _vsnprintf(NULL, 0, format, ap); + int len = vsnprintf(NULL, 0, format, ap); if (len < 0) return -1; *ret = malloc(len + 1); if (!*ret) return -1; - _vsnprintf(*ret, len+1, format, ap); - (*ret)[len] = '\0'; - return len; + return vsnprintf(*ret, len + 1, format, ap); } -#endif +#endif // _WIN32 /** * gzvprintf is not available until OSX 10.10 |
