From 4f2f30d1e50a6887d163783346e9b050ff982861 Mon Sep 17 00:00:00 2001 From: Unbit Date: Sat, 9 Nov 2013 12:55:52 +0100 Subject: [PATCH] improved gccgo plugin --- buildconf/gccgo.ini | 4 ++++ plugins/gccgo/gccgo_plugin.c | 2 +- plugins/gccgo/uwsgiplugin.py | 16 +++++++--------- uwsgiconfig.py | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 buildconf/gccgo.ini diff --git a/buildconf/gccgo.ini b/buildconf/gccgo.ini new file mode 100644 index 0000000000..4a6303362a --- /dev/null +++ b/buildconf/gccgo.ini @@ -0,0 +1,4 @@ +[uwsgi] +main_plugin = gccgo +inherit = base +cflags = -g diff --git a/plugins/gccgo/gccgo_plugin.c b/plugins/gccgo/gccgo_plugin.c index 87903160a1..710de9d2b0 100644 --- a/plugins/gccgo/gccgo_plugin.c +++ b/plugins/gccgo/gccgo_plugin.c @@ -131,7 +131,7 @@ static void uwsgi_gccgo_initialize() { } runtime_check(); if (argc > 0) { - char **argv = uwsgi_calloc(sizeof(char *) * (argc + 1)); + char **argv = uwsgi_calloc(sizeof(char *) * (argc + 2)); char *argv_list = uwsgi_str(ugccgo.args); char *p, *ctx = NULL; int n = 0; diff --git a/plugins/gccgo/uwsgiplugin.py b/plugins/gccgo/uwsgiplugin.py index 75ab3841c0..d65db5ec0f 100644 --- a/plugins/gccgo/uwsgiplugin.py +++ b/plugins/gccgo/uwsgiplugin.py @@ -1,14 +1,12 @@ import os NAME='gccgo' -CFLAGS = [] +CFLAGS = ['-Wno-error'] LDFLAGS = [] -LIBS = [] -GCC_LIST = ['gccgo_plugin'] +LIBS = ['-lgo'] +GCC_LIST = ['gccgo_plugin', 'uwsgi.go'] -def post_build(config): - if os.system("gccgo -c -o plugins/gccgo/uwsgi.o plugins/gccgo/uwsgi.go") != 0: - os._exit(1) - if os.system("objcopy -j .go_export plugins/gccgo/uwsgi.o plugins/gccgo/uwsgi.gox") != 0: - os._exit(1) - print("*** uwsgi.gox available in %s/plugins/gccgo ***" % os.getcwd()) +#def post_build(config): +# if os.system("objcopy -j .go_export plugins/gccgo/uwsgi.go.o plugins/gccgo/uwsgi.gox") != 0: +# os._exit(1) +# print("*** uwsgi.gox available in %s/plugins/gccgo ***" % os.getcwd()) diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 5c9acb972a..5a0c84c083 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -406,7 +406,7 @@ def build_uwsgi(uc, print_only=False, gcll=None): gcc_list.append(cfile) elif cfile.endswith('.o'): gcc_list.append('%s/%s' % (path, cfile)) - elif not cfile.endswith('.c') and not cfile.endswith('.cc') and not cfile.endswith('.m'): + elif not cfile.endswith('.c') and not cfile.endswith('.cc') and not cfile.endswith('.go') and not cfile.endswith('.m'): compile(' '.join(uniq_warnings(p_cflags)), last_cflags_ts, path + '/' + cfile + '.o', path + '/' + cfile + '.c') gcc_list.append('%s/%s' % (path, cfile)) @@ -1253,7 +1253,7 @@ def build_plugin(path, uc, cflags, ldflags, libs, name = None): for cfile in up['GCC_LIST']: if cfile.endswith('.a'): gcc_list.append(cfile) - elif not cfile.endswith('.c') and not cfile.endswith('.cc') and not cfile.endswith('.m') and not cfile.endswith('.o'): + elif not cfile.endswith('.c') and not cfile.endswith('.cc') and not cfile.endswith('.m') and not cfile.endswith('.go') and not cfile.endswith('.o'): gcc_list.append(path + '/' + cfile + '.c') else: gcc_list.append(path + '/' + cfile)