diff --git a/CHANGES b/CHANGES --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,19 @@ All ports committers are allowed to commit to this file. +20220103: +AUTHOR: tagattie@FreeBSD.org + + nodejs.mk has gained support for specifying a NodeJS package manager (NPM or + Yarn) used along with NodeJS. For example: + + USE_NODEJS=npm + + adds a BUILD_DEPENDS on www/npm, www/npm-node14, or www/npm-node16 depending + on the NodeJS major version you choose with USES=nodejs. + + See nodejs.mk for more details on the available flags + 20211211: AUTHOR: tcberner@FreeBSD.org diff --git a/Mk/Uses/nodejs.mk b/Mk/Uses/nodejs.mk --- a/Mk/Uses/nodejs.mk +++ b/Mk/Uses/nodejs.mk @@ -7,6 +7,34 @@ # Default is: build,run # Note: if you define a version, you must provide run and/or build # +# Variables, which can be set by a port +# +# USE_NODEJS: Indicates a NodeJS package manager the port uses. +# +# Supported package managers are: +# npm[:ARGS] The port uses NPM as the package manager. +# yarn[:ARGS] The port uses Yarn as the package manager. +# +# Valid ARGS: fetch, extract, patch, build, run, test +# fetch: Indicates the package manager is needed at +# fetch time and adds it to FETCH_DEPENDS. +# extract: Indicates the package manager is needed at +# extract time and adds it to EXTRACT_DEPENDS. +# patch: Indicates the package manager is needed at +# patch time and adds it to PATCH_DEPENDS. +# build: Indicates the package manager is needed at +# build time and adds it to BUILD_DEPENDS. +# run: Indicates the package manager is needed at +# run time and adds it to RUN_DEPENDS. +# test: Indicates the package manager is needed at +# test time and adds it to TEST_DEPENDS. +# Note: If the port specifies none of them, we assume the port +# requires the package manager at build time only. +# +# Exported variables: +# +# NODEJS_PACKAGE_MANAGER: The chosen NodeJS package manager. +# # MAINTAINER: bhughes@FreeBSD.org .if !defined(_INCLUDE_USES_NODEJS_MK) @@ -57,4 +85,32 @@ BUILD_DEPENDS+= node:www/node${_NODEJS_VERSION_SUFFIX} . endif +.if defined(USE_NODEJS) +_VALID_NODEJS_FEATURE= npm yarn + +_NODEJS_FEATURE= ${USE_NODEJS:C/:.*//} +_NODEJS_FEATURE_ARGS= ${USE_NODEJS:C/^[^:]*(:|\$)//} + +. if !${_VALID_NODEJS_FEATURE:M${_NODEJS_FEATURE}} +IGNORE= specifies unknown USE_NODEJS feature: ${_NODEJS_FEATURE} +. endif +. if empty(_NODEJS_FEATURE_ARGS) +_NODEJS_FEATURE_ARGS= build +. endif + +. if empty(_NODEJS_VERSION_SUFFIX) +_NODEJS_FEATURE_DEP= www/${_NODEJS_FEATURE}>0:www/${_NODEJS_FEATURE} +. else +_NODEJS_FEATURE_DEP= www/${_NODEJS_FEATURE}-node${_NODEJS_VERSION_SUFFIX}>0:www/${_NODEJS_FEATURE}-node${_NODEJS_VERSION_SUFFIX} +. endif + +. for phase in fetch extract patch build run test +. if ${_NODEJS_FEATURE_ARGS:M*${phase}*} +${phase:tu}_DEPENDS+= ${_NODEJS_FEATURE_DEP} +. endif +. endfor + +NODEJS_PKG_MANAGER= ${_NODEJS_FEATURE} +.endif # USE_NODEJS + .endif diff --git a/security/greenbone-security-assistant/Makefile b/security/greenbone-security-assistant/Makefile --- a/security/greenbone-security-assistant/Makefile +++ b/security/greenbone-security-assistant/Makefile @@ -11,7 +11,6 @@ LICENSE= AGPLv3+ -BUILD_DEPENDS= yarn:www/yarn LIB_DEPENDS= libgvm_base.so:security/gvm-libs \ libgnutls.so:security/gnutls \ libgcrypt.so:security/libgcrypt \ @@ -22,6 +21,7 @@ USES= cmake gettext-runtime gnome nodejs:build pkgconfig python USE_GNOME= glib20 libxml2 +USE_NODEJS= yarn USE_GITHUB= yes GH_ACCOUNT= greenbone diff --git a/textproc/kibana7/Makefile b/textproc/kibana7/Makefile --- a/textproc/kibana7/Makefile +++ b/textproc/kibana7/Makefile @@ -14,7 +14,6 @@ LICENSE= APACHE20 -BUILD_DEPENDS= npm-node16>0:www/npm-node16 LIB_DEPENDS= libre2.so:devel/re2 \ libuv.so:devel/libuv @@ -24,6 +23,7 @@ USE_GITHUB= nodefault GH_TUPLE= nodejs:nan:v${_NODE_NAN_VER}:node_nan \ uhop:node-re2:${_NODE_RE2_VER}:node_re2 +USE_NODEJS= npm USE_RC_SUBR= ${PORTNAME} diff --git a/textproc/opensearch-dashboards/Makefile b/textproc/opensearch-dashboards/Makefile --- a/textproc/opensearch-dashboards/Makefile +++ b/textproc/opensearch-dashboards/Makefile @@ -10,9 +10,8 @@ LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE.txt -BUILD_DEPENDS= npm-node14>0:www/npm-node14 - USES= nodejs:14,build,run python:build +USE_NODEJS= npm USE_RC_SUBR= ${PORTNAME} OPTIONS_DEFINE= CHROME diff --git a/textproc/write-good/Makefile b/textproc/write-good/Makefile --- a/textproc/write-good/Makefile +++ b/textproc/write-good/Makefile @@ -11,11 +11,10 @@ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE -BUILD_DEPENDS= npm:www/npm - USES= nodejs:run USE_GITHUB= yes GH_ACCOUNT= btford +USE_NODEJS= npm NO_ARCH= yes NO_BUILD= yes