diff --git a/core/plugins_builder.c b/core/plugins_builder.c new file mode 100644 index 00000000..a1646d22 --- /dev/null +++ b/core/plugins_builder.c @@ -0,0 +1,16 @@ +#include + +/* + + steps: + + mkdir(.uwsgi_plugin_builder) + generate .uwsgi_plugin_builder/uwsgi.h + setenv(CFLAGS=uwsgi_cflags) + pipe uwsgiconfig.py to python passing args + +*/ + +int uwsgi_build_plugin(char *directory) { + return 0; +} diff --git a/core/uwsgi.c b/core/uwsgi.c index ce7f3f27..f74e77f5 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -907,6 +907,7 @@ static struct uwsgi_option uwsgi_base_options[] = { {"exit", optional_argument, 0, "force exit() of the instance", uwsgi_opt_exit, NULL, UWSGI_OPT_IMMEDIATE}, {"cflags", no_argument, 0, "report uWSGI CFLAGS (useful for building external plugins)", uwsgi_opt_cflags, NULL, UWSGI_OPT_IMMEDIATE}, {"dot-h", no_argument, 0, "dump the uwsgi.h used for building the core (useful for building external plugins)", uwsgi_opt_dot_h, NULL, UWSGI_OPT_IMMEDIATE}, + {"build-plugin", no_argument, 0, "build a uWSGI plugin for the current binary", uwsgi_opt_build_plugin, NULL, UWSGI_OPT_IMMEDIATE}, {"version", no_argument, 0, "print uWSGI version", uwsgi_opt_print, UWSGI_VERSION, 0}, {0, 0, 0, 0, 0, 0, 0} }; @@ -4506,6 +4507,9 @@ void uwsgi_opt_dot_h(char *opt, char *filename, void *foobar) { exit(0); } +void uwsgi_opt_build_plugin(char *opt, char *directory, void *foobar) { + _exit(uwsgi_build_plugin(directory)); +} void uwsgi_opt_connect_and_read(char *opt, char *address, void *foobar) { diff --git a/uwsgi.h b/uwsgi.h index eb4da133..daaecc3b 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -3761,6 +3761,7 @@ char *uwsgi_substitute(char *, char *, char *); void uwsgi_opt_add_custom_option(char *, char *, void *); void uwsgi_opt_cflags(char *, char *, void *); +void uwsgi_opt_build_plugin(char *, char *, void *); void uwsgi_opt_dot_h(char *, char *, void *); void uwsgi_opt_connect_and_read(char *, char *, void *); void uwsgi_opt_extract(char *, char *, void *); @@ -4528,6 +4529,8 @@ struct uwsgi_protocol *uwsgi_register_protocol(char *, void (*)(struct uwsgi_soc void uwsgi_protocols_register(void); +int uwsgi_build_plugin(char *dir); + #ifdef __cplusplus } #endif diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 46e9f982..0bef019b 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -546,7 +546,7 @@ class uConf(object): 'core/setup_utils', 'core/clock', 'core/init', 'core/buffer', 'core/reader', 'core/writer', 'core/alarm', 'core/cron', 'core/hooks', 'core/plugins', 'core/lock', 'core/cache', 'core/daemons', 'core/errors', 'core/hash', 'core/master_events', 'core/chunked', 'core/queue', 'core/event', 'core/signal', 'core/strings', 'core/progress', 'core/timebomb', 'core/ini', 'core/fsmon', 'core/mount', - 'core/metrics', + 'core/metrics', 'core/plugins_builder', 'core/rpc', 'core/gateway', 'core/loop', 'core/cookie', 'core/querystring', 'core/rb_timers', 'core/transformations', 'core/uwsgi'] # add protocols self.gcc_list.append('proto/base')