6228cf64db
2023-06-30 www/node19: Nodejs 19.* will reach its EoL on 2023-06-01. Use Node.js 18.* (www/node18) or 20.* (www/node20) instead Approved by: portmgr (blanket)
60 lines
1.6 KiB
Makefile
60 lines
1.6 KiB
Makefile
# Provide support for Node.js
|
|
#
|
|
# Feature: nodejs
|
|
#
|
|
# Usage: USES=nodejs[:args]
|
|
# Valid args:
|
|
# - build use node as build-time dependency
|
|
# - run use node as runtime dependency
|
|
# - env set the environment (NODEJS_VERSION and NODEJS_SUFFIX)
|
|
# - version available version: lts, current, 16, 18, 20
|
|
#
|
|
# Note:
|
|
# - The supported versions follow upstream release schedule
|
|
# https://github.com/nodejs/Release/blob/main/README.md#release-schedule
|
|
# - lts is 18 now
|
|
# - current is 20 now
|
|
# - USES=nodejs means USES=nodejs:build,run
|
|
# - If you define a version, you must provide run and/or build
|
|
#
|
|
# MAINTAINER: sunpoet@FreeBSD.org
|
|
|
|
.if !defined(_INCLUDE_USES_NODEJS_MK)
|
|
_INCLUDE_USES_NODEJS_MK= yes
|
|
|
|
_VALID_NODEJS_VERSIONS= 16 18 20 current lts
|
|
|
|
. if ! ${_VALID_NODEJS_VERSIONS:M${NODEJS_DEFAULT}}
|
|
IGNORE= Invalid default nodejs version ${NODEJS_DEFAULT}; valid versions are ${_VALID_NODEJS_VERSIONS}
|
|
. endif
|
|
|
|
. if !empty(nodejs_ARGS:Nbuild:Nenv:Nrun:Nlts:Ncurrent:N16:N18:N20)
|
|
IGNORE= USES=nodejs has invalid arguments ${nodejs_ARGS}
|
|
. endif
|
|
|
|
. if empty(nodejs_ARGS)
|
|
nodejs_ARGS= build,run
|
|
. endif
|
|
|
|
.undef _NODEJS_VER
|
|
. for version in ${_VALID_NODEJS_VERSIONS}
|
|
. if ${nodejs_ARGS:M${version}}
|
|
_NODEJS_VER= ${version}
|
|
. endif
|
|
. endfor
|
|
|
|
. if !defined(_NODEJS_VER)
|
|
_NODEJS_VER= ${NODEJS_DEFAULT}
|
|
. endif
|
|
|
|
NODEJS_VERSION= ${_NODEJS_VER:S|current|20|:S|lts|18|}
|
|
NODEJS_SUFFIX= -node${NODEJS_VERSION}
|
|
|
|
. if ${nodejs_ARGS:M*build*}
|
|
BUILD_DEPENDS+= node:www/node${NODEJS_VERSION}
|
|
. endif
|
|
. if ${nodejs_ARGS:M*run*}
|
|
RUN_DEPENDS+= node:www/node${NODEJS_VERSION}
|
|
. endif
|
|
|
|
.endif
|