commit 3d12053055fe5186cd4def0d9b9d318436cf58fc Author: Bradley T. Hughes Date: Sun Oct 30 21:22:35 2016 +0000 Add USES=node[:args] for specifying a dependency on Node.js This is based lightly on Mk/Uses/python.mk. Add build, run, test dependencies based on the arguments received. If the port does not explicitly set a version, use a default which can be overridden by the user. diff --git Mk/Uses/node.mk Mk/Uses/node.mk new file mode 100644 index 0000000..24b0961 --- /dev/null +++ Mk/Uses/node.mk @@ -0,0 +1,79 @@ +# $FreeBSD$ +# +# Provide support for Node.js +# +# Feature: node +# Usage: USES=node, or USES=node:args +# Valid ARGS: , build, run, test +# +# version The major version of Node.js required by your port. If omitted, +# the default version is used. The user can choose which Node.js +# version to use as the default using: +# +# DEFAULT_VERSIONS+= node= +# +# build Indicates that Python is needed at build time and adds +# it to BUILD_DEPENDS. +# run Indicates that Python is needed at run time and adds +# it to RUN_DEPENDS. +# test Indicates that Python is needed at test time and adds +# it to TEST_DEPENDS. +# +# If build, run and test are omitted, Node.js will be added as BUILD_DEPENDS, +# RUN_DEPENDS and TEST_DEPENDS. +# +# MAINTAINER: bradleythughes@fastmail.fm + +.if !defined(_INCLUDE_USES_NODE_MK) +_INCLUDE_USES_NODE_MK= yes + + +# Make sure that no dependency or some other environment variable +# pollutes the build/run dependency detection +.undef _NODE_BUILD_DEP +.undef _NODE_RUN_DEP +.undef _NODE_TEST_DEP +_NODE_ARGS= ${node_ARGS:S/,/ /g} +.if ${_NODE_ARGS:Mbuild} +_NODE_BUILD_DEP= yes +_NODE_ARGS:= ${_NODE_ARGS:Nbuild} +.endif +.if ${_NODE_ARGS:Mrun} +_NODE_RUN_DEP= yes +_NODE_ARGS:= ${_NODE_ARGS:Nrun} +.endif +.if ${_NODE_ARGS:Mtest} +_NODE_TEST_DEP= yes +_NODE_ARGS:= ${_NODE_ARGS:Ntest} +.endif + +# The port does not specify a build, run or test dependency, assume all are +# required. +.if !defined(_NODE_BUILD_DEP) && !defined(_NODE_RUN_DEP) && \ + !defined(_NODE_TEST_DEP) && !defined(NODE_NO_DEPENDS) +_NODE_BUILD_DEP= yes +_NODE_RUN_DEP= yes +_NODE_TEST_DEP= yes +.endif + + +# The remaining argument, if any, is the Node.js major version to use. +_NODE_VERSION= ${_NODE_ARGS} +.if empty(_NODE_VERSION) +_NODE_VERSION= ${NODE_DEFAULT} +.endif + + +# Add build, run, and test dependencies as required. +.if defined(_NODE_BUILD_DEP) +BUILD_DEPENDS+= node${_NODE_VERSION}>=${_NODE_VERSION}:www/node${_NODE_VERSION} +.endif +.if defined(_NODE_RUN_DEP) +RUN_DEPENDS+= node${_NODE_VERSION}>=${_NODE_VERSION}:www/node${_NODE_VERSION} +.endif +.if defined(_NODE_TEST_DEP) +TEST_DEPENDS+= node${_NODE_VERSION}>=${_NODE_VERSION}:www/node${_NODE_VERSION} +.endif + + +.endif # _INCLUDE_USES_NODE_MK diff --git Mk/bsd.default-versions.mk Mk/bsd.default-versions.mk index 4669c39..a7c924f 100644 --- Mk/bsd.default-versions.mk +++ Mk/bsd.default-versions.mk @@ -15,7 +15,7 @@ _INCLUDE_BSD_DEFAULT_VERSIONS_MK= yes LOCALBASE?= /usr/local -.for lang in APACHE BDB FIREBIRD FPC GCC GHOSTSCRIPT LINUX LUA MYSQL PERL6 \ +.for lang in APACHE BDB FIREBIRD FPC GCC GHOSTSCRIPT LINUX LUA MYSQL NODE PERL6 \ PGSQL PHP PYTHON PYTHON2 PYTHON3 RUBY SSL TCLTK .if defined(${lang}_DEFAULT) WARNING+= "The variable ${lang}_DEFAULT is set and it should only be defined through DEFAULT_VERSIONS+=${lang:tl}=${${lang}_DEFAULT} in /etc/make.conf" @@ -51,6 +51,8 @@ WARNING+= "OVERRIDE_LINUX_BASE_PORT is deprecated, please use DEFAULT_VERSIONS+ LUA_DEFAULT?= 5.2 # Possible values: 5.1, 5.5, 5.6, 5.7, 5.5m, 10.0m, 10.1m, 5.5p, 5.6p MYSQL_DEFAULT?= 5.6 +# Possible values: 012, 4, 6, 7 +NODE_DEFAULT?= 7 # Possible values: 5.18, 5.20, 5.22, devel .if !exists(${LOCALBASE}/bin/perl) || (!defined(_PORTS_ENV_CHECK) && \ defined(PACKAGE_BUILDING))