pkgsrc/lang/nodejs/Makefile.common
adam f189f904ab nodejs: updated to 21.1.0
Version 21.1.0 (Current)

Notable Changes

Automatically detect and run ESM syntax

The new flag --experimental-detect-module can be used to automatically run ES modules when their syntax can be detected. For “ambiguous” files, which are .js or extensionless files with no package.json with a type field, Node.js will parse the file to detect ES module syntax; if found, it will run the file as an ES module, otherwise it will run the file as a CommonJS module. The same applies to string input via --eval or STDIN.

We hope to make detection enabled by default in a future version of Node.js. Detection increases startup time, so we encourage everyone — especially package authors — to add a type field to package.json, even for the default "type": "commonjs". The presence of a type field, or explicit extensions such as .mjs or .cjs, will opt out of detection.


vm: fix V8 compilation cache support for vm.Script

Previously repeated compilation of the same source code using vm.Script stopped hitting the V8 compilation cache after v16.x when support for importModuleDynamically was added to vm.Script, resulting in a performance regression that blocked users (in particular Jest users) from upgrading from v16.x.

The recent fixes landed in v21.1.0 allow the compilation cache to be hit again for vm.Script when --experimental-vm-modules is not used even in the presence of the importModuleDynamically option, so that users affected by the performance regression can now upgrade. Ongoing work is also being done to enable compilation cache support for vm.CompileFunction.
2023-11-02 13:18:15 +00:00

109 lines
3.1 KiB
Makefile

# $NetBSD: Makefile.common,v 1.52 2023/11/02 13:18:15 adam Exp $
# used by lang/nodejs/Makefile
# used by lang/nodejs14/Makefile
# used by lang/nodejs16/Makefile
# used by lang/nodejs18/Makefile
CATEGORIES= lang
MASTER_SITES= https://nodejs.org/dist/${DISTNAME:S/node-//}/
PKGNAME= ${DISTNAME:S/-v/js-/}
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://nodejs.org/
COMMENT= V8 JavaScript for clients and servers
LICENSE= mit
HAS_CONFIGURE= yes
USE_TOOLS+= bash gmake pkg-config
PYTHON_FOR_BUILD_ONLY= yes
CONFLICTS+= npm-[0-9]*
SUPERSEDES+= npm-[0-9]*
GCC_REQD+= 4.9.4
CONFIG_SHELL= ${PYTHONBIN}
CONFIGURE_ARGS+= --prefix=${PREFIX}
CONFIGURE_ARGS+= --shared-brotli
CONFIGURE_ARGS+= --shared-cares
CONFIGURE_ARGS+= --shared-libuv
CONFIGURE_ARGS+= --shared-nghttp2
CONFIGURE_ARGS+= --shared-zlib
CONFIGURE_ARGS+= --with-intl=system-icu
PTHREAD_AUTO_VARS= yes
CONFIGURE_ENV.NetBSD+= GYP_DEFINES="OS=netbsd"
MAKE_ENV.NetBSD+= GYP_DEFINES="OS=netbsd"
.if ${MACHINE_ARCH} == "powerpc"
CONFIGURE_ARGS+= --dest-cpu=ppc
.endif
.if ${OPSYS} == "Linux" && !exists(/usr/bin/gold)
CONFIGURE_ENV+= GYP_DEFINES="linux_use_gold_flags=0"
.endif
# see patch-configure.py and patch-tools_gyp_pylib_gyp_input.py
TOOL_DEPENDS+= ${PYPKGPREFIX}-packaging-[0-9]*:../../devel/py-packaging
REPLACE_NODEJS+= deps/corepack/dist/*.js
REPLACE_NODEJS+= deps/npm/bin/*.js
REPLACE_PYTHON+= configure
REPLACE_PYTHON+= tools/genv8constants.py
REPLACE_PYTHON+= tools/gyp/pylib/gyp/flock_tool.py
.if ${OPSYS} == "NetBSD"
TOOL_DEPENDS+= lockf-[0-9]*:../../sysutils/lockf
BUILDLINK_TRANSFORM+= rm:-ldl
.endif
TEST_TARGET= check
CHECK_INTERPRETER_SKIP+= lib/node_modules/npm/*
.if defined(TOOLS_PLATFORM.paxctl)
SUBST_CLASSES+= mktools
SUBST_STAGE.mktools= post-configure
# nodejs8
SUBST_FILES.mktools+= out/deps/v8/src/mksnapshot.target.mk
# nodejs10
SUBST_FILES.mktools+= out/deps/v8/gypfiles/mksnapshot.target.mk
# nodejs12
SUBST_FILES.mktools+= out/mkcodecache.target.mk
SUBST_FILES.mktools+= out/tools/v8_gypfiles/mksnapshot.target.mk
# nodejs13
SUBST_FILES.mktools+= out/node_mksnapshot.target.mk
SUBST_SED.mktools+= -e 's|call do_cmd,link)|call do_cmd,link)\${.newline} ${TOOLS_PLATFORM.paxctl} +m $$@|'
SUBST_NOOP_OK.mktools= yes # because of the different affected files
.endif
CFLAGS.SunOS+= -D_FILE_OFFSET_BITS=64
CXXFLAGS.SunOS+= -D_FILE_OFFSET_BITS=64
pre-install:
${CHMOD} -R g-w ${WRKSRC}
.PHONY: paxctl
post-install: paxctl
paxctl:
.if defined(TOOLS_PLATFORM.paxctl)
${TOOLS_PLATFORM.paxctl} +m ${DESTDIR}${PREFIX}/bin/node
.endif
.if ${OPSYS} != "Darwin"
.include "../../devel/libexecinfo/buildlink3.mk"
.endif
.include "../../archivers/brotli/buildlink3.mk"
BUILDLINK_API_DEPENDS.libuv+= libuv>=1.41
.include "../../devel/libuv/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../lang/nodejs/application.mk"
.include "../../lang/python/application.mk"
.include "../../lang/python/tool.mk"
.include "../../net/libcares/buildlink3.mk"
.include "../../textproc/icu/buildlink3.mk"
# Requires nghttp2_option_set_max_settings
BUILDLINK_API_DEPENDS.nghttp2+= nghttp2>=1.41.0
.include "../../www/nghttp2/buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"