python (1241:cc6c74fd768e) python (1489:4a3ec07f4b19)
1
2# Copyright (C) Valentin V. Bartenev
3# Copyright (C) Igor Sysoev
4# Copyright (C) NGINX, Inc.
5
6
7shift
8

--- 54 unchanged lines hidden (view full) ---

63nxt_found=no
64
65if /bin/sh -c "$NXT_PYTHON_CONFIG --prefix" >> $NXT_AUTOCONF_ERR 2>&1; then
66
67 if ${NXT_PYTHON_CONFIG} --embed >/dev/null 2>&1; then
68 NXT_PYTHON_CONFIG="${NXT_PYTHON_CONFIG} --embed"
69 fi
70
1
2# Copyright (C) Valentin V. Bartenev
3# Copyright (C) Igor Sysoev
4# Copyright (C) NGINX, Inc.
5
6
7shift
8

--- 54 unchanged lines hidden (view full) ---

63nxt_found=no
64
65if /bin/sh -c "$NXT_PYTHON_CONFIG --prefix" >> $NXT_AUTOCONF_ERR 2>&1; then
66
67 if ${NXT_PYTHON_CONFIG} --embed >/dev/null 2>&1; then
68 NXT_PYTHON_CONFIG="${NXT_PYTHON_CONFIG} --embed"
69 fi
70
71 NXT_PYTHON_EXEC=`${NXT_PYTHON_CONFIG} --exec-prefix`/bin/${NXT_PYTHON}
71 NXT_PYTHON_INCLUDE=`${NXT_PYTHON_CONFIG} --includes`
72 NXT_PYTHON_LIBS=`${NXT_PYTHON_CONFIG} --ldflags`
73
74 if [ "$NXT_PYTHON_LIB_PATH" != "" ]; then
75 # "python-config --ldflags" may not contain path to libpython.
76 NXT_PYTHON_LDFLAGS="-L$NXT_PYTHON_LIB_PATH -Wl,-rpath $NXT_PYTHON_LIB_PATH"
77 else
78 NXT_PYTHON_LDFLAGS=""

--- 45 unchanged lines hidden (view full) ---

124
125if grep ^$NXT_PYTHON_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then
126 $echo
127 $echo $0: error: duplicate \"$NXT_PYTHON_MODULE\" module configured.
128 $echo
129 exit 1;
130fi
131
72 NXT_PYTHON_INCLUDE=`${NXT_PYTHON_CONFIG} --includes`
73 NXT_PYTHON_LIBS=`${NXT_PYTHON_CONFIG} --ldflags`
74
75 if [ "$NXT_PYTHON_LIB_PATH" != "" ]; then
76 # "python-config --ldflags" may not contain path to libpython.
77 NXT_PYTHON_LDFLAGS="-L$NXT_PYTHON_LIB_PATH -Wl,-rpath $NXT_PYTHON_LIB_PATH"
78 else
79 NXT_PYTHON_LDFLAGS=""

--- 45 unchanged lines hidden (view full) ---

125
126if grep ^$NXT_PYTHON_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then
127 $echo
128 $echo $0: error: duplicate \"$NXT_PYTHON_MODULE\" module configured.
129 $echo
130 exit 1;
131fi
132
133
134NXT_PYTHON_MOUNTS_HEADER=$NXT_BUILD_DIR/nxt_python_mounts.h
135
136$NXT_PYTHON_EXEC -c 'import os.path
137import sys
138pyver = "python" + str(sys.version_info[0]) + "." + str(sys.version_info[1])
139
140print("static const nxt_fs_mount_t nxt_python%d%d_mounts[] = {" % (sys.version_info[0], sys.version_info[1]))
141
142pattern = "{(u_char *) \"%s\", (u_char *) \"%s\", (u_char *) \"bind\", NXT_MS_BIND|NXT_MS_REC, NULL},"
143base = None
144for p in sys.path:
145 if len(p) > 0:
146 if os.path.basename(p) == pyver:
147 base = p
148
149if base is None:
150 raise Exception("failed to compute sys.path mount points")
151
152print(pattern % (base, base))
153
154for p in sys.path:
155 if len(p) > 0:
156 if not p.startswith(base):
157 print(pattern % (p, p))
158
159print("};\n\n")
160
161' >> $NXT_PYTHON_MOUNTS_HEADER
162
163
132$echo " + Python module: ${NXT_PYTHON_MODULE}.unit.so"
133
134. auto/cc/deps
135
136$echo >> $NXT_MAKEFILE
137
138NXT_PYTHON_MODULE_SRCS=" \
139 src/nxt_python_wsgi.c \

--- 20 unchanged lines hidden (view full) ---

160 $nxt_dep_post
161
162-include $NXT_BUILD_DIR/$nxt_dep
163
164END
165
166done
167
164$echo " + Python module: ${NXT_PYTHON_MODULE}.unit.so"
165
166. auto/cc/deps
167
168$echo >> $NXT_MAKEFILE
169
170NXT_PYTHON_MODULE_SRCS=" \
171 src/nxt_python_wsgi.c \

--- 20 unchanged lines hidden (view full) ---

192 $nxt_dep_post
193
194-include $NXT_BUILD_DIR/$nxt_dep
195
196END
197
198done
199
168
200
169cat << END >> $NXT_MAKEFILE
170
171.PHONY: ${NXT_PYTHON_MODULE}
172.PHONY: ${NXT_PYTHON_MODULE}-install
173.PHONY: ${NXT_PYTHON_MODULE}-uninstall
174
175all: ${NXT_PYTHON_MODULE}
176

--- 22 unchanged lines hidden ---
201cat << END >> $NXT_MAKEFILE
202
203.PHONY: ${NXT_PYTHON_MODULE}
204.PHONY: ${NXT_PYTHON_MODULE}-install
205.PHONY: ${NXT_PYTHON_MODULE}-uninstall
206
207all: ${NXT_PYTHON_MODULE}
208

--- 22 unchanged lines hidden ---