summaryrefslogtreecommitdiffhomepage
path: root/auto
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-06-23 19:20:08 +0300
committerMax Romanov <max.romanov@nginx.com>2017-06-23 19:20:08 +0300
commit4a1b59c27a8e85fc3b03c420fbc1642ce52e96cf (patch)
treec72ab253541c53dd918afc86973192416078fceb /auto
parent5a43bd0bfd1eaa60dede7beb3206a53e8d008fa4 (diff)
downloadunit-4a1b59c27a8e85fc3b03c420fbc1642ce52e96cf.tar.gz
unit-4a1b59c27a8e85fc3b03c420fbc1642ce52e96cf.tar.bz2
External Go app request processing.
Diffstat (limited to 'auto')
-rw-r--r--auto/make4
-rw-r--r--auto/modules/conf6
-rw-r--r--auto/modules/go/conf25
-rw-r--r--auto/modules/go/make24
-rw-r--r--auto/options6
5 files changed, 64 insertions, 1 deletions
diff --git a/auto/make b/auto/make
index 328107d5..607f02fb 100644
--- a/auto/make
+++ b/auto/make
@@ -235,6 +235,10 @@ if [ $NXT_PHP_MODULE != NO ]; then
. auto/modules/php/make
fi
+if [ $NXT_GO_MODULE != NO ]; then
+ . auto/modules/go/make
+fi
+
# Makefile.
# *.dSYM is MacOSX Clang debug information.
diff --git a/auto/modules/conf b/auto/modules/conf
index f73be1e6..e4f68044 100644
--- a/auto/modules/conf
+++ b/auto/modules/conf
@@ -1,6 +1,6 @@
-# Copyright (C) NGINX, Inc.
# Copyright (C) Valentin V. Bartenev
+# Copyright (C) NGINX, Inc.
NXT_MODULES_INIT=
@@ -15,6 +15,10 @@ if [ $NXT_PHP_MODULE != NO ]; then
. auto/modules/php/conf
fi
+if [ $NXT_GO_MODULE != NO ]; then
+ . auto/modules/go/conf
+fi
+
NXT_MODULES_SRC=$NXT_BUILD_DIR/nxt_modules.c
diff --git a/auto/modules/go/conf b/auto/modules/go/conf
new file mode 100644
index 00000000..4c02fdc9
--- /dev/null
+++ b/auto/modules/go/conf
@@ -0,0 +1,25 @@
+
+# Copyright (C) Max Romanov
+# Copyright (C) NGINX, Inc.
+
+
+NXT_GO_VERSION="`${NXT_GO} version`"
+
+GOPATH=`pwd` CGO_CPPFLAGS="-DNXT_CONFIGURE" "${NXT_GO}" build -o build/nxt_go_gen.a --buildmode=c-archive nginext
+
+if [ "$?" -ne 0 ]; then
+ $echo
+ $echo $0: error: no go found.
+ $echo
+ exit 1;
+fi
+
+$echo " + go version: ${NXT_GO_VERSION}"
+
+NXT_GO_MODULE_SRCS=" \
+ src/nxt_go.c \
+"
+
+
+NXT_MODULES_INIT="$NXT_MODULES_INIT nxt_go_module_init"
+NXT_MODULES_SRCS="$NXT_MODULES_SRCS $NXT_GO_MODULE_SRCS"
diff --git a/auto/modules/go/make b/auto/modules/go/make
new file mode 100644
index 00000000..aa93d3d6
--- /dev/null
+++ b/auto/modules/go/make
@@ -0,0 +1,24 @@
+
+# Copyright (C) Max Romanov
+# Copyright (C) NGINX, Inc.
+
+
+$echo >> $NXT_MAKEFILE
+$echo >> $NXT_MAKEFILE
+
+
+# The go module object files.
+
+for nxt_src in $NXT_GO_MODULE_SRCS
+do
+ nxt_obj=`$echo $nxt_src | sed -e "s/\.c$/\.o/"`
+ cat << END >> $NXT_MAKEFILE
+
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src
+ \$(CC) -c \$(CFLAGS) \$(NXT_INCS) \\
+ $NXT_LIB_AUX_CFLAGS \\
+ -o $NXT_BUILD_DIR/$nxt_obj \\
+ $nxt_src
+END
+
+done
diff --git a/auto/options b/auto/options
index 36215198..e9f41ff7 100644
--- a/auto/options
+++ b/auto/options
@@ -47,6 +47,9 @@ NXT_PYTHON_MODULE=NO
NXT_PHP=php
NXT_PHP_MODULE=NO
+NXT_GO=go
+NXT_GO_MODULE=NO
+
for nxt_option
do
case "$nxt_option" in
@@ -98,6 +101,9 @@ do
--with-php=*) NXT_PHP="$value" ;;
--with-php_module) NXT_PHP_MODULE=YES ;;
+ --with-go=*) NXT_GO="$value" ;;
+ --with-go_module) NXT_GO_MODULE=YES ;;
+
*)
$echo
$echo "$0: error: invalid option \"$nxt_option\"".