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..dab6a6f3 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] +[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