From 2677bd5604345d3fe40e821699d1a26a7d1c31a7 Mon Sep 17 00:00:00 2001 From: Alexander Borisov Date: Mon, 21 Jan 2019 18:13:00 +0300 Subject: Go: fixed module installation, broken in ed8b1aaefdd1. Added the nxt_unit_version.h dependency. This closes #214 issue on GitHub. --- auto/modules/go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'auto') diff --git a/auto/modules/go b/auto/modules/go index 7abd1e73..e9b2321d 100644 --- a/auto/modules/go +++ b/auto/modules/go @@ -103,7 +103,7 @@ ${NXT_GO}: ${NXT_GO}-install: ${NXT_GO}-install-build -${NXT_GO}-install-src: +${NXT_GO}-install-src: ${NXT_BUILD_DIR}/nxt_unit_version.h install -d \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit install -p -m644 ./src/*.h ./build/*.h ./src/go/unit/* \ ./src/nxt_unit.c ./src/nxt_lvlhsh.c ./src/nxt_murmur_hash.c \ -- cgit From 2bc8fb7b43a5106ab8cdf8adae4834837ae7fc16 Mon Sep 17 00:00:00 2001 From: Alexander Borisov Date: Wed, 23 Jan 2019 17:47:53 +0300 Subject: Node.js: fixed module version on installation from sources. --- auto/modules/nodejs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'auto') diff --git a/auto/modules/nodejs b/auto/modules/nodejs index e0208f5d..57bf9d3a 100644 --- a/auto/modules/nodejs +++ b/auto/modules/nodejs @@ -145,6 +145,8 @@ cat << END >> $NXT_MAKEFILE .PHONY: ${NXT_NODE}-build .PHONY: ${NXT_NODE}-publish +NXT_UNIT_VERSION=\$(shell grep 'define NXT_VERSION' \ + src/nxt_main.h | sed -e 's/^.*"\(.*\)".*/\1/') ${NXT_NODE}: ${NXT_NODE}-copy $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC ${NXT_NODE_EXPORTS} && \\ @@ -161,6 +163,9 @@ ${NXT_NODE_VERSION_FILE}: src/nxt_main.h | sed -e 's/[^0-9]//g' >> $NXT_NODE_VERSION_FILE ${NXT_NODE_TARBALL}: ${NXT_NODE}-copy + sed -e 's/"version"\s*:.*/"version": "\$(NXT_UNIT_VERSION).0",/' \ + ${NXT_NODE_TMP}/package.json > ${NXT_NODE_TMP}/package.json.tmp + mv ${NXT_NODE_TMP}/package.json.tmp ${NXT_NODE_TMP}/package.json tar -zcvf ${NXT_NODE_TARBALL} -C ${NXT_NODE_TMP} . -- cgit From 608e09e9def182756e2f1650c6f3416b209fbf58 Mon Sep 17 00:00:00 2001 From: Alexander Borisov Date: Fri, 22 Feb 2019 16:31:44 +0300 Subject: Improvement and unification of version processing in build scripts. This also eliminates expressions that incompatible with BSD make, thus fixing installation of Node.js module on FreeBSD (broken by dace60fc4926). --- auto/make | 28 ++++++++++++++++++---------- auto/modules/go | 2 +- auto/modules/nodejs | 11 +++-------- 3 files changed, 22 insertions(+), 19 deletions(-) (limited to 'auto') diff --git a/auto/make b/auto/make index 4f716b93..1eee2a78 100644 --- a/auto/make +++ b/auto/make @@ -67,6 +67,22 @@ done $echo >> $NXT_MAKEFILE +# The version file. + +cat << END >> $NXT_MAKEFILE + +include version + +$NXT_VERSION_H: version + $echo '#define NXT_VERSION "\$(NXT_VERSION)"' > $NXT_VERSION_H + $echo '#define NXT_VERNUM \$(NXT_VERNUM)' >> $NXT_VERSION_H + +$NXT_BUILD_DIR/src/nxt_unit.o: $NXT_VERSION_H +$NXT_BUILD_DIR/src/nxt_lib.o: $NXT_VERSION_H + +END + + # Shared and static library. cat << END >> $NXT_MAKEFILE @@ -82,14 +98,6 @@ $NXT_BUILD_DIR/$NXT_LIB_STATIC: \$(NXT_LIB_OBJS) $NXT_STATIC_LINK $NXT_BUILD_DIR/$NXT_LIB_STATIC \\ \$(NXT_LIB_OBJS) -$NXT_BUILD_DIR/nxt_unit_version.h: src/nxt_main.h - $echo -n '#define NXT_UNIT_VERNUM ' > $NXT_BUILD_DIR/nxt_unit_version.h - grep 'define NXT_VERNUM' src/nxt_main.h \\ - | sed -e 's/[^0-9]//g' >> $NXT_BUILD_DIR/nxt_unit_version.h - -$NXT_BUILD_DIR/src/nxt_unit.o: $NXT_BUILD_DIR/nxt_unit_version.h -$NXT_BUILD_DIR/src/nxt_lib.o: $NXT_BUILD_DIR/nxt_unit_version.h - $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC: \$(NXT_LIB_UNIT_OBJS) $NXT_STATIC_LINK $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\ \$(NXT_LIB_UNIT_OBJS) @@ -296,7 +304,7 @@ libunit-install: $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC 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 $NXT_BUILD_DIR/nxt_unit_version.h \ + src/nxt_unit_typedefs.h $NXT_BUILD_DIR/nxt_version.h \ \$(DESTDIR)$NXT_INCDIR/ libunit-uninstall: @@ -308,7 +316,7 @@ libunit-uninstall: \$(DESTDIR)$NXT_INCDIR/nxt_unit_response.h \ \$(DESTDIR)$NXT_INCDIR/nxt_unit_sptr.h \ \$(DESTDIR)$NXT_INCDIR/nxt_unit_typedefs.h \ - \$(DESTDIR)$NXT_INCDIR/nxt_unit_version.h + \$(DESTDIR)$NXT_INCDIR/nxt_version.h @rmdir -p \$(DESTDIR)$NXT_INCDIR 2>/dev/null || true END diff --git a/auto/modules/go b/auto/modules/go index e9b2321d..62c3743f 100644 --- a/auto/modules/go +++ b/auto/modules/go @@ -103,7 +103,7 @@ ${NXT_GO}: ${NXT_GO}-install: ${NXT_GO}-install-build -${NXT_GO}-install-src: ${NXT_BUILD_DIR}/nxt_unit_version.h +${NXT_GO}-install-src: ${NXT_VERSION_H} install -d \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit install -p -m644 ./src/*.h ./build/*.h ./src/go/unit/* \ ./src/nxt_unit.c ./src/nxt_lvlhsh.c ./src/nxt_murmur_hash.c \ diff --git a/auto/modules/nodejs b/auto/modules/nodejs index 57bf9d3a..6fd00496 100644 --- a/auto/modules/nodejs +++ b/auto/modules/nodejs @@ -145,9 +145,6 @@ cat << END >> $NXT_MAKEFILE .PHONY: ${NXT_NODE}-build .PHONY: ${NXT_NODE}-publish -NXT_UNIT_VERSION=\$(shell grep 'define NXT_VERSION' \ - src/nxt_main.h | sed -e 's/^.*"\(.*\)".*/\1/') - ${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 @@ -156,14 +153,12 @@ ${NXT_NODE}-copy: ${NXT_NODE_VERSION_FILE} mkdir -p ${NXT_BUILD_DIR}/src/ cp -rp src/nodejs/* ${NXT_BUILD_DIR}/src/${NXT_NODE} -${NXT_NODE_VERSION_FILE}: src/nxt_main.h +${NXT_NODE_VERSION_FILE}: ${NXT_VERSION_H} mkdir -p ${NXT_NODE_TMP} - $echo -n '#define NXT_NODE_VERNUM ' > $NXT_NODE_VERSION_FILE - grep 'define NXT_VERNUM' src/nxt_main.h \\ - | sed -e 's/[^0-9]//g' >> $NXT_NODE_VERSION_FILE + $echo '#define NXT_NODE_VERNUM \$(NXT_VERNUM)' > $NXT_NODE_VERSION_FILE ${NXT_NODE_TARBALL}: ${NXT_NODE}-copy - sed -e 's/"version"\s*:.*/"version": "\$(NXT_UNIT_VERSION).0",/' \ + sed -e 's/"version"\s*:.*/"version": "\$(NXT_VERSION).0",/' \ ${NXT_NODE_TMP}/package.json > ${NXT_NODE_TMP}/package.json.tmp mv ${NXT_NODE_TMP}/package.json.tmp ${NXT_NODE_TMP}/package.json tar -zcvf ${NXT_NODE_TARBALL} -C ${NXT_NODE_TMP} . -- cgit From d4ccaae900f78b13923a9bd9ee7bbaa33c99b18b Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 27 Feb 2019 16:41:11 +0300 Subject: Initial routing implementation. --- auto/sources | 1 + 1 file changed, 1 insertion(+) (limited to 'auto') diff --git a/auto/sources b/auto/sources index bc979fe2..4c4fd742 100644 --- a/auto/sources +++ b/auto/sources @@ -82,6 +82,7 @@ NXT_LIB_SRCS=" \ src/nxt_http_request.c \ src/nxt_http_response.c \ src/nxt_http_error.c \ + src/nxt_http_route.c \ src/nxt_application.c \ src/nxt_external.c \ src/nxt_port_hash.c \ -- cgit From 5c9fe8c3060f8204b143abae6d81ee8363aba060 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Wed, 27 Feb 2019 17:25:28 +0300 Subject: Added trailing zero to version string. While it looks nicer without zero 3-rd version number, this should improve interoperability. Version string can be parsed or used for sorting. And it is easier to handle and less confusing when there is constant number of version parts. Moreover, NPM also expects version format with 3 parts. So ".0" has already been used in Node.js module version. --- auto/modules/nodejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'auto') diff --git a/auto/modules/nodejs b/auto/modules/nodejs index 6fd00496..edaf99ac 100644 --- a/auto/modules/nodejs +++ b/auto/modules/nodejs @@ -158,7 +158,7 @@ ${NXT_NODE_VERSION_FILE}: ${NXT_VERSION_H} $echo '#define NXT_NODE_VERNUM \$(NXT_VERNUM)' > $NXT_NODE_VERSION_FILE ${NXT_NODE_TARBALL}: ${NXT_NODE}-copy - sed -e 's/"version"\s*:.*/"version": "\$(NXT_VERSION).0",/' \ + sed -e 's/"version"\s*:.*/"version": "\$(NXT_VERSION)",/' \ ${NXT_NODE_TMP}/package.json > ${NXT_NODE_TMP}/package.json.tmp mv ${NXT_NODE_TMP}/package.json.tmp ${NXT_NODE_TMP}/package.json tar -zcvf ${NXT_NODE_TARBALL} -C ${NXT_NODE_TMP} . -- cgit From 5bfdebb9e4161a689113d73775498949a09d7fb5 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Thu, 28 Feb 2019 18:02:42 +0300 Subject: Introducing Java Servlet Container beta. --- auto/modules/conf | 4 + auto/modules/java | 458 ++++++++++++++++++++++++++++++++++++++++++++++ auto/modules/java_get_jar | 33 ++++ 3 files changed, 495 insertions(+) create mode 100644 auto/modules/java create mode 100644 auto/modules/java_get_jar (limited to 'auto') diff --git a/auto/modules/conf b/auto/modules/conf index 409b4bea..7e004703 100644 --- a/auto/modules/conf +++ b/auto/modules/conf @@ -29,6 +29,10 @@ case "$nxt_module" in . auto/modules/nodejs ;; + java) + . auto/modules/java + ;; + *) echo echo $0: error: invalid module \"$nxt_module\". diff --git a/auto/modules/java b/auto/modules/java new file mode 100644 index 00000000..27030da1 --- /dev/null +++ b/auto/modules/java @@ -0,0 +1,458 @@ + +# Copyright (C) NGINX, Inc. + + +shift + +NXT_JAVA_HOME=${JAVA_HOME-} +NXT_JAR_REPO=http://central.maven.org/maven2/ +NXT_JAR_LOCAL_REPO=$HOME/.m2/repository/ + +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 + + --module=*) NXT_JAVA_MODULE="$value" ;; + --home=*) NXT_JAVA_HOME="$value" ;; + --lib-path=*) NXT_JAVA_LIB_PATH="$value" ;; + --repo=*) NXT_JAR_REPO="$value" ;; + --local-repo=*) NXT_JAR_LOCAL_REPO="$value" ;; + --jars=*) NXT_JARS="$value" ;; + + --help) + cat << END + + --module=NAME set unit Java module name + --home=DIR set Java home directory + --lib-path=DIRECTORY set directory path to libjvm.so library + --repo=URL set Maven remote repository URL + default: "$NXT_JAR_REPO" + --local-repo=DIR set local repository directory + default: "$NXT_JAR_LOCAL_REPO" + --jars=DIR set jars install/search directory + +END + exit 0 + ;; + + *) + echo + echo $0: error: invalid Java 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 + + +NXT_JARS=${NXT_JARS=$NXT_MODULES} +NXT_JAVA_MODULE=${NXT_JAVA_MODULE=java} +NXT_JAVA_LIB_PATH=${NXT_JAVA_LIB_PATH=} + +$echo "configuring Java module" +$echo "configuring Java module ..." >> $NXT_AUTOCONF_ERR + +if [ -n "${NXT_JAVA_HOME}" ]; then + $echo "using java.home ${NXT_JAVA_HOME}" + $echo "using java.home ${NXT_JAVA_HOME}" >> $NXT_AUTOCONF_ERR + + if [ ! -d "${NXT_JAVA_HOME}" ]; then + $echo + $echo $0: error: Java home directory not found. + $echo + exit 1 + fi + + NXT_JAVA="${NXT_JAVA_HOME}/bin/java" + +else + $echo -n "checking for java executable" + $echo "checking for java executable ..." >> $NXT_AUTOCONF_ERR + + NXT_JAVA=`which java || :` + if [ -z "$NXT_JAVA" -o ! -x "$NXT_JAVA" ]; then + $echo + $echo $0: error: java executable not found. + $echo + exit 1 + fi + + $echo " found $NXT_JAVA" + $echo "found $NXT_JAVA" >> $NXT_AUTOCONF_ERR + + "$NXT_JAVA" -version + + $echo -n "checking java.home" + $echo "checking java.home ..." >> $NXT_AUTOCONF_ERR + + NXT_JAVA_HOME=`$NXT_JAVA -XshowSettings 2>&1 | grep -F -e java.home | sed -e 's/^.*= //'` + if [ -z "$NXT_JAVA_HOME" ]; then + $echo + $echo $0: error: java.home not found. + $echo + exit 1 + fi + + $echo " $NXT_JAVA_HOME" + $echo "got java.home $NXT_JAVA_HOME" >> $NXT_AUTOCONF_ERR + + if [ ! -x "${NXT_JAVA_HOME}/bin/javac" ]; then + NXT_JAVA_HOME_=${NXT_JAVA_HOME%/jre} + if [ -x "${NXT_JAVA_HOME_}/bin/javac" ]; then + $echo "adjust java.home $NXT_JAVA_HOME_" + $echo "adjust java.home $NXT_JAVA_HOME_" >> $NXT_AUTOCONF_ERR + + NXT_JAVA_HOME="$NXT_JAVA_HOME_" + fi + fi +fi + +NXT_JAVAC="${NXT_JAVA_HOME}/bin/javac" + +if [ ! -x "$NXT_JAVAC" ]; then + $echo + $echo $0: error: javac not found. + $echo + exit 1 +fi + +NXT_JAVA_INCLUDE="-I${NXT_JAVA_HOME}/include" + +case "$NXT_SYSTEM" in + Linux) + NXT_JAVA_INCLUDE="${NXT_JAVA_INCLUDE} -I${NXT_JAVA_HOME}/include/linux" + ;; + Darwin) + NXT_JAVA_INCLUDE="${NXT_JAVA_INCLUDE} -I${NXT_JAVA_HOME}/include/darwin" + ;; + FreeBSD) + NXT_JAVA_INCLUDE="${NXT_JAVA_INCLUDE} -I${NXT_JAVA_HOME}/include/freebsd" + ;; +esac + +if [ -z "$NXT_JAVA_LIB_PATH" ]; then + $echo -n "checking library path" + $echo "checking library path ..." >> $NXT_AUTOCONF_ERR + + if [ ! -x "$NXT_JAVA" ]; then + $echo + $echo $0: error: java executable not found. + $echo + exit 1 + fi + + NXT_JAVA_LIB_PATH=`$NXT_JAVA -XshowSettings 2>&1 | grep -F -e sun.boot.library.path | sed -e 's/^.*= //'` + + if [ -z "$NXT_JAVA_LIB_PATH" ]; then + $echo + $echo $0: error: library path not found. + $echo + exit 1 + fi + + NXT_JAVA_LIB_PATH="${NXT_JAVA_LIB_PATH}/server" + + $echo " $NXT_JAVA_LIB_PATH" + $echo "got library path $NXT_JAVA_LIB_PATH" >> $NXT_AUTOCONF_ERR +fi + +NXT_JAVA_LDFLAGS="-L${NXT_JAVA_LIB_PATH} -Wl,-rpath ${NXT_JAVA_LIB_PATH} -ljvm" + + +nxt_found=no + +nxt_feature="JNI" +nxt_feature_name="" +nxt_feature_run=no +nxt_feature_incs="${NXT_JAVA_INCLUDE}" +nxt_feature_libs="${NXT_JAVA_LDFLAGS}" +nxt_feature_test=" + #include + + int main() { + JNI_CreateJavaVM(NULL, NULL, NULL); + return 0; + }" + +. auto/feature + + +if [ $nxt_found = no ]; then + $echo + $echo $0: error: no JNI found. + $echo + exit 1; +fi + +NXT_JAVA_VERSION=`$NXT_JAVAC -version 2>&1` +NXT_JAVA_VERSION=${NXT_JAVA_VERSION#javac } +NXT_JAVA_INCLUDE="$NXT_JAVA_INCLUDE -I$NXT_BUILD_DIR/$NXT_JAVA_MODULE -DNXT_JAVA_VERSION=$NXT_JAVA_VERSION" + +if grep ^$NXT_JAVA_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then + $echo + $echo $0: error: duplicate \"$NXT_JAVA_MODULE\" module configured. + $echo + exit 1; +fi + +. ./version + +NXT_UNIT_JAR=nginx-unit-jsc-${NXT_JAVA_MODULE}-$NXT_VERSION.jar + +NXT_JAVA_BUILD_CP=$NXT_BUILD_DIR/$NXT_JAVA_MODULE +NXT_JAVA_INSTALL_JARS= +NXT_JAVA_UNINSTALL_JARS= + +NXT_JAVA_JARS=$NXT_BUILD_DIR/$NXT_JAVA_MODULE/nxt_jars.h +mkdir -p $NXT_BUILD_DIR/$NXT_JAVA_MODULE + +cat << END > $NXT_JAVA_JARS +#ifndef _NXT_JAVA_JARS_INCLUDED_ +#define _NXT_JAVA_JARS_INCLUDED_ + +#define NXT_JARS "$NXT_JARS" + +static const char *nxt_java_system_jars[] = { +END + +NXT_TOMCAT_VERSION=9.0.13 + +NXT_JAR_VERSION=$NXT_TOMCAT_VERSION + +NXT_JAR_NAME=tomcat-servlet-api +NXT_JAR_NAMESPACE=org/apache/tomcat/ +. auto/modules/java_get_jar + +NXT_JAR_NAME=tomcat-el-api +. auto/modules/java_get_jar + +NXT_JAR_NAME=tomcat-jsp-api +. auto/modules/java_get_jar + +NXT_JAR_NAME=tomcat-jasper +. auto/modules/java_get_jar + +NXT_JAR_NAME=tomcat-jasper-el +. auto/modules/java_get_jar + +NXT_JAR_NAME=tomcat-juli +. auto/modules/java_get_jar + +NXT_JAR_NAME=tomcat-api +. auto/modules/java_get_jar + +NXT_JAR_NAME=tomcat-util-scan +. auto/modules/java_get_jar + +NXT_JAR_NAME=tomcat-util +. auto/modules/java_get_jar + +NXT_JAR_NAME=ecj +NXT_JAR_VERSION=3.13.102 +NXT_JAR_NAMESPACE=org/eclipse/jdt/ +. auto/modules/java_get_jar + +cat << END >> $NXT_JAVA_JARS + NULL +}; + +static const char *nxt_java_unit_jars[] = { + "$NXT_UNIT_JAR", +END + +NXT_JAR_VERSION=9.4.12.v20180830 +NXT_JAR_NAMESPACE=org/eclipse/jetty/ + +NXT_JAR_NAME=jetty-util +. auto/modules/java_get_jar + +NXT_JAR_NAME=jetty-server +. auto/modules/java_get_jar + +NXT_JAR_NAME=jetty-http +. auto/modules/java_get_jar + +NXT_JAR_NAME=classgraph +NXT_JAR_VERSION=4.4.11 +NXT_JAR_NAMESPACE=io/github/classgraph/ +. auto/modules/java_get_jar + +cat << END >> $NXT_JAVA_JARS + NULL +}; + +#endif /* _NXT_JAVA_JARS_INCLUDED_ */ +END + +$echo " + Java module: ${NXT_JAVA_MODULE}.unit.so" + +. auto/cc/deps + +$echo >> $NXT_MAKEFILE + +NXT_JAVA_MODULE_SRCS=" \ + src/nxt_java.c \ + src/java/nxt_jni.c \ + src/java/nxt_jni_Context.c \ + src/java/nxt_jni_HeaderNamesEnumeration.c \ + src/java/nxt_jni_HeadersEnumeration.c \ + src/java/nxt_jni_InputStream.c \ + src/java/nxt_jni_OutputStream.c \ + src/java/nxt_jni_Request.c \ + src/java/nxt_jni_Response.c \ + src/java/nxt_jni_Thread.c \ + src/java/nxt_jni_URLClassLoader.c \ +" + +# The Java module object files. + +nxt_objs=$NXT_BUILD_DIR/src/nxt_unit.o + +for nxt_src in $NXT_JAVA_MODULE_SRCS; do + + nxt_obj=${nxt_src%.c}-$NXT_JAVA_MODULE.o + nxt_dep=${nxt_src%.c}-$NXT_JAVA_MODULE.dep + nxt_dep_flags=`nxt_gen_dep_flags` + nxt_dep_post=`nxt_gen_dep_post` + nxt_objs="$nxt_objs $NXT_BUILD_DIR/$nxt_obj" + + cat << END >> $NXT_MAKEFILE + +$NXT_BUILD_DIR/$nxt_obj: $nxt_src + mkdir -p $NXT_BUILD_DIR/src/java + \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_JAVA_INCLUDE \\ + $nxt_dep_flags \\ + -o $NXT_BUILD_DIR/$nxt_obj $nxt_src + $nxt_dep_post + +-include $NXT_BUILD_DIR/$nxt_dep + +END + +done + +NXT_JAVA_SRCS=" \ + src/java/nginx/unit/Context.java \ + src/java/nginx/unit/DynamicDispatcherRequest.java \ + src/java/nginx/unit/DynamicPathRequest.java \ + src/java/nginx/unit/ForwardRequestWrapper.java \ + src/java/nginx/unit/HeaderNamesEnumeration.java \ + src/java/nginx/unit/HeadersEnumeration.java \ + src/java/nginx/unit/IncludeRequestWrapper.java \ + src/java/nginx/unit/IncludeResponseWrapper.java \ + src/java/nginx/unit/InitParams.java \ + src/java/nginx/unit/InputStream.java \ + src/java/nginx/unit/JspPropertyGroup.java \ + src/java/nginx/unit/OutputStream.java \ + src/java/nginx/unit/Request.java \ + src/java/nginx/unit/RequestAttrProxy.java \ + src/java/nginx/unit/Response.java \ + src/java/nginx/unit/Session.java \ + src/java/nginx/unit/SessionAttrProxy.java \ + src/java/nginx/unit/Taglib.java \ + src/java/nginx/unit/UnitSessionCookieConfig.java \ +" + +cat << END >> $NXT_MAKEFILE + +.PHONY: ${NXT_JAVA_MODULE} +.PHONY: ${NXT_JAVA_MODULE}-install +.PHONY: ${NXT_JAVA_MODULE}-uninstall + +all: ${NXT_JAVA_MODULE} + +${NXT_JAVA_MODULE}: $NXT_BUILD_DIR/${NXT_JAVA_MODULE}.unit.so \ + $NXT_BUILD_DIR/$NXT_UNIT_JAR + +$NXT_BUILD_DIR/${NXT_JAVA_MODULE}.unit.so: $nxt_objs + \$(NXT_MODULE_LINK) -o $NXT_BUILD_DIR/${NXT_JAVA_MODULE}.unit.so \\ + $nxt_objs $NXT_JAVA_LDFLAGS $NXT_LD_OPT + + +install: ${NXT_JAVA_MODULE}-install + +${NXT_JAVA_MODULE}-install: $NXT_BUILD_DIR/${NXT_JAVA_MODULE}.unit.so \\ + $NXT_BUILD_DIR/$NXT_UNIT_JAR java-shared-install + install -d \$(DESTDIR)$NXT_MODULES + install -p $NXT_BUILD_DIR/${NXT_JAVA_MODULE}.unit.so \\ + \$(DESTDIR)$NXT_MODULES/ + install -d \$(DESTDIR)$NXT_JARS + install -p -m 0644 $NXT_BUILD_DIR/$NXT_UNIT_JAR \$(DESTDIR)$NXT_JARS/ + + +uninstall: ${NXT_JAVA_MODULE}-uninstall + +${NXT_JAVA_MODULE}-uninstall: java-shared-uninstall + rm -f \$(DESTDIR)$NXT_MODULES/${NXT_JAVA_MODULE}.unit.so + @rmdir -p \$(DESTDIR)$NXT_MODULES 2>/dev/null || true + rm -f \$(DESTDIR)$NXT_JARS/$NXT_UNIT_JAR + @rmdir -p \$(DESTDIR)$NXT_JARS 2>/dev/null || true + +END + +if ! grep ^$NXT_BUILD_DIR/$NXT_UNIT_JAR: $NXT_MAKEFILE 2>&1 > /dev/null; then + + cat << END >> $NXT_MAKEFILE + +.INTERMEDIATE: $NXT_BUILD_DIR/$NXT_JAVA_MODULE/.classes + +NXT_JAVA_SRCS = $NXT_JAVA_SRCS + +$NXT_BUILD_DIR/$NXT_JAVA_MODULE/.classes: \$(NXT_JAVA_SRCS) + rm -rf $NXT_BUILD_DIR/$NXT_JAVA_MODULE/nginx + $NXT_JAVAC -d $NXT_BUILD_DIR/$NXT_JAVA_MODULE -cp $NXT_JAVA_BUILD_CP \\ + \$(NXT_JAVA_SRCS) + +$NXT_BUILD_DIR/$NXT_JAVA_MODULE/META-INF/LICENSE: LICENSE + mkdir -p $NXT_BUILD_DIR/$NXT_JAVA_MODULE/META-INF + cp -p LICENSE \$@ + +$NXT_BUILD_DIR/$NXT_JAVA_MODULE/META-INF/NOTICE: NOTICE + mkdir -p $NXT_BUILD_DIR/$NXT_JAVA_MODULE/META-INF + cp -p NOTICE \$@ + + +$NXT_BUILD_DIR/$NXT_UNIT_JAR: $NXT_BUILD_DIR/$NXT_JAVA_MODULE/.classes \\ + $NXT_BUILD_DIR/$NXT_JAVA_MODULE/META-INF/LICENSE \\ + $NXT_BUILD_DIR/$NXT_JAVA_MODULE/META-INF/NOTICE + $NXT_JAVA_HOME/bin/jar c -C $NXT_BUILD_DIR/$NXT_JAVA_MODULE META-INF \\ + -C $NXT_BUILD_DIR/$NXT_JAVA_MODULE nginx/unit > \$@ + +END + +fi + +if ! grep ^java-shared-install: $NXT_MAKEFILE 2>&1 > /dev/null; then + + cat << END >> $NXT_MAKEFILE + +.PHONY: java-shared-install +.PHONY: java-shared-uninstall + +java-shared-install: $NXT_JAVA_INSTALL_JARS + install -d \$(DESTDIR)$NXT_JARS + install -p -m 0644 $NXT_JAVA_INSTALL_JARS \$(DESTDIR)$NXT_JARS/ + +java-shared-uninstall: + rm -f $NXT_JAVA_UNINSTALL_JARS + @rmdir -p \$(DESTDIR)$NXT_JARS 2>/dev/null || true + +END + +fi diff --git a/auto/modules/java_get_jar b/auto/modules/java_get_jar new file mode 100644 index 00000000..c61d0a53 --- /dev/null +++ b/auto/modules/java_get_jar @@ -0,0 +1,33 @@ + +# Copyright (C) NGINX, Inc. + +# NXT_JAR_NAME= +# NXT_JAR_VERSION= +# NXT_JAR_NAMESPACE= +# NXT_JAR_REPO=http://central.maven.org/maven2/ +# NXT_JAR_LOCAL_REPO=$HOME/.m2/repository/ + +NXT_JAR_FILE=${NXT_JAR_NAME}-${NXT_JAR_VERSION}.jar +NXT_JAR_LOCAL="${NXT_JAR_LOCAL_REPO}${NXT_JAR_NAMESPACE}${NXT_JAR_NAME}/${NXT_JAR_VERSION}/${NXT_JAR_FILE}" +NXT_JAR_URL=${NXT_JAR_REPO}${NXT_JAR_NAMESPACE}${NXT_JAR_NAME}/${NXT_JAR_VERSION}/${NXT_JAR_FILE} + +if [ ! -f "$NXT_BUILD_DIR/$NXT_JAR_FILE" ]; then + if [ ! -f "$NXT_JAR_LOCAL" ]; then + $echo "getting remote $NXT_JAR_FILE ... " + $echo "getting remote $NXT_JAR_FILE ..." >> $NXT_AUTOCONF_ERR + + mkdir -p "${NXT_JAR_LOCAL_REPO}${NXT_JAR_NAMESPACE}${NXT_JAR_NAME}/${NXT_JAR_VERSION}/" + curl --progress-bar "$NXT_JAR_URL" -o "$NXT_JAR_LOCAL" + else + $echo "getting local $NXT_JAR_FILE" + $echo "getting local $NXT_JAR_FILE ..." >> $NXT_AUTOCONF_ERR + fi + + cp "$NXT_JAR_LOCAL" "$NXT_BUILD_DIR/$NXT_JAR_FILE" +fi + +NXT_JAVA_BUILD_CP="${NXT_JAVA_BUILD_CP}:$NXT_BUILD_DIR/$NXT_JAR_FILE" +NXT_JAVA_INSTALL_JARS="$NXT_JAVA_INSTALL_JARS $NXT_BUILD_DIR/$NXT_JAR_FILE" +NXT_JAVA_UNINSTALL_JARS="$NXT_JAVA_UNINSTALL_JARS \$(DESTDIR)$NXT_JARS/$NXT_JAR_FILE" + +$echo " \"$NXT_JAR_FILE\"," >> $NXT_JAVA_JARS -- cgit