From 5c327e456f0230adf34fe27a543dc838ad4654ae Mon Sep 17 00:00:00 2001 From: bcallah Date: Wed, 23 Sep 2020 15:37:32 +0000 Subject: [PATCH] Update to quickjs-2020.09.06 A full changelog is here: https://bellard.org/quickjs/Changelog From gkoehler@, who also tested it on macppc and powerpc64! --- lang/quickjs/Makefile | 7 +++--- lang/quickjs/distinfo | 4 ++-- lang/quickjs/patches/patch-Makefile | 16 ++++++++----- lang/quickjs/patches/patch-qjs_c | 6 ++--- lang/quickjs/patches/patch-qjsc_c | 4 ++-- lang/quickjs/patches/patch-quickjs-libc_c | 19 ++++++++------- lang/quickjs/patches/patch-quickjs_c | 6 ++--- lang/quickjs/patches/patch-quickjs_h | 16 ------------- .../patches/patch-tests_test_builtin_js | 24 +++++++++++++++---- lang/quickjs/patches/patch-tests_test_std_js | 20 ++++++++++++++++ lang/quickjs/pkg/PLIST | 5 +--- 11 files changed, 75 insertions(+), 52 deletions(-) delete mode 100644 lang/quickjs/patches/patch-quickjs_h create mode 100644 lang/quickjs/patches/patch-tests_test_std_js diff --git a/lang/quickjs/Makefile b/lang/quickjs/Makefile index 0271805f88f..982c50bee9c 100644 --- a/lang/quickjs/Makefile +++ b/lang/quickjs/Makefile @@ -1,9 +1,8 @@ -# $OpenBSD: Makefile,v 1.5 2020/04/06 20:24:53 cwen Exp $ +# $OpenBSD: Makefile,v 1.6 2020/09/23 15:37:32 bcallah Exp $ COMMENT = small, embeddable JavaScript engine in C -V = 2019.10.27 -REVISION = 0 +V = 2020.09.06 DISTNAME = quickjs-${V:S/./-/g} PKGNAME = quickjs-${V} @@ -15,7 +14,7 @@ MAINTAINER = Brian Callahan # MIT PERMIT_PACKAGE = Yes -WANTLIB += c m +WANTLIB += c m pthread MASTER_SITES = https://bellard.org/quickjs/ EXTRACT_SUFX = .tar.xz diff --git a/lang/quickjs/distinfo b/lang/quickjs/distinfo index f685ef39be9..2e4a5ada317 100644 --- a/lang/quickjs/distinfo +++ b/lang/quickjs/distinfo @@ -1,2 +1,2 @@ -SHA256 (quickjs-2019-10-27.tar.xz) = Uc3KTreFHS64so1ELfqjYhOSAXGgzw68BGgCNpQ0oXY= -SIZE (quickjs-2019-10-27.tar.xz) = 763012 +SHA256 (quickjs-2020-09-06.tar.xz) = ACGj6M3Gth4iVBHQXihB0kN+HM9LTKu5pfdoXr+1dxc= +SIZE (quickjs-2020-09-06.tar.xz) = 753080 diff --git a/lang/quickjs/patches/patch-Makefile b/lang/quickjs/patches/patch-Makefile index a182b33ac24..641d3315e57 100644 --- a/lang/quickjs/patches/patch-Makefile +++ b/lang/quickjs/patches/patch-Makefile @@ -1,4 +1,4 @@ -$OpenBSD: patch-Makefile,v 1.1.1.1 2019/12/21 14:24:03 bcallah Exp $ +$OpenBSD: patch-Makefile,v 1.2 2020/09/23 15:37:32 bcallah Exp $ Remove hardcoded -O2 Use default ar @@ -23,7 +23,7 @@ Index: Makefile ifdef CONFIG_DARWIN # use clang instead of gcc -@@ -81,8 +82,8 @@ ifdef CONFIG_CLANG +@@ -83,8 +84,8 @@ ifdef CONFIG_CLANG else HOST_CC=gcc CC=$(CROSS_PREFIX)gcc @@ -34,7 +34,7 @@ Index: Makefile ifdef CONFIG_LTO AR=$(CROSS_PREFIX)gcc-ar else -@@ -97,7 +98,7 @@ DEFINES:=-D_GNU_SOURCE -DCONFIG_VERSION=\"$(shell cat +@@ -106,7 +107,7 @@ endif CFLAGS+=$(DEFINES) CFLAGS_DEBUG=$(CFLAGS) -O0 CFLAGS_SMALL=$(CFLAGS) -Os @@ -43,12 +43,16 @@ Index: Makefile CFLAGS_NOLTO:=$(CFLAGS_OPT) LDFLAGS=-g ifdef CONFIG_LTO -@@ -165,7 +166,7 @@ QJSBN_OBJS=$(OBJDIR)/qjs.bn.o $(OBJDIR)/repl-bn.bn.o $ +@@ -170,10 +171,10 @@ QJS_LIB_OBJS+=$(OBJDIR)/libbf.o + QJS_OBJS+=$(OBJDIR)/qjscalc.o + endif +-HOST_LIBS=-lm -ldl -lpthread ++HOST_LIBS=-lm -lpthread LIBS=-lm ifndef CONFIG_WIN32 --LIBS+=-ldl -+LIBS+= +-LIBS+=-ldl -lpthread ++LIBS+=-lpthread endif $(OBJDIR): diff --git a/lang/quickjs/patches/patch-qjs_c b/lang/quickjs/patches/patch-qjs_c index 78140897522..41971ad0a82 100644 --- a/lang/quickjs/patches/patch-qjs_c +++ b/lang/quickjs/patches/patch-qjs_c @@ -1,9 +1,9 @@ -$OpenBSD: patch-qjs_c,v 1.1.1.1 2019/12/21 14:24:03 bcallah Exp $ +$OpenBSD: patch-qjs_c,v 1.2 2020/09/23 15:37:32 bcallah Exp $ Index: qjs.c --- qjs.c.orig +++ qjs.c -@@ -130,7 +130,7 @@ static inline size_t js_trace_malloc_usable_size(void +@@ -152,7 +152,7 @@ static inline size_t js_trace_malloc_usable_size(void return malloc_usable_size(ptr); #else /* change this to `return 0;` if compilation fails */ @@ -12,7 +12,7 @@ Index: qjs.c #endif } -@@ -246,7 +246,7 @@ static const JSMallocFunctions trace_mf = { +@@ -268,7 +268,7 @@ static const JSMallocFunctions trace_mf = { (size_t (*)(const void *))malloc_usable_size, #else /* change this to `NULL,` if compilation fails */ diff --git a/lang/quickjs/patches/patch-qjsc_c b/lang/quickjs/patches/patch-qjsc_c index 5f417d36211..bb2aaa90fc9 100644 --- a/lang/quickjs/patches/patch-qjsc_c +++ b/lang/quickjs/patches/patch-qjsc_c @@ -1,4 +1,4 @@ -$OpenBSD: patch-qjsc_c,v 1.1.1.1 2019/12/21 14:24:03 bcallah Exp $ +$OpenBSD: patch-qjsc_c,v 1.2 2020/09/23 15:37:32 bcallah Exp $ Remove -ldl @@ -10,6 +10,6 @@ Index: qjsc.c *arg++ = libjsname; *arg++ = "-lm"; - *arg++ = "-ldl"; + *arg++ = "-lpthread"; *arg = NULL; - if (verbose) { diff --git a/lang/quickjs/patches/patch-quickjs-libc_c b/lang/quickjs/patches/patch-quickjs-libc_c index c1c1ca487fb..24ed682c68d 100644 --- a/lang/quickjs/patches/patch-quickjs-libc_c +++ b/lang/quickjs/patches/patch-quickjs-libc_c @@ -1,14 +1,17 @@ -$OpenBSD: patch-quickjs-libc_c,v 1.1.1.1 2019/12/21 14:24:03 bcallah Exp $ +$OpenBSD: patch-quickjs-libc_c,v 1.2 2020/09/23 15:37:32 bcallah Exp $ Index: quickjs-libc.c --- quickjs-libc.c.orig +++ quickjs-libc.c -@@ -45,7 +45,7 @@ - #include - #include - #include --#if defined(__APPLE__) -+#if defined(__APPLE__) || defined(__OpenBSD__) - typedef sig_t sighandler_t; +@@ -55,6 +55,11 @@ typedef sig_t sighandler_t; #endif + #endif /* __APPLE__ */ + ++#if defined(__OpenBSD__) ++typedef sig_t sighandler_t; ++extern char **environ; ++#endif ++ #endif + + #if !defined(_WIN32) diff --git a/lang/quickjs/patches/patch-quickjs_c b/lang/quickjs/patches/patch-quickjs_c index 2d5f8bec4fe..2a4fab146bb 100644 --- a/lang/quickjs/patches/patch-quickjs_c +++ b/lang/quickjs/patches/patch-quickjs_c @@ -1,9 +1,9 @@ -$OpenBSD: patch-quickjs_c,v 1.1.1.1 2019/12/21 14:24:03 bcallah Exp $ +$OpenBSD: patch-quickjs_c,v 1.2 2020/09/23 15:37:32 bcallah Exp $ Index: quickjs.c --- quickjs.c.orig +++ quickjs.c -@@ -1349,7 +1349,7 @@ static inline size_t js_def_malloc_usable_size(void *p +@@ -1667,7 +1667,7 @@ static inline size_t js_def_malloc_usable_size(void *p return malloc_usable_size(ptr); #else /* change this to `return 0;` if compilation fails */ @@ -12,7 +12,7 @@ Index: quickjs.c #endif } -@@ -1423,7 +1423,7 @@ static const JSMallocFunctions def_malloc_funcs = { +@@ -1741,7 +1741,7 @@ static const JSMallocFunctions def_malloc_funcs = { (size_t (*)(const void *))malloc_usable_size, #else /* change this to `NULL,` if compilation fails */ diff --git a/lang/quickjs/patches/patch-quickjs_h b/lang/quickjs/patches/patch-quickjs_h deleted file mode 100644 index 6e70091ea9e..00000000000 --- a/lang/quickjs/patches/patch-quickjs_h +++ /dev/null @@ -1,16 +0,0 @@ -$OpenBSD: patch-quickjs_h,v 1.1 2020/01/15 14:30:50 jca Exp $ - -Use more generic test for 64 bits platform. - -Index: quickjs.h ---- quickjs.h.orig -+++ quickjs.h -@@ -53,7 +53,7 @@ typedef struct JSClass JSClass; - typedef uint32_t JSClassID; - typedef uint32_t JSAtom; - --#if defined(__x86_64__) || defined(__aarch64__) -+#if defined(__LP64__) - #define JS_PTR64 - #define JS_PTR64_DEF(a) a - #else diff --git a/lang/quickjs/patches/patch-tests_test_builtin_js b/lang/quickjs/patches/patch-tests_test_builtin_js index 1a8be2d806d..0a65820523d 100644 --- a/lang/quickjs/patches/patch-tests_test_builtin_js +++ b/lang/quickjs/patches/patch-tests_test_builtin_js @@ -1,14 +1,16 @@ -$OpenBSD: patch-tests_test_builtin_js,v 1.1.1.1 2019/12/21 14:24:03 bcallah Exp $ +$OpenBSD: patch-tests_test_builtin_js,v 1.2 2020/09/23 15:37:32 bcallah Exp $ Disable tests that fail on OpenBSD. More info: https://github.com/NetBSD/pkgsrc/blob/trunk/lang/quickjs/patches/patch-tests_test__builtin.js +Fix the Float32Array test on big-endian platforms. + Index: tests/test_builtin.js --- tests/test_builtin.js.orig +++ tests/test_builtin.js -@@ -304,12 +304,12 @@ function test_number() - assert(parseFloat("123.2"), 123.2); - assert(parseFloat("123.2e3"), 123200); +@@ -313,12 +313,12 @@ function test_number() + assert(Number.isNaN(Number("-"))); + assert(Number.isNaN(Number("\x00a"))); - assert((25).toExponential(0), "3e+1"); - assert((-25).toExponential(0), "-3e+1"); @@ -25,3 +27,17 @@ Index: tests/test_builtin.js } function test_eval2() +@@ -412,11 +412,11 @@ function test_typed_array() + a[0] = -1; + + a = new Float32Array(buffer, 8, 1); +- a[0] = 1; ++ a[0] = 8651851; + + a = new Uint8Array(buffer); + +- assert(a.toString(), "0,0,255,255,0,0,0,0,0,0,128,63,255,255,255,255"); ++ assert(a.toString(), "0,0,255,255,0,0,0,0,75,4,4,75,255,255,255,255"); + + assert(a.buffer, buffer); + diff --git a/lang/quickjs/patches/patch-tests_test_std_js b/lang/quickjs/patches/patch-tests_test_std_js new file mode 100644 index 00000000000..3b95cf76f61 --- /dev/null +++ b/lang/quickjs/patches/patch-tests_test_std_js @@ -0,0 +1,20 @@ +$OpenBSD: patch-tests_test_std_js,v 1.1 2020/09/23 15:37:32 bcallah Exp $ + +This test waits forever if the process ignores SIGQUIT. + +Index: tests/test_std.js +--- tests/test_std.js.orig ++++ tests/test_std.js +@@ -252,10 +252,10 @@ function test_os_exec() + + pid = os.exec(["cat"], { block: false } ); + assert(pid >= 0); +- os.kill(pid, os.SIGQUIT); ++ os.kill(pid, os.SIGTERM); + [ret, status] = os.waitpid(pid, 0); + assert(ret, pid); +- assert(status & 0x7f, os.SIGQUIT); ++ assert(status & 0x7f, os.SIGTERM); + } + + function test_timer() diff --git a/lang/quickjs/pkg/PLIST b/lang/quickjs/pkg/PLIST index 5f499a5f7b3..bf8757a1daf 100644 --- a/lang/quickjs/pkg/PLIST +++ b/lang/quickjs/pkg/PLIST @@ -1,7 +1,5 @@ -@comment $OpenBSD: PLIST,v 1.1.1.1 2019/12/21 14:24:03 bcallah Exp $ +@comment $OpenBSD: PLIST,v 1.2 2020/09/23 15:37:32 bcallah Exp $ @bin bin/qjs -@bin bin/qjsbn -@bin bin/qjsbnc @bin bin/qjsc bin/qjscalc include/quickjs/ @@ -9,4 +7,3 @@ include/quickjs/quickjs-libc.h include/quickjs/quickjs.h lib/quickjs/ @static-lib lib/quickjs/libquickjs.a -@static-lib lib/quickjs/libquickjs.bn.a