Skip to content

Commit

Permalink
improved gccgo plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
unbit committed Nov 9, 2013
1 parent d3b28e7 commit 4f2f30d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 4 additions & 0 deletions buildconf/gccgo.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[uwsgi]
main_plugin = gccgo
inherit = base
cflags = -g
2 changes: 1 addition & 1 deletion plugins/gccgo/gccgo_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 7 additions & 9 deletions plugins/gccgo/uwsgiplugin.py
Original file line number Diff line number Diff line change
@@ -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())
4 changes: 2 additions & 2 deletions uwsgiconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4f2f30d

Please sign in to comment.