diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
commit | 16cbf3c076a0aca6d47adaf3f719493674cf2363 (patch) | |
tree | e6530480020f62a2bdbf249988ec3e2a751d3927 /auto/modules | |
download | unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.gz unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.bz2 |
Initial version.
Diffstat (limited to 'auto/modules')
-rw-r--r-- | auto/modules/conf | 50 | ||||
-rw-r--r-- | auto/modules/python/conf | 54 | ||||
-rw-r--r-- | auto/modules/python/make | 24 |
3 files changed, 128 insertions, 0 deletions
diff --git a/auto/modules/conf b/auto/modules/conf new file mode 100644 index 00000000..141bd098 --- /dev/null +++ b/auto/modules/conf @@ -0,0 +1,50 @@ + +# Copyright (C) NGINX, Inc. +# Copyright (C) Valentin V. Bartenev + + +NXT_MODULES_INIT= +NXT_MODULES_SRCS= + + +if [ $NXT_PYTHON_MODULE != NO ]; then + . auto/modules/python/conf +fi + + +NXT_MODULES_SRC=$NXT_BUILD_DIR/nxt_modules.c + + +cat << END > $NXT_MODULES_SRC + +#include <nxt_main.h> +#include <nxt_cycle.h> + + +END + + +for nxt_init in $NXT_MODULES_INIT +do + $echo "extern nxt_int_t $nxt_init(nxt_thread_t *thr, nxt_cycle_t *cycle);" \ + >> $NXT_MODULES_SRC +done + + +cat << END >> $NXT_MODULES_SRC + + +nxt_module_init_t nxt_init_modules[] = { +END + +for nxt_init in $NXT_MODULES_INIT +do + $echo " $nxt_init," >> $NXT_MODULES_SRC +done + +cat << END >> $NXT_MODULES_SRC +}; + + +nxt_uint_t nxt_init_modules_n = nxt_nitems(nxt_init_modules); +END diff --git a/auto/modules/python/conf b/auto/modules/python/conf new file mode 100644 index 00000000..1c298a2d --- /dev/null +++ b/auto/modules/python/conf @@ -0,0 +1,54 @@ + +# Copyright (C) NGINX, Inc. +# Copyright (C) Valentin V. Bartenev + + +NXT_PYTHON_VERSION=`${NXT_PYTHON} -c \ + 'import sysconfig, sys; \ + sys.stdout.write(sysconfig.get_python_version())'` + +NXT_PYTHON_INCLUDE=`${NXT_PYTHON} -c \ + 'import sysconfig, sys; \ + sys.stdout.write(sysconfig.get_path("platinclude"))'` + +NXT_PYTHON_LIB="-lpython${NXT_PYTHON_VERSION}" + +NXT_PYTHON_LIBS=`${NXT_PYTHON} -c \ + 'import sysconfig, sys; \ + sys.stdout.write(sysconfig.get_config_var("SYSLIBS") \ + + " " + sysconfig.get_config_var("LIBS"))'` + + +nxt_feature="Python" +nxt_feature_name=NXT_HAVE_PYTHON +nxt_feature_run=no +nxt_feature_incs="-I${NXT_PYTHON_INCLUDE}" +nxt_feature_libs="$NXT_PYTHON_LIB $NXT_PYTHON_LIBS" +nxt_feature_test="#include <Python.h> + + int main() { + Py_Initialize(); + }" + +. auto/feature + +if [ $nxt_found = no ]; then + $echo + $echo $0: error: no Python found. + $echo + exit 1; +fi + + +$echo " + Python version: ${NXT_PYTHON_VERSION}" + + +NXT_PYTHON_MODULE_SRCS=" \ + src/nxt_python_wsgi.c \ +" + + +NXT_MODULES_INIT="$NXT_MODULES_INIT nxt_python_wsgi_init" +NXT_MODULES_SRCS="$NXT_MODULES_SRCS $NXT_PYTHON_MODULE_SRCS" + +NXT_LIB_AUX_LIBS="$NXT_LIB_AUX_LIBS $NXT_PYTHON_LIB $NXT_PYTHON_LIBS" diff --git a/auto/modules/python/make b/auto/modules/python/make new file mode 100644 index 00000000..edb8f0c0 --- /dev/null +++ b/auto/modules/python/make @@ -0,0 +1,24 @@ + +# Copyright (C) NGINX, Inc. +# Copyright (C) Valentin V. Bartenev + + +$echo >> $NXT_MAKEFILE +$echo >> $NXT_MAKEFILE + + +# The python module object files. + +for nxt_src in $NXT_PYTHON_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) -I $NXT_PYTHON_INCLUDE \\ + $NXT_LIB_AUX_CFLAGS \\ + -o $NXT_BUILD_DIR/$nxt_obj \\ + $nxt_src +END + +done |