diff --git a/Mk/Uses/nodejs.mk b/Mk/Uses/nodejs.mk new file mode 100644 --- /dev/null +++ b/Mk/Uses/nodejs.mk @@ -0,0 +1,60 @@ +# Provide support for NodeJS +# +# Feature: nodejs +# Usage: USES=nodejs or USES=nodejs:args +# Valid ARGS: build and/or run +# version: lts, current, 10, 14, 16, 17 +# Default is: build,run +# Note: if you define a version, you must provide run and/or build +# +# MAINTAINER: bhughes@FreeBSD.org + +.if !defined(_INCLUDE_USES_NODEJS_MK) +_INCLUDE_USES_NODEJS_MK= yes + +_VALID_NODEJS_VERSION= 10 14 16 17 lts current +_NODEJS_VERSION_SUFFIX= ${NODEJS_DEFAULT} + +.if ! ${_VALID_NODEJS_VERSION:M${_NODEJS_VERSION_SUFFIX}} +IGNORE= Invalid nodejs default version ${_NODEJS_VERSION_SUFFIX}; valid versions are ${_VALID_NODEJS_VERSION} +.endif + +.if empty(nodejs_ARGS) +nodejs_ARGS= build,run +.endif + +. if ${nodejs_ARGS:M10} +_NODEJS_VERSION_SUFFIX= 10 +. elif ${nodejs_ARGS:M14} +_NODEJS_VERSION_SUFFIX= 14 +. elif ${nodejs_ARGS:M16} +_NODEJS_VERSION_SUFFIX= 16 +. elif ${nodejs_ARGS:Mlts} +_NODEJS_VERSION_SUFFIX= lts +. elif ${nodejs_ARGS:M17} +_NODEJS_VERSION_SUFFIX= 17 +. elif ${nodejs_ARGS:Mcurrent} +_NODEJS_VERSION_SUFFIX= current +. elif defined(NODEJS_DEFAULT) +. endif + +# The nodejs 17 version is named www/node +. if ${_NODEJS_VERSION_SUFFIX:Mcurrent} +_NODEJS_VERSION_SUFFIX= +. endif +. if ${_NODEJS_VERSION_SUFFIX:M17} +_NODEJS_VERSION_SUFFIX= +. endif +# The nodejs LTS is version 16 +. if ${_NODEJS_VERSION_SUFFIX:Mlts} +_NODEJS_VERSION_SUFFIX= 16 +. endif + +. if ${nodejs_ARGS:M*run*} +RUN_DEPENDS+= node:www/node${_NODEJS_VERSION_SUFFIX} +. endif +. if ${nodejs_ARGS:M*build*} +BUILD_DEPENDS+= node:www/node${_NODEJS_VERSION_SUFFIX} +. endif + +.endif diff --git a/Mk/bsd.default-versions.mk b/Mk/bsd.default-versions.mk --- a/Mk/bsd.default-versions.mk +++ b/Mk/bsd.default-versions.mk @@ -18,7 +18,7 @@ LOCALBASE?= /usr/local .for lang in APACHE BDB COROSYNC EMACS FIREBIRD FORTRAN FPC GCC GHOSTSCRIPT GL \ - IMAGEMAGICK JAVA LAZARUS LIBRSVG2 LINUX LLVM LUA MYSQL NINJA PERL5 \ + IMAGEMAGICK JAVA LAZARUS LIBRSVG2 LINUX LLVM LUA MYSQL NINJA NODEJS PERL5 \ PGSQL PHP PYTHON PYTHON2 PYTHON3 RUBY RUST SAMBA SSL TCLTK VARNISH .if defined(${lang}_DEFAULT) ERROR+= "The variable ${lang}_DEFAULT is set and it should only be defined through DEFAULT_VERSIONS+=${lang:tl}=${${lang}_DEFAULT} in /etc/make.conf" @@ -163,4 +163,7 @@ # Possible values: 4, 6 VARNISH_DEFAULT?= 4 +# Possible value: 10, 14, 16, 17, lts, current +NODEJS_DEFAULT?= lts + .endif diff --git a/UPDATING b/UPDATING --- a/UPDATING +++ b/UPDATING @@ -5,6 +5,25 @@ You should get into the habit of checking this file for changes each time you update your ports collection, before attempting any port upgrades. +20211110: + AFFECTS: users of www/node*, www/npm*, www/yarn* + AUTHOR: mfechner@FreeBSD.org + + The port framework was updated to use a default version for nodejs. + The default version is pointing to the latest LTS version which is + currently version 16. + You can overwrite this by defining in /etc/make.conf, e.g. version 17: + DEFAULT_VERSIONS=nodejs=17 + + Or if you would like to stick always to the current version use: + DEFAULT_VERSIONS=nodejs=current + + If you would like to use yarn or npm together with nodejs version 17, + just install the package that is pulling the wanted dependency to nodejs: + + # pkg install yarn-node17 + # pkg install npm-node17 + 20211109: AFFECTS: users of security/libressl AUTHOR: brnrd@FreeBSD.org