From: David Uhden Collado Subject: [update] lang/quickjs 2024.01.13 -> 2025.09.13 To: ports@openbsd.org Cc: bcallah@openbsd.org Date: Thu, 6 Nov 2025 03:35:19 +0100 In this email, I have attached a patch to update lang/quickjs from version 2024.01.13 to version 2025.09.13. From 2024.01.13 to 2025.09.13, the project removed the legacy bignum extensions and qjscalc, introduced a faster small-number BigInt, and added WeakRef/FinalizationRegistry (with symbols as weakrefs). It expanded language/stdlib features with JSON modules and import attributes, improved JSON spec conformance and JSON5 compatibility (including accepting JSON5 modules), major RegExp upgrades (v flag, modifiers, RegExp.escape), Float16Array, Promise.try, and Error.isError. Runtime behavior and tooling were refined: qjs now pretty-prints objects and treats unhandled promise rejections as fatal by default, float64 printing/parsing is more correct, repeated string concatenation is faster, and debug info includes column numbers; new CLI flags arrived (qjs -s/--strip-source, qjsc -s/--keep-source) and the "use strip" extension was dropped. The C API grew with JS_PrintValue(), JS_FreePropertyEnum(), JS_AtomToCStringLen(), JS_GetAnyOpaque(), plus more exotic class callbacks. Tested on amd64 and it builds and runs fine. Index: lang/quickjs/Makefile =================================================================== RCS file: /cvs/ports/lang/quickjs/Makefile,v diff -u -p -u -r1.10 Makefile --- lang/quickjs/Makefile 28 Jan 2025 11:22:03 -0000 1.10 +++ lang/quickjs/Makefile 6 Nov 2025 02:10:23 -0000 @@ -1,9 +1,8 @@ COMMENT = small, embeddable JavaScript engine in C -V = 2024.01.13 +V = 2025.09.13 DISTNAME = quickjs-${V:S/./-/g} PKGNAME = quickjs-${V} -REVISION = 0 CATEGORIES = lang Index: lang/quickjs/distinfo =================================================================== RCS file: /cvs/ports/lang/quickjs/distinfo,v diff -u -p -u -r1.3 distinfo --- lang/quickjs/distinfo 30 May 2024 18:05:13 -0000 1.3 +++ lang/quickjs/distinfo 6 Nov 2025 02:10:29 -0000 @@ -1,2 +1,2 @@ -SHA256 (quickjs-2024-01-13.tar.xz) = PEv4+JW/pUvrSGyNEhgRJ3Hs/FrDvhA2hR70FWghLgM= -SIZE (quickjs-2024-01-13.tar.xz) = 765800 +SHA256 (quickjs-2025-09-13.tar.xz) = bx8yKuo7s6kIWNuFyf5xcBP95N99/K/i9X549btLSgw= +SIZE (quickjs-2025-09-13.tar.xz) = 595964 Index: lang/quickjs/pkg/PLIST =================================================================== RCS file: /cvs/ports/lang/quickjs/pkg/PLIST,v diff -u -p -u -r1.3 PLIST --- lang/quickjs/pkg/PLIST 11 Mar 2022 19:29:13 -0000 1.3 +++ lang/quickjs/pkg/PLIST 6 Nov 2025 02:10:34 -0000 @@ -1,6 +1,5 @@ @bin bin/qjs @bin bin/qjsc -bin/qjscalc include/quickjs/ include/quickjs/quickjs-libc.h include/quickjs/quickjs.h Index: lang/quickjs/patches/patch-Makefile =================================================================== RCS file: /cvs/ports/lang/quickjs/patches/patch-Makefile,v diff -u -p -u -r1.4 patch-Makefile --- lang/quickjs/patches/patch-Makefile 30 May 2024 18:05:13 -0000 1.4 +++ lang/quickjs/patches/patch-Makefile 6 Nov 2025 02:10:39 -0000 @@ -1,40 +1,34 @@ Remove hardcoded -O2 Use default ar -Don't use LTO Remove warning clang doesn't understand Remove -ldl +Remove hello_module Index: Makefile --- Makefile.orig +++ Makefile -@@ -28,13 +28,14 @@ endif - # Windows cross compilation from Linux - #CONFIG_WIN32=y - # use link time optimization (smaller and faster executables but slower build) --CONFIG_LTO=y -+#CONFIG_LTO=y +@@ -37,8 +37,9 @@ endif + #CONFIG_LTO=y # consider warnings as errors (for development) #CONFIG_WERROR=y - # force 32 bit build for some utilities + # force 32 bit build on x86_64 #CONFIG_M32=y # cosmopolitan build (see https://github.com/jart/cosmopolitan) #CONFIG_COSMO=y +CONFIG_DEFAULT_AR=y - # installation directory - PREFIX?=/usr/local -@@ -98,8 +99,8 @@ else ifdef CONFIG_COSMO +@@ -127,8 +127,8 @@ else ifdef CONFIG_COSMO else HOST_CC=gcc CC=$(CROSS_PREFIX)gcc - CFLAGS+=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d -- CFLAGS += -Wno-array-bounds -Wno-format-truncation +- CFLAGS += -Wno-array-bounds -Wno-format-truncation -Wno-infinite-recursion + CFLAGS+=-Wall -MMD -MF $(OBJDIR)/$(@F).d + CFLAGS += -Wno-array-bounds ifdef CONFIG_LTO AR=$(CROSS_PREFIX)gcc-ar else -@@ -122,7 +123,7 @@ endif +@@ -160,7 +160,7 @@ endif CFLAGS+=$(DEFINES) CFLAGS_DEBUG=$(CFLAGS) -O0 CFLAGS_SMALL=$(CFLAGS) -Os @@ -43,16 +37,27 @@ Index: Makefile CFLAGS_NOLTO:=$(CFLAGS_OPT) ifdef CONFIG_COSMO LDFLAGS+=-s # better to strip by default -@@ -194,10 +195,10 @@ ifdef CONFIG_BIGNUM - QJS_OBJS+=$(OBJDIR)/qjscalc.o - endif +@@ -229,1 +229,1 @@ ifeq ($(CROSS_PREFIX),) +-PROGS+=examples/hello_module ++#PROGS+=examples/hello_module +@@ -244,9 +244,9 @@ endif + QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(QJS_LIB_OBJS) -HOST_LIBS=-lm -ldl -lpthread +HOST_LIBS=-lm -lpthread - LIBS=-lm + LIBS=-lm -lpthread ifndef CONFIG_WIN32 --LIBS+=-ldl -lpthread +-LIBS+=-ldl +LIBS+=-lpthread endif LIBS+=$(EXTRA_LIBS) + +@@ -394,8 +394,1 @@ # examples +-# example of static JS compilation with modules +-HELLO_MODULE_SRCS=examples/hello_module.js +-HELLO_MODULE_OPTS=-fno-string-normalize -fno-map -fno-typedarray \ +- -fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \ +- -fno-date -m +-examples/hello_module: $(QJSC) libquickjs$(LTOEXT).a $(HELLO_MODULE_SRCS) +- $(QJSC) $(HELLO_MODULE_OPTS) -o $@ $(HELLO_MODULE_SRCS) Index: lang/quickjs/patches/patch-qjs_c =================================================================== RCS file: /cvs/ports/lang/quickjs/patches/patch-qjs_c,v diff -u -p -u -r1.4 patch-qjs_c --- lang/quickjs/patches/patch-qjs_c 30 May 2024 18:05:13 -0000 1.4 +++ lang/quickjs/patches/patch-qjs_c 6 Nov 2025 02:10:39 -0000 @@ -1,7 +1,7 @@ Index: qjs.c --- qjs.c.orig +++ qjs.c -@@ -152,7 +152,7 @@ static size_t js_trace_malloc_usable_size(const void * +@@ -142,7 +142,7 @@ static size_t js_trace_malloc_usable_size(const void * return malloc_usable_size((void *)ptr); #else /* change this to `return 0;` if compilation fails */ Index: lang/quickjs/patches/patch-qjsc_c =================================================================== RCS file: /cvs/ports/lang/quickjs/patches/patch-qjsc_c,v diff -u -p -u -r1.4 patch-qjsc_c --- lang/quickjs/patches/patch-qjsc_c 30 May 2024 18:05:13 -0000 1.4 +++ lang/quickjs/patches/patch-qjsc_c 6 Nov 2025 02:10:39 -0000 @@ -3,11 +3,11 @@ Remove -ldl Index: qjsc.c --- qjsc.c.orig +++ qjsc.c -@@ -449,7 +449,6 @@ static int output_executable(const char *out_filename, +@@ -502,7 +502,6 @@ static int output_executable(const char *out_filename, lib_dir, bn_suffix, lto_suffix); *arg++ = libjsname; *arg++ = "-lm"; - *arg++ = "-ldl"; *arg++ = "-lpthread"; *arg = NULL; - + Index: lang/quickjs/patches/patch-quickjs-libc_c =================================================================== RCS file: /cvs/ports/lang/quickjs/patches/patch-quickjs-libc_c,v diff -u -p -u -r1.3 patch-quickjs-libc_c --- lang/quickjs/patches/patch-quickjs-libc_c 11 Mar 2022 19:29:13 -0000 1.3 +++ lang/quickjs/patches/patch-quickjs-libc_c 6 Nov 2025 02:10:39 -0000 @@ -1,7 +1,7 @@ Index: quickjs-libc.c --- quickjs-libc.c.orig +++ quickjs-libc.c -@@ -55,6 +55,11 @@ typedef sig_t sighandler_t; +@@ -62,5 +62,10 @@ typedef sig_t sighandler_t; #endif #endif /* __APPLE__ */ @@ -12,4 +12,3 @@ Index: quickjs-libc.c + #endif - #if !defined(_WIN32) Index: lang/quickjs/patches/patch-quickjs_c =================================================================== RCS file: /cvs/ports/lang/quickjs/patches/patch-quickjs_c,v diff -u -p -u -r1.4 patch-quickjs_c --- lang/quickjs/patches/patch-quickjs_c 30 May 2024 18:05:13 -0000 1.4 +++ lang/quickjs/patches/patch-quickjs_c 6 Nov 2025 02:10:39 -0000 @@ -1,7 +1,7 @@ Index: quickjs.c --- quickjs.c.orig +++ quickjs.c -@@ -1705,7 +1705,7 @@ static size_t js_def_malloc_usable_size(const void *pt +@@ -1675,7 +1675,7 @@ static size_t js_def_malloc_usable_size(const void *pt return malloc_usable_size((void *)ptr); #else /* change this to `return 0;` if compilation fails */ Index: lang/quickjs/patches/patch-tests_test_builtin_js =================================================================== RCS file: /cvs/ports/lang/quickjs/patches/patch-tests_test_builtin_js,v diff -u -p -u -r1.4 patch-tests_test_builtin_js --- lang/quickjs/patches/patch-tests_test_builtin_js 30 May 2024 18:05:13 -0000 1.4 +++ lang/quickjs/patches/patch-tests_test_builtin_js 6 Nov 2025 02:10:39 -0000 @@ -6,22 +6,25 @@ Fix the Float32Array test on big-endian Index: tests/test_builtin.js --- tests/test_builtin.js.orig +++ tests/test_builtin.js -@@ -336,12 +336,12 @@ function test_number() - assert(Number.isNaN(Number("-"))); - assert(Number.isNaN(Number("\x00a"))); - +@@ -384,13 +384,13 @@ function test_number() + assert((1-2**-53).toString(12), "0.bbbbbbbbbbbbbba"); + assert((1000000000000000128).toString(), "1000000000000000100"); + assert((1000000000000000128).toFixed(0), "1000000000000000128"); - assert((25).toExponential(0), "3e+1"); - assert((-25).toExponential(0), "-3e+1"); - assert((2.5).toPrecision(1), "3"); - assert((-2.5).toPrecision(1), "-3"); +- assert((25).toPrecision(1) === "3e+1"); - assert((1.125).toFixed(2), "1.13"); - assert((-1.125).toFixed(2), "-1.13"); +// assert((25).toExponential(0), "3e+1"); +// assert((-25).toExponential(0), "-3e+1"); +// assert((2.5).toPrecision(1), "3"); +// assert((-2.5).toPrecision(1), "-3"); ++// assert((25).toPrecision(1) === "3e+1"); +// assert((1.125).toFixed(2), "1.13"); +// assert((-1.125).toFixed(2), "-1.13"); - } + assert((0.5).toFixed(0), "1"); + assert((-0.5).toFixed(0), "-1"); + assert((-1e-10).toFixed(0), "-0"); - function test_eval2()