From 376f2eb02635741f43accf5d7217527b5483836f Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Tue, 27 Oct 2026 14:04:24 +0900 Subject: [PATCH 1/2] compat.quickjs-ng 0.17.0 on macOS and Windows The descriptor declared Linux only. Upstream builds the same four sources with the same flags on all three platforms, and openmui's TypeScript binding embeds the engine on every desktop. macOS needs nothing more (libSystem has libm and pthreads). Windows adds _CRT_SECURE_NO_WARNINGS, as upstream's CMake does for MSVC-ABI builds. The test is no longer gated to Linux, so it now evaluates the same JavaScript on macOS and Windows. Checked locally on x86_64-linux-gnu, and for x86_64-windows-gnu under wine. --- pkgs/c/compat.quickjs-ng.lua | 23 +++++++++++++++++++--- tests/examples/quickjs-ng/mcpp.toml | 11 ++++------- tests/examples/quickjs-ng/tests/engine.cpp | 8 -------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/pkgs/c/compat.quickjs-ng.lua b/pkgs/c/compat.quickjs-ng.lua index abb02b49..63881b01 100644 --- a/pkgs/c/compat.quickjs-ng.lua +++ b/pkgs/c/compat.quickjs-ng.lua @@ -46,9 +46,9 @@ -- keeps its assertions and its debug-dump code (quickjs.c:84-86); upstream's -- default build type (Release) would define it. -- --- LINUX ONLY. Built and tested with llvm 22.1.8 on x86_64-linux-gnu, and in an --- openkal graph for x86_64-linux-gnu. Upstream supports macOS and Windows, but --- nothing here has built the package there, so those sections are not declared. +-- PLATFORMS. Linux (llvm 22.1.8 on x86_64-linux-gnu, and in an openkal graph), +-- macOS and Windows: the same four sources and flags, as upstream's own CI +-- builds them on all three (clang and MSVC-ABI clang on Windows). -- -- NO CN MIRROR. The url is upstream's tag archive as a plain string, the -- fallback docs/cn-mirror.md describes for a contributor without mcpp-res write @@ -82,6 +82,18 @@ package = { sha256 = "559bc4c420475e55c7ab4510adbc562f55d7524d75e8e89d79ce4bb02f5687d9", }, }, + macosx = { + ["0.17.0"] = { + url = "https://github.com/quickjs-ng/quickjs/archive/refs/tags/v0.17.0.tar.gz", + sha256 = "559bc4c420475e55c7ab4510adbc562f55d7524d75e8e89d79ce4bb02f5687d9", + }, + }, + windows = { + ["0.17.0"] = { + url = "https://github.com/quickjs-ng/quickjs/archive/refs/tags/v0.17.0.tar.gz", + sha256 = "559bc4c420475e55c7ab4510adbc562f55d7524d75e8e89d79ce4bb02f5687d9", + }, + }, }, mcpp = { @@ -111,6 +123,11 @@ package = { -- the C driver, which adds no libm, and quickjs.c's Math functions then -- fail to link. libdl is left out: only quickjs-libc.c calls dlopen. linux = { ldflags = { "-lm", "-lpthread" } }, + -- libSystem carries libm and pthreads: nothing to add on macOS. + -- Windows: upstream's CMake adds _CRT_SECURE_NO_WARNINGS for MSVC-ABI + -- builds (CMakeLists.txt, `if(MSVC)`), and quickjs.c's thread-safe + -- atomics need nothing beyond the CRT. + windows = { cflags = { "-D_CRT_SECURE_NO_WARNINGS" } }, targets = { ["quickjs-ng"] = { kind = "lib" } }, deps = { }, }, diff --git a/tests/examples/quickjs-ng/mcpp.toml b/tests/examples/quickjs-ng/mcpp.toml index 19c96c1c..2aeca5b1 100644 --- a/tests/examples/quickjs-ng/mcpp.toml +++ b/tests/examples/quickjs-ng/mcpp.toml @@ -1,12 +1,9 @@ # QuickJS-ng test project: evaluate JavaScript through the engine and assert -# the values it computes, one group per compiled source file. -# -# compat.quickjs-ng carries a `linux` section only (see the descriptor's -# header), so the dependency is gated and the test compiles to a no-op main() -# elsewhere, the same shape as tests/examples/libaio and tests/examples/wamr. +# the values it computes, one group per compiled source file, on Linux, macOS +# and Windows. [package] name = "quickjs-ng-tests" version = "0.1.0" -[target.'cfg(linux)'.dependencies.compat] -quickjs-ng = "0.17.0" +[dependencies] +compat.quickjs-ng = "0.17.0" diff --git a/tests/examples/quickjs-ng/tests/engine.cpp b/tests/examples/quickjs-ng/tests/engine.cpp index fdee6c0f..e52290ab 100644 --- a/tests/examples/quickjs-ng/tests/engine.cpp +++ b/tests/examples/quickjs-ng/tests/engine.cpp @@ -16,8 +16,6 @@ // JS_FreeRuntime asserts that no object is still alive (quickjs.c:2699) and an // object this test forgot to free aborts it. -#ifdef __linux__ - #include #include @@ -131,9 +129,3 @@ int main() { } return 0; } - -#else - -int main() { return 0; } // compat.quickjs-ng declares linux only; nothing to assert here. - -#endif From 7ecc5aa8ce1ec33d9e3e4c102f3850aec356e0be Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Tue, 27 Oct 2026 14:10:50 +0900 Subject: [PATCH 2/2] tests/examples/quickjs-ng: the dependency in the form the candidate check rewrites --- tests/examples/quickjs-ng/mcpp.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/examples/quickjs-ng/mcpp.toml b/tests/examples/quickjs-ng/mcpp.toml index 2aeca5b1..dab6a6f3 100644 --- a/tests/examples/quickjs-ng/mcpp.toml +++ b/tests/examples/quickjs-ng/mcpp.toml @@ -5,5 +5,5 @@ name = "quickjs-ng-tests" version = "0.1.0" -[dependencies] -compat.quickjs-ng = "0.17.0" +[dependencies.compat] +quickjs-ng = "0.17.0"