Added
Link Here
|
1 |
# $FreeBSD$ |
2 |
# |
3 |
# Provide support for Node.js |
4 |
# |
5 |
# Feature: node |
6 |
# Usage: USES=node, or USES=node:args |
7 |
# Valid ARGS: <version>, build, run, test |
8 |
# |
9 |
# version The major version of Node.js required by your port. If omitted, |
10 |
# the default version is used. The user can choose which Node.js |
11 |
# version to use as the default using: |
12 |
# |
13 |
# DEFAULT_VERSIONS+= node=<major version> |
14 |
# |
15 |
# build Indicates that Node.js is needed at build time and adds |
16 |
# it to BUILD_DEPENDS. |
17 |
# run Indicates that Node.js is needed at run time and adds |
18 |
# it to RUN_DEPENDS. |
19 |
# test Indicates that Node.js is needed at test time and adds |
20 |
# it to TEST_DEPENDS. |
21 |
# |
22 |
# If build, run and test are omitted, Node.js will be added as BUILD_DEPENDS, |
23 |
# RUN_DEPENDS and TEST_DEPENDS. |
24 |
# |
25 |
# MAINTAINER: bradleythughes@fastmail.fm |
26 |
|
27 |
.if !defined(_INCLUDE_USES_NODE_MK) |
28 |
_INCLUDE_USES_NODE_MK= yes |
29 |
|
30 |
|
31 |
# Make sure that no dependency or some other environment variable |
32 |
# pollutes the build/run dependency detection |
33 |
.undef _NODE_BUILD_DEP |
34 |
.undef _NODE_RUN_DEP |
35 |
.undef _NODE_TEST_DEP |
36 |
_NODE_ARGS= ${node_ARGS:S/,/ /g} |
37 |
.if ${_NODE_ARGS:Mbuild} |
38 |
_NODE_BUILD_DEP= yes |
39 |
_NODE_ARGS:= ${_NODE_ARGS:Nbuild} |
40 |
.endif |
41 |
.if ${_NODE_ARGS:Mrun} |
42 |
_NODE_RUN_DEP= yes |
43 |
_NODE_ARGS:= ${_NODE_ARGS:Nrun} |
44 |
.endif |
45 |
.if ${_NODE_ARGS:Mtest} |
46 |
_NODE_TEST_DEP= yes |
47 |
_NODE_ARGS:= ${_NODE_ARGS:Ntest} |
48 |
.endif |
49 |
|
50 |
# The port does not specify a build, run or test dependency, assume all are |
51 |
# required. |
52 |
.if !defined(_NODE_BUILD_DEP) && !defined(_NODE_RUN_DEP) && \ |
53 |
!defined(_NODE_TEST_DEP) && !defined(NODE_NO_DEPENDS) |
54 |
_NODE_BUILD_DEP= yes |
55 |
_NODE_RUN_DEP= yes |
56 |
_NODE_TEST_DEP= yes |
57 |
.endif |
58 |
|
59 |
|
60 |
# The remaining argument, if any, is the Node.js major version to use. |
61 |
_NODE_VERSION= ${_NODE_ARGS} |
62 |
.if empty(_NODE_VERSION) |
63 |
_NODE_VERSION= ${NODE_DEFAULT} |
64 |
.endif |
65 |
|
66 |
|
67 |
# Add build, run, and test dependencies as required. |
68 |
.if defined(_NODE_BUILD_DEP) |
69 |
BUILD_DEPENDS+= node${_NODE_VERSION}>=${_NODE_VERSION}:www/node${_NODE_VERSION} |
70 |
.endif |
71 |
.if defined(_NODE_RUN_DEP) |
72 |
RUN_DEPENDS+= node${_NODE_VERSION}>=${_NODE_VERSION}:www/node${_NODE_VERSION} |
73 |
.endif |
74 |
.if defined(_NODE_TEST_DEP) |
75 |
TEST_DEPENDS+= node${_NODE_VERSION}>=${_NODE_VERSION}:www/node${_NODE_VERSION} |
76 |
.endif |
77 |
|
78 |
|
79 |
.endif # _INCLUDE_USES_NODE_MK |