diff options
Diffstat (limited to 'auto')
-rw-r--r-- | auto/help | 4 | ||||
-rw-r--r-- | auto/make | 26 | ||||
-rw-r--r-- | auto/modules/conf | 4 | ||||
-rw-r--r-- | auto/modules/nodejs | 161 | ||||
-rw-r--r-- | auto/options | 12 | ||||
-rw-r--r-- | auto/save | 2 | ||||
-rw-r--r-- | auto/sources | 4 | ||||
-rw-r--r-- | auto/summary | 2 |
8 files changed, 213 insertions, 2 deletions
@@ -16,6 +16,8 @@ cat << END default: "$NXT_BINDIR" --sbindir=DIRECTORY set system admin executables directory name default: "$NXT_SBINDIR" + --libdir=DIRECTORY set library directory name, default: "$NXT_LIBDIR" + --incdir=DIRECTORY set includes directory name, default: "$NXT_INCDIR" --modules=DIRECTORY set modules directory name, default: "$NXT_MODULES" --state=DIRECTORY set state directory name, default: "$NXT_STATE" @@ -33,6 +35,8 @@ cat << END --no-ipv6 disable IPv6 support --no-unix-sockets disable Unix domain sockets support + --openssl enable OpenSSL library usage + --debug enable debug logging @@ -277,6 +277,32 @@ ${NXT_DAEMON}-uninstall: END +cat << END >> $NXT_MAKEFILE + +.PHONY: libunit-install libunit-uninstall + +libunit-install: $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC + install -d \$(DESTDIR)$NXT_LIBDIR + install -p -m u=rw,go=r $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \ + \$(DESTDIR)$NXT_LIBDIR/ + install -d \$(DESTDIR)$NXT_INCDIR + install -p -m u=rw,go=r src/nxt_unit.h src/nxt_unit_field.h \ + src/nxt_unit_request.h src/nxt_unit_response.h src/nxt_unit_sptr.h \ + src/nxt_unit_typedefs.h \$(DESTDIR)$NXT_INCDIR/ + +libunit-uninstall: + rm -f \$(DESTDIR)$NXT_LIBDIR/$NXT_LIB_UNIT_STATIC + @rmdir -p \$(DESTDIR)$NXT_LIBDIR 2>/dev/null || true + rm -f \$(DESTDIR)$NXT_INCDIR/nxt_unit.h \ + \$(DESTDIR)$NXT_INCDIR/nxt_unit_field.h \ + \$(DESTDIR)$NXT_INCDIR/nxt_unit_request.h \ + \$(DESTDIR)$NXT_INCDIR/nxt_unit_response.h \ + \$(DESTDIR)$NXT_INCDIR/nxt_unit_sptr.h \ + \$(DESTDIR)$NXT_INCDIR/nxt_unit_typedefs.h + @rmdir -p \$(DESTDIR)$NXT_INCDIR 2>/dev/null || true + +END + # Makefile. # *.dSYM is MacOSX Clang debug information. diff --git a/auto/modules/conf b/auto/modules/conf index 93d28601..409b4bea 100644 --- a/auto/modules/conf +++ b/auto/modules/conf @@ -25,6 +25,10 @@ case "$nxt_module" in . auto/modules/ruby ;; + nodejs) + . auto/modules/nodejs + ;; + *) echo echo $0: error: invalid module \"$nxt_module\". diff --git a/auto/modules/nodejs b/auto/modules/nodejs new file mode 100644 index 00000000..56f84876 --- /dev/null +++ b/auto/modules/nodejs @@ -0,0 +1,161 @@ + +# Copyright (C) NGINX, Inc. + + +shift + +for nxt_option; do + + case "$nxt_option" in + -*=*) value=`echo "$nxt_option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) value="" ;; + esac + + case "$nxt_option" in + --node=*) NXT_NODE="$value" ;; + --npm=*) NXT_NPM="$value" ;; + --node-gyp=*) NXT_NODE_GYP="$value" ;; + + --help) + cat << END + + --node=NAME set node executable + --npm=NAME set npm executable + --node-gyp=NAME set node-gyp executable + +END + exit 0 + ;; + + *) + echo + echo $0: error: invalid Node option \"$nxt_option\" + echo + exit 1 + ;; + + esac + +done + + +if [ ! -f $NXT_AUTOCONF_DATA ]; then + echo + echo Please run common $0 before configuring module \"$nxt_module\". + echo + exit 1 +fi + +. $NXT_AUTOCONF_DATA + + +$echo "configuring nodejs module" +$echo "configuring nodejs module..." >> $NXT_AUTOCONF_ERR + +NXT_NODE=${NXT_NODE=node} +NXT_NPM=${NXT_NPM=npm} +NXT_NODE_GYP=${NXT_NODE_GYP=node-gyp} + +$echo -n "checking for node ..." +$echo "checking for node ..." >> $NXT_AUTOCONF_ERR + +if /bin/sh -c "${NXT_NODE} -v" >> $NXT_AUTOCONF_ERR 2>&1; then + $echo " found" + + NXT_NODE_VERSION="`${NXT_NODE} -v`" + $echo " + node version ${NXT_NODE_VERSION}" + +else + $echo " not found" + $echo + $echo $0: error: no Node found. + $echo + exit 1; +fi + +$echo -n "checking for npm ..." +$echo "checking for npm ..." >> $NXT_AUTOCONF_ERR + +if /bin/sh -c "${NXT_NPM} -v" >> $NXT_AUTOCONF_ERR 2>&1; then + $echo " found" + + NXT_NPM_VERSION="`${NXT_NPM} -v`" + $echo " + npm version ${NXT_NPM_VERSION}" + +else + $echo " not found" + $echo + $echo $0: error: no npm found. + $echo + exit 1; +fi + +$echo -n "checking for node-gyp ..." +$echo "checking for node-gyp ..." >> $NXT_AUTOCONF_ERR + +if /bin/sh -c "${NXT_NODE_GYP} -v" >> $NXT_AUTOCONF_ERR 2>&1; then + $echo " found" + + NXT_NODE_GYP_VERSION="`${NXT_NODE_GYP} -v`" + $echo " + node-gyp version ${NXT_NODE_GYP_VERSION}" + +else + $echo " not found" + $echo + $echo $0: error: no node-gyp found. + $echo + exit 1; +fi + +if grep ^$NXT_NODE: $NXT_MAKEFILE 2>&1 > /dev/null; then + $echo + $echo $0: error: duplicate \"$NXT_NODE\" package configured. + $echo + exit 1; +fi + +NXT_NODE_TMP=${NXT_BUILD_DIR}/src/${NXT_NODE}/unit-http +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" + +cat << END >> $NXT_MAKEFILE + +.PHONY: ${NXT_NODE} +.PHONY: ${NXT_NODE}-copy +.PHONY: ${NXT_NODE}-install +.PHONY: ${NXT_NODE}-uninstall + +all: + +${NXT_NODE}: ${NXT_NODE}-copy $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC + ${NXT_NODE_EXPORTS} && \\ + cd ${NXT_NODE_TMP} && ${NXT_NODE_GYP} configure build clean + +${NXT_NODE}-copy: + mkdir -p ${NXT_BUILD_DIR}/src/ + cp -rp src/nodejs/ ${NXT_BUILD_DIR}/src/${NXT_NODE} + +${NXT_NODE_TARBALL}: ${NXT_NODE}-copy + tar -zcvf ${NXT_NODE_TARBALL} -C ${NXT_NODE_TMP} . + +${NXT_NODE}-install: ${NXT_NODE_TARBALL} \ + $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC + ${NXT_NODE_EXPORTS} && \\ + ${NXT_NPM} install -g ${PWD}/${NXT_NODE_TARBALL} --unsafe-perm=true + +${NXT_NODE}-local-install: ${NXT_NODE_TARBALL} \ + $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC + ${NXT_NODE_EXPORTS} && \\ + mkdir -p \$(DESTDIR) && \\ + cd \$(DESTDIR) && ${NXT_NPM} install ${PWD}/${NXT_NODE_TARBALL} + +${NXT_NODE}-build: ${NXT_NODE} + +${NXT_NODE}-publish: ${NXT_NODE} + cd ${NXT_NODE_TMP} && ${NXT_NPM} publish + +${NXT_NODE}-uninstall: + ${NXT_NPM} uninstall -g unit-http + +END diff --git a/auto/options b/auto/options index eadfb198..0d31abad 100644 --- a/auto/options +++ b/auto/options @@ -54,6 +54,8 @@ do --prefix=*) NXT_PREFIX="$value" ;; --bindir=*) NXT_BINDIR="$value" ;; --sbindir=*) NXT_SBINDIR="$value" ;; + --libdir=*) NXT_LIBDIR="$value" ;; + --incdir=*) NXT_INCDIR="$value" ;; --modules=*) NXT_MODULES="$value" ;; --state=*) NXT_STATE="$value" ;; @@ -127,6 +129,16 @@ case "$NXT_SBINDIR" in *) NXT_SBINDIR="$NXT_PREFIX$NXT_SBINDIR" ;; esac +case "$NXT_LIBDIR" in + /*) ;; + *) NXT_LIBDIR="$NXT_PREFIX$NXT_LIBDIR" ;; +esac + +case "$NXT_INCDIR" in + /*) ;; + *) NXT_INCDIR="$NXT_PREFIX$NXT_INCDIR" ;; +esac + case "$NXT_MODULES" in /*) ;; *) NXT_MODULES="$NXT_PREFIX$NXT_MODULES" ;; @@ -26,6 +26,8 @@ echo=$NXT_BUILD_DIR/echo NXT_LIB_AUX_CFLAGS= NXT_LIB_AUX_LIBS= +NXT_LIB_UNIT_STATIC='$NXT_LIB_UNIT_STATIC' + NXT_MODULES='$NXT_MODULES' END diff --git a/auto/sources b/auto/sources index e7074345..bc979fe2 100644 --- a/auto/sources +++ b/auto/sources @@ -74,7 +74,6 @@ NXT_LIB_SRCS=" \ src/nxt_runtime.c \ src/nxt_conf.c \ src/nxt_conf_validation.c \ - src/nxt_stream_module.c \ src/nxt_main_process.c \ src/nxt_worker_process.c \ src/nxt_controller.c \ @@ -84,13 +83,14 @@ NXT_LIB_SRCS=" \ src/nxt_http_response.c \ src/nxt_http_error.c \ src/nxt_application.c \ - src/nxt_go.c \ + src/nxt_external.c \ src/nxt_port_hash.c \ " NXT_LIB_SRC0=" \ src/nxt_buf_filter.c \ src/nxt_job_file.c \ + src/nxt_stream_module.c \ src/nxt_stream_source.c \ src/nxt_upstream_source.c \ src/nxt_http_source.c \ diff --git a/auto/summary b/auto/summary index 695b21f7..ce6b42db 100644 --- a/auto/summary +++ b/auto/summary @@ -9,6 +9,8 @@ Configuration summary: unit bin directory: "$NXT_BINDIR" unit sbin directory: "$NXT_SBINDIR" + unit lib directory: "$NXT_LIBDIR" + unit include directory: "$NXT_INCDIR" unit modules directory: "$NXT_MODULES" unit state directory: "$NXT_STATE" |