diff options
author | rillig <rillig@pkgsrc.org> | 2019-11-14 21:20:04 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2019-11-14 21:20:04 +0000 |
commit | f8e76823aacaa761e774197db25dd95eb21340ba (patch) | |
tree | 23bdfdc6d67abe76e74f7e2657bd2b44c0a5a2f2 /lang/quickjs | |
parent | da402b92fa90dc57686abbf100a69f6e826e83f5 (diff) | |
download | pkgsrc-f8e76823aacaa761e774197db25dd95eb21340ba.tar.gz |
lang/quickjs: imported version 2019-10-27
QuickJS is a small and embeddable Javascript engine. It supports the
ES2020 specification including modules, asynchronous generators and
proxies. It optionally supports mathematical extensions such as big
integers (BigInt), big floating point numbers (BigFloat) and operator
overloading.
Diffstat (limited to 'lang/quickjs')
-rw-r--r-- | lang/quickjs/DESCR | 5 | ||||
-rw-r--r-- | lang/quickjs/Makefile | 17 | ||||
-rw-r--r-- | lang/quickjs/PLIST | 10 | ||||
-rw-r--r-- | lang/quickjs/distinfo | 12 | ||||
-rw-r--r-- | lang/quickjs/patches/patch-Makefile | 59 | ||||
-rw-r--r-- | lang/quickjs/patches/patch-cutils.h | 37 | ||||
-rw-r--r-- | lang/quickjs/patches/patch-qjs.c | 24 | ||||
-rw-r--r-- | lang/quickjs/patches/patch-qjsc.c | 16 | ||||
-rw-r--r-- | lang/quickjs/patches/patch-quickjs-libc.c | 15 | ||||
-rw-r--r-- | lang/quickjs/patches/patch-quickjs.c | 24 |
10 files changed, 219 insertions, 0 deletions
diff --git a/lang/quickjs/DESCR b/lang/quickjs/DESCR new file mode 100644 index 00000000000..fc9097690c9 --- /dev/null +++ b/lang/quickjs/DESCR @@ -0,0 +1,5 @@ +QuickJS is a small and embeddable Javascript engine. It supports the +ES2020 specification including modules, asynchronous generators and +proxies. It optionally supports mathematical extensions such as big +integers (BigInt), big floating point numbers (BigFloat) and operator +overloading. diff --git a/lang/quickjs/Makefile b/lang/quickjs/Makefile new file mode 100644 index 00000000000..c15d5d238a0 --- /dev/null +++ b/lang/quickjs/Makefile @@ -0,0 +1,17 @@ +# $NetBSD: Makefile,v 1.1 2019/11/14 21:20:04 rillig Exp $ + +DISTNAME= quickjs-2019-10-27 +CATEGORIES= lang +MASTER_SITES= https://bellard.org/quickjs/ +EXTRACT_SUFX= .tar.xz + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= https://bellard.org/quickjs/ +COMMENT= Quick JavaScript interpreter +LICENSE= mit + +USE_TOOLS+= gmake +MAKE_FLAGS= prefix=${PREFIX} +TEST_TARGET= test + +.include "../../mk/bsd.pkg.mk" diff --git a/lang/quickjs/PLIST b/lang/quickjs/PLIST new file mode 100644 index 00000000000..0c5a3a7da4c --- /dev/null +++ b/lang/quickjs/PLIST @@ -0,0 +1,10 @@ +@comment $NetBSD: PLIST,v 1.1 2019/11/14 21:20:04 rillig Exp $ +bin/qjs +bin/qjsbn +bin/qjsbnc +bin/qjsc +bin/qjscalc +include/quickjs/quickjs-libc.h +include/quickjs/quickjs.h +lib/quickjs/libquickjs.a +lib/quickjs/libquickjs.bn.a diff --git a/lang/quickjs/distinfo b/lang/quickjs/distinfo new file mode 100644 index 00000000000..4c0f0a49df1 --- /dev/null +++ b/lang/quickjs/distinfo @@ -0,0 +1,12 @@ +$NetBSD: distinfo,v 1.1 2019/11/14 21:20:04 rillig Exp $ + +SHA1 (quickjs-2019-10-27.tar.xz) = 6d10526eecc6bbbd13f33262f796f30090195974 +RMD160 (quickjs-2019-10-27.tar.xz) = 4cd24d0d6c6c9fd23c2bc66d1e724e7e43985b22 +SHA512 (quickjs-2019-10-27.tar.xz) = 3654c8998b6c99fb42387c785e2be138b46b644025b2da5f26ecc6c1d58f32ef89b274763b0bcc5d25d86bbae217ec52576d13bf4e9cd81c6c2af46b692b73e9 +Size (quickjs-2019-10-27.tar.xz) = 763012 bytes +SHA1 (patch-Makefile) = 4cff6c51bbd44d80327f186f261c6c7899b2a031 +SHA1 (patch-cutils.h) = db3fad2bd422d2886538819ef778d13a391d6935 +SHA1 (patch-qjs.c) = 2a2d778bb43540dc5289f84cd9df43162c1ce291 +SHA1 (patch-qjsc.c) = 9a70bde5e19b65942d9f23c10d0b7b3e2741bfaa +SHA1 (patch-quickjs-libc.c) = 8a82afa9f13c9f7d53f8a94e377fbb4aa4471947 +SHA1 (patch-quickjs.c) = c411d8ed5539bcd77a504caf53541b7bddb51b5a diff --git a/lang/quickjs/patches/patch-Makefile b/lang/quickjs/patches/patch-Makefile new file mode 100644 index 00000000000..a7243551219 --- /dev/null +++ b/lang/quickjs/patches/patch-Makefile @@ -0,0 +1,59 @@ +$NetBSD: patch-Makefile,v 1.1 2019/11/14 21:20:04 rillig Exp $ + +Portability patch for NetBSD. + +--- Makefile.orig 2019-10-27 10:55:35.000000000 +0000 ++++ Makefile +@@ -22,13 +22,19 @@ + # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + # THE SOFTWARE. + +-ifeq ($(shell uname -s),Darwin) ++OPSYS=$(shell uname -s) ++ifeq ($(OPSYS),Darwin) + CONFIG_DARWIN=y + endif ++ifeq ($(OPSYS),NetBSD) ++CONFIG_NETBSD=y ++endif + # Windows cross compilation from Linux + #CONFIG_WIN32=y + # use link time optimization (smaller and faster executables but slower build) ++ifndef CONFIG_NETBSD + CONFIG_LTO=y ++endif + # consider warnings as errors (for development) + #CONFIG_WERROR=y + # force 32 bit build for some utilities +@@ -40,6 +46,10 @@ CONFIG_CLANG=y + CONFIG_DEFAULT_AR=y + endif + ++ifndef CONFIG_NETBSD ++CONFIG_LDL=y ++endif ++ + # installation directory + prefix=/usr/local + +@@ -165,8 +175,10 @@ QJSBN_OBJS=$(OBJDIR)/qjs.bn.o $(OBJDIR)/ + + LIBS=-lm + ifndef CONFIG_WIN32 ++ifndef CONFIG_NETBSD + LIBS+=-ldl + endif ++endif + + $(OBJDIR): + mkdir -p $(OBJDIR) $(OBJDIR)/examples $(OBJDIR)/tests +@@ -199,6 +211,9 @@ QJSC_DEFINES:=-DCONFIG_CC=\"$(QJSC_CC)\" + ifdef CONFIG_LTO + QJSC_DEFINES+=-DCONFIG_LTO + endif ++ifdef CONFIG_LDL ++QJSC_DEFINES+=-DCONFIG_LDL ++endif + QJSC_HOST_DEFINES:=-DCONFIG_CC=\"$(HOST_CC)\" -DCONFIG_PREFIX=\"$(prefix)\" + + $(OBJDIR)/qjsc.o $(OBJDIR)/qjsc.bn.o: CFLAGS+=$(QJSC_DEFINES) diff --git a/lang/quickjs/patches/patch-cutils.h b/lang/quickjs/patches/patch-cutils.h new file mode 100644 index 00000000000..d8e3e4018e6 --- /dev/null +++ b/lang/quickjs/patches/patch-cutils.h @@ -0,0 +1,37 @@ +$NetBSD: patch-cutils.h,v 1.1 2019/11/14 21:20:04 rillig Exp $ + +Portability patch for NetBSD. + +--- cutils.h.orig 2019-10-27 10:55:35.000000000 +0000 ++++ cutils.h +@@ -207,17 +207,22 @@ static inline void put_u8(uint8_t *tab, + *tab = val; + } + ++#ifndef bswap16 + static inline uint16_t bswap16(uint16_t x) + { + return (x >> 8) | (x << 8); + } ++#endif + ++#ifndef bswap32 + static inline uint32_t bswap32(uint32_t v) + { + return ((v & 0xff000000) >> 24) | ((v & 0x00ff0000) >> 8) | + ((v & 0x0000ff00) << 8) | ((v & 0x000000ff) << 24); + } ++#endif + ++#ifndef bswap64 + static inline uint64_t bswap64(uint64_t v) + { + return ((v & ((uint64_t)0xff << (7 * 8))) >> (7 * 8)) | +@@ -229,6 +234,7 @@ static inline uint64_t bswap64(uint64_t + ((v & ((uint64_t)0xff << (1 * 8))) << (5 * 8)) | + ((v & ((uint64_t)0xff << (0 * 8))) << (7 * 8)); + } ++#endif + + /* XXX: should take an extra argument to pass slack information to the caller */ + typedef void *DynBufReallocFunc(void *opaque, void *ptr, size_t size); diff --git a/lang/quickjs/patches/patch-qjs.c b/lang/quickjs/patches/patch-qjs.c new file mode 100644 index 00000000000..98a411c59f4 --- /dev/null +++ b/lang/quickjs/patches/patch-qjs.c @@ -0,0 +1,24 @@ +$NetBSD: patch-qjs.c,v 1.1 2019/11/14 21:20:04 rillig Exp $ + +Portability patch for NetBSD. + +--- qjs.c.orig 2019-10-27 10:55:35.000000000 +0000 ++++ qjs.c +@@ -124,7 +124,7 @@ static inline size_t js_trace_malloc_usa + return malloc_size(ptr); + #elif defined(_WIN32) + return _msize(ptr); +-#elif defined(EMSCRIPTEN) ++#elif defined(EMSCRIPTEN) || defined(__NetBSD__) + return 0; + #elif defined(__linux__) + return malloc_usable_size(ptr); +@@ -240,7 +240,7 @@ static const JSMallocFunctions trace_mf + malloc_size, + #elif defined(_WIN32) + (size_t (*)(const void *))_msize, +-#elif defined(EMSCRIPTEN) ++#elif defined(EMSCRIPTEN) || defined(__NetBSD__) + NULL, + #elif defined(__linux__) + (size_t (*)(const void *))malloc_usable_size, diff --git a/lang/quickjs/patches/patch-qjsc.c b/lang/quickjs/patches/patch-qjsc.c new file mode 100644 index 00000000000..461eb40f313 --- /dev/null +++ b/lang/quickjs/patches/patch-qjsc.c @@ -0,0 +1,16 @@ +$NetBSD: patch-qjsc.c,v 1.1 2019/11/14 21:20:04 rillig Exp $ + +Portability patch for NetBSD. + +--- qjsc.c.orig 2019-11-14 20:58:23.645680708 +0000 ++++ qjsc.c +@@ -450,7 +450,9 @@ static int output_executable(const char + lib_dir, bn_suffix, lto_suffix); + *arg++ = libjsname; + *arg++ = "-lm"; ++#ifdef CONFIG_LDL + *arg++ = "-ldl"; ++#endif + *arg = NULL; + + if (verbose) { diff --git a/lang/quickjs/patches/patch-quickjs-libc.c b/lang/quickjs/patches/patch-quickjs-libc.c new file mode 100644 index 00000000000..1006a807c7a --- /dev/null +++ b/lang/quickjs/patches/patch-quickjs-libc.c @@ -0,0 +1,15 @@ +$NetBSD: patch-quickjs-libc.c,v 1.1 2019/11/14 21:20:04 rillig Exp $ + +Portability patch for NetBSD. + +--- quickjs-libc.c.orig 2019-10-27 10:55:35.000000000 +0000 ++++ quickjs-libc.c +@@ -1652,7 +1652,7 @@ static void os_signal_handler(int sig_nu + os_pending_signals |= ((uint64_t)1 << sig_num); + } + +-#if defined(_WIN32) ++#if defined(_WIN32) || defined(__NetBSD__) + typedef void (*sighandler_t)(int sig_num); + #endif + diff --git a/lang/quickjs/patches/patch-quickjs.c b/lang/quickjs/patches/patch-quickjs.c new file mode 100644 index 00000000000..2643557152e --- /dev/null +++ b/lang/quickjs/patches/patch-quickjs.c @@ -0,0 +1,24 @@ +$NetBSD: patch-quickjs.c,v 1.1 2019/11/14 21:20:04 rillig Exp $ + +Portability patch for NetBSD. + +--- quickjs.c.orig 2019-10-27 10:55:35.000000000 +0000 ++++ quickjs.c +@@ -1343,7 +1343,7 @@ static inline size_t js_def_malloc_usabl + return malloc_size(ptr); + #elif defined(_WIN32) + return _msize(ptr); +-#elif defined(EMSCRIPTEN) ++#elif defined(EMSCRIPTEN) || defined(__NetBSD__) + return 0; + #elif defined(__linux__) + return malloc_usable_size(ptr); +@@ -1417,7 +1417,7 @@ static const JSMallocFunctions def_mallo + malloc_size, + #elif defined(_WIN32) + (size_t (*)(const void *))_msize, +-#elif defined(EMSCRIPTEN) ++#elif defined(EMSCRIPTEN) || defined(__NetBSD__) + NULL, + #elif defined(__linux__) + (size_t (*)(const void *))malloc_usable_size, |