diff options
Diffstat (limited to 'auto/modules/nodejs')
-rw-r--r-- | auto/modules/nodejs | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/auto/modules/nodejs b/auto/modules/nodejs index 3138904a..443ee9d5 100644 --- a/auto/modules/nodejs +++ b/auto/modules/nodejs @@ -15,6 +15,7 @@ for nxt_option; do --node=*) NXT_NODE="$value" ;; --npm=*) NXT_NPM="$value" ;; --node-gyp=*) NXT_NODE_GYP="$value" ;; + --local=*) NXT_NODE_LOCAL="$value" ;; --help) cat << END @@ -22,6 +23,7 @@ for nxt_option; do --node=FILE set node executable --npm=FILE set npm executable --node-gyp=FILE set node-gyp executable + --local=DIRECTORY set directory path for local installation END exit 0 @@ -52,6 +54,7 @@ fi NXT_NODE=${NXT_NODE=node} NXT_NPM=${NXT_NPM=npm} NXT_NODE_GYP=${NXT_NODE_GYP=node-gyp} +NXT_NODE_LOCAL=${NXT_NODE_LOCAL=} $echo "configuring nodejs module" @@ -123,12 +126,19 @@ NXT_NODE_TARBALL=${NXT_BUILD_DIR}/${NXT_NODE}-unit-http.tar.gz NXT_NODE_EXPORTS="export UNIT_SRC_PATH=${PWD}/src && \ export UNIT_LIB_STATIC_PATH=${PWD}/${NXT_BUILD_DIR}/libunit.a" +if [ -n "$NXT_NODE_LOCAL" ]; then + NXT_NODE_INSTALL=local-install +else + NXT_NODE_INSTALL=install +fi + cat << END >> $NXT_MAKEFILE .PHONY: ${NXT_NODE} .PHONY: ${NXT_NODE}-copy .PHONY: ${NXT_NODE}-install .PHONY: ${NXT_NODE}-uninstall +.PHONY: ${NXT_NODE}-local-check .PHONY: ${NXT_NODE}-local-install .PHONY: ${NXT_NODE}-build .PHONY: ${NXT_NODE}-publish @@ -146,6 +156,8 @@ ${NXT_NODE_TARBALL}: ${NXT_NODE}-copy tar -zcvf ${NXT_NODE_TARBALL} -C ${NXT_NODE_TMP} . +install: ${NXT_NODE}-$NXT_NODE_INSTALL + ${NXT_NODE}-install: ${NXT_NODE_TARBALL} \ $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC ${NXT_NODE_EXPORTS} && \\ @@ -154,11 +166,21 @@ ${NXT_NODE}-install: ${NXT_NODE_TARBALL} \ ${NXT_NODE}-uninstall: ${NXT_NPM} uninstall -g unit-http -${NXT_NODE}-local-install: ${NXT_NODE_TARBALL} \ +${NXT_NODE}-local-check: + @test -n "\$(DESTDIR)$NXT_NODE_LOCAL" \\ + || (echo; \\ + echo "error: to make ${NXT_NODE}-local-install you need either"; \\ + echo " to configure --local option"; \\ + echo " or to set DESTDIR environment variable."; \\ + echo; \\ + exit 1) + +${NXT_NODE}-local-install: ${NXT_NODE_TARBALL} ${NXT_NODE}-local-check \ $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC ${NXT_NODE_EXPORTS} && \\ - mkdir -p \$(DESTDIR) && \\ - cd \$(DESTDIR) && ${NXT_NPM} install ${PWD}/${NXT_NODE_TARBALL} + mkdir -p \$(DESTDIR)${NXT_NODE_LOCAL} && \\ + cd \$(DESTDIR)${NXT_NODE_LOCAL} && \\ + ${NXT_NPM} install ${PWD}/${NXT_NODE_TARBALL} ${NXT_NODE}-build: ${NXT_NODE} |