Line
Link Here
|
0 |
-- uwsgiconfig.py |
0 |
++ uwsgiconfig.py |
Lines 20-26
Link Here
|
20 |
PLUGINS = [] |
20 |
PLUGINS = [] |
21 |
UNBIT=False |
21 |
UNBIT=False |
22 |
UWSGI_BIN_NAME = 'uwsgi' |
22 |
UWSGI_BIN_NAME = 'uwsgi' |
23 |
GCC='gcc' |
|
|
24 |
|
23 |
|
25 |
# specific compilation flags |
24 |
# specific compilation flags |
26 |
# libxml2 or expat |
25 |
# libxml2 or expat |
Lines 46-62
Link Here
|
46 |
|
45 |
|
47 |
from distutils import sysconfig |
46 |
from distutils import sysconfig |
48 |
|
47 |
|
|
|
48 |
GCC = os.environ.get('CC', sysconfig.get_config_var('CC')) |
49 |
if not GCC: |
50 |
GCC = 'gcc' |
51 |
|
49 |
gcc_list = ['utils', 'pyutils', 'protocol', 'socket', 'logging', 'wsgi_handlers', 'wsgi_headers', 'uwsgi_handlers', 'uwsgi'] |
52 |
gcc_list = ['utils', 'pyutils', 'protocol', 'socket', 'logging', 'wsgi_handlers', 'wsgi_headers', 'uwsgi_handlers', 'uwsgi'] |
50 |
|
53 |
|
51 |
# large file support |
54 |
# large file support |
52 |
try: |
55 |
try: |
53 |
cflags = ['-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64'] + sysconfig.get_config_var('CFLAGS').split() |
56 |
cflags = ['-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64'] + os.environ.get("CFLAGS", "").split() |
54 |
except: |
57 |
except: |
55 |
print("You need python headers to build uWSGI.") |
58 |
print("You need python headers to build uWSGI.") |
56 |
sys.exit(1) |
59 |
sys.exit(1) |
57 |
|
60 |
|
58 |
cflags = cflags + ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True) ] |
61 |
cflags = cflags + ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True) ] |
59 |
ldflags = ['-lpthread', '-rdynamic'] + sysconfig.get_config_var('LIBS').split() + sysconfig.get_config_var('SYSLIBS').split() |
62 |
ldflags = os.environ.get("LDFLAGS", "").split() |
|
|
63 |
libs = ['-lpthread', '-rdynamic'] + sysconfig.get_config_var('LIBS').split() + sysconfig.get_config_var('SYSLIBS').split() |
60 |
|
64 |
|
61 |
def depends_on(what, dep): |
65 |
def depends_on(what, dep): |
62 |
for d in dep: |
66 |
for d in dep: |
Lines 97-103
Link Here
|
97 |
print(plugin) |
101 |
print(plugin) |
98 |
|
102 |
|
99 |
print("*** uWSGI linking ***") |
103 |
print("*** uWSGI linking ***") |
100 |
ldline = "%s -o %s %s %s" % (GCC, bin_name, ' '.join(map(add_o, gcc_list)), ' '.join(ldflags)) |
104 |
ldline = "%s -o %s %s %s %s" % (GCC, bin_name, ' '.join(ldflags), ' '.join(map(add_o, gcc_list)), ' '.join(libs)) |
101 |
print(ldline) |
105 |
print(ldline) |
102 |
ret = os.system(ldline) |
106 |
ret = os.system(ldline) |
103 |
if ret != 0: |
107 |
if ret != 0: |
Lines 141-159
Link Here
|
141 |
version = sys.version_info |
145 |
version = sys.version_info |
142 |
uver = "%d.%d" % (version[0], version[1]) |
146 |
uver = "%d.%d" % (version[0], version[1]) |
143 |
|
147 |
|
144 |
ldflags.append('-lpython' + uver) |
148 |
libs.append('-lpython' + uver) |
145 |
|
149 |
|
146 |
if str(PYLIB_PATH) != '': |
150 |
if str(PYLIB_PATH) != '': |
147 |
ldflags.insert(0,'-L' + PYLIB_PATH) |
151 |
libs.insert(0,'-L' + PYLIB_PATH) |
148 |
|
152 |
|
149 |
kvm_list = ['FreeBSD', 'OpenBSD', 'NetBSD', 'DragonFly'] |
153 |
kvm_list = ['FreeBSD', 'OpenBSD', 'NetBSD', 'DragonFly'] |
150 |
|
154 |
|
151 |
if uwsgi_os == 'SunOS': |
155 |
if uwsgi_os == 'SunOS': |
152 |
ldflags.append('-lsendfile') |
156 |
libs.append('-lsendfile') |
153 |
ldflags.remove('-rdynamic') |
157 |
libs.remove('-rdynamic') |
154 |
|
158 |
|
155 |
if uwsgi_os in kvm_list: |
159 |
if uwsgi_os in kvm_list: |
156 |
ldflags.append('-lkvm') |
160 |
libs.append('-lkvm') |
157 |
|
161 |
|
158 |
if uwsgi_os == 'OpenBSD': |
162 |
if uwsgi_os == 'OpenBSD': |
159 |
UGREEN = False |
163 |
UGREEN = False |
Lines 221-227
Link Here
|
221 |
print("*** libxml2 headers unavailable. uWSGI build is interrupted. You have to install libxml2 development package or use libexpat or disable XML") |
225 |
print("*** libxml2 headers unavailable. uWSGI build is interrupted. You have to install libxml2 development package or use libexpat or disable XML") |
222 |
sys.exit(1) |
226 |
sys.exit(1) |
223 |
else: |
227 |
else: |
224 |
ldflags.append(xmlconf) |
228 |
libs.append(xmlconf) |
225 |
xmlconf = spcall("xml2-config --cflags") |
229 |
xmlconf = spcall("xml2-config --cflags") |
226 |
if xmlconf is None: |
230 |
if xmlconf is None: |
227 |
print("*** libxml2 headers unavailable. uWSGI build is interrupted. You have to install libxml2 development package or use libexpat or disable XML") |
231 |
print("*** libxml2 headers unavailable. uWSGI build is interrupted. You have to install libxml2 development package or use libexpat or disable XML") |
Lines 232-251
Link Here
|
232 |
gcc_list.append('xmlconf') |
236 |
gcc_list.append('xmlconf') |
233 |
elif XML_IMPLEMENTATION == 'expat': |
237 |
elif XML_IMPLEMENTATION == 'expat': |
234 |
cflags.append("-DUWSGI_XML -DUWSGI_XML_EXPAT") |
238 |
cflags.append("-DUWSGI_XML -DUWSGI_XML_EXPAT") |
235 |
ldflags.append('-lexpat') |
239 |
libs.append('-lexpat') |
236 |
gcc_list.append('xmlconf') |
240 |
gcc_list.append('xmlconf') |
237 |
|
241 |
|
238 |
|
242 |
|
239 |
if ERLANG: |
243 |
if ERLANG: |
240 |
depends_on("ERLANG", ['EMBEDDED']) |
244 |
depends_on("ERLANG", ['EMBEDDED']) |
241 |
cflags.append("-DUWSGI_ERLANG") |
245 |
cflags.append("-DUWSGI_ERLANG") |
242 |
ldflags.append(ERLANG_LDFLAGS) |
246 |
libs.append(ERLANG_LDFLAGS) |
243 |
if str(ERLANG_CFLAGS) != '': |
247 |
if str(ERLANG_CFLAGS) != '': |
244 |
cflags.append(ERLANG_CFLAGS) |
248 |
cflags.append(ERLANG_CFLAGS) |
245 |
gcc_list.append('erlang') |
249 |
gcc_list.append('erlang') |
246 |
|
250 |
|
247 |
if SCTP: |
251 |
if SCTP: |
248 |
ldflags.append("-lsctp") |
252 |
libs.append("-lsctp") |
249 |
cflags.append("-DUWSGI_SCTP") |
253 |
cflags.append("-DUWSGI_SCTP") |
250 |
|
254 |
|
251 |
if SPOOLER: |
255 |
if SPOOLER: |
Lines 263-275
Link Here
|
263 |
import uwsgiplugin as up |
267 |
import uwsgiplugin as up |
264 |
|
268 |
|
265 |
cflags.append(up.CFLAGS) |
269 |
cflags.append(up.CFLAGS) |
266 |
ldflags.append(up.LDFLAGS) |
270 |
libs.append(up.LDFLAGS) |
267 |
|
271 |
|
268 |
cflags.insert(0, '-I.') |
272 |
cflags.insert(0, '-I.') |
269 |
|
273 |
|
270 |
plugin_base = path + '/' + up.NAME + '_plugin' |
274 |
plugin_base = path + '/' + up.NAME + '_plugin' |
271 |
|
275 |
|
272 |
gccline = "%s -fPIC -shared -o %s.so %s %s.c %s" % (GCC, plugin_base, ' '.join(cflags), plugin_base, ' '.join(ldflags)) |
276 |
gccline = "%s -fPIC -shared -o %s.so %s %s %s.c %s" % (GCC, plugin_base, ' '.join(cflags), ' '.join(ldflags), plugin_base, ' '.join(libs)) |
273 |
print(gccline) |
277 |
print(gccline) |
274 |
|
278 |
|
275 |
ret = os.system(gccline) |
279 |
ret = os.system(gccline) |
Lines 297-302
Link Here
|
297 |
print(' '.join(cflags)) |
301 |
print(' '.join(cflags)) |
298 |
if cmd == '--ldflags': |
302 |
if cmd == '--ldflags': |
299 |
print(' '.join(ldflags)) |
303 |
print(' '.join(ldflags)) |
|
|
304 |
if cmd == '--libs': |
305 |
print(' '.join(libs)) |
300 |
elif cmd == '--build': |
306 |
elif cmd == '--build': |
301 |
parse_vars() |
307 |
parse_vars() |
302 |
build_uwsgi(UWSGI_BIN_NAME) |
308 |
build_uwsgi(UWSGI_BIN_NAME) |