From 555141e35166c7f7d98c16f6f95fde8e57a651c2 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sun, 25 Jan 2026 19:24:58 +0000 Subject: Implement runtime OS detection and automatic versioning --- src/utils/utils.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src/utils/utils.c') diff --git a/src/utils/utils.c b/src/utils/utils.c index 159326e..56a7690 100644 --- a/src/utils/utils.c +++ b/src/utils/utils.c @@ -671,14 +671,17 @@ void scan_build_directives(ParserContext *ctx, const char *src) { printf("[zprep] Downloading %s...\n", filename); char cmd[8192]; -#ifdef _WIN32 - // On Windows, try curl which is often built-in now - sprintf(cmd, "curl -s -L \"%s\" -o \"%s\"", url, filename); -#else - // Try wget, then curl. - sprintf(cmd, "wget -q \"%s\" -O \"%s\" || curl -s -L \"%s\" -o \"%s\"", url, - filename, url, filename); -#endif + if (z_is_windows()) + { + // On Windows, try curl which is often built-in now + sprintf(cmd, "curl -s -L \"%s\" -o \"%s\"", url, filename); + } + else + { + // Try wget, then curl. + sprintf(cmd, "wget -q \"%s\" -O \"%s\" || curl -s -L \"%s\" -o \"%s\"", url, + filename, url, filename); + } if (system(cmd) != 0) { zwarn("Failed to download %s", url); @@ -693,11 +696,12 @@ void scan_build_directives(ParserContext *ctx, const char *src) libs++; } -#ifdef _WIN32 - zwarn("pkg-config is usually not available on Windows. Build directive " - "'pkg-config:%s' might fail.", - libs); -#endif + if (z_is_windows()) + { + zwarn("pkg-config is usually not available on Windows. Build directive " + "'pkg-config:%s' might fail.", + libs); + } char cmd[4096]; sprintf(cmd, "pkg-config --cflags %s", libs); -- cgit v1.2.3