diff --git a/src/SConscript b/src/SConscript index 89335f4e..5ccf4ef0 100644 --- a/src/SConscript +++ b/src/SConscript @@ -31,6 +31,16 @@ env.Depends(configparser, lemon) mod_ssi_exprparser = env.Command(['mod_ssi_exprparser.c', 'mod_ssi_exprparser.h'], 'mod_ssi_exprparser.y', '(cd build; ../' + lemon[0].path + ' -q ../$SOURCE ../src/lempar.c; cd ..)') env.Depends(mod_ssi_exprparser, lemon) +staticenv = env.Copy(CPPFLAGS=[ env['CPPFLAGS'], '-DLIGHTTPD_STATIC', '-DOPENSSL_NO_KRB5']) +## turn all src-files into objects +staticsrc = src + common_src + [ 'mod_access.c' ] +staticobj = [] +for cfile in staticsrc: + staticobj += [ staticenv.Object('static-' + cfile.replace('.c', ''), cfile) ] + +staticbin = staticenv.Program('lighttpd-static', staticobj, LIBS = [ 'pthread', 'fam', 'pthread', 'krb5', 'crypto', 'ssl', 'crypto', 'ssl', 'krb5', 'k5crypto', 'krb5support', 'com_err', 'resolv', 'pcre' ], LINKFLAGS= ['-static'] ) +Alias('static', staticbin) + implib = 'lighttpd.exe.a' bin_targets = ['lighttpd'] bin_linkflags = [ env['LINKFLAGS'] ] @@ -50,6 +60,7 @@ env.Depends(instbin, configparser) spawn_fcgi = env.Program("spawn-fcgi", "spawn-fcgi.c") + if env['COMMON_LIB'] == 'bin': common_lib = instbin[1] diff --git a/src/plugin.c b/src/plugin.c index b375017d..9b941d03 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -66,6 +66,7 @@ static void plugin_free(plugin *p) { /*if (RUNNING_ON_VALGRIND) use_dlclose = 0;*/ #endif +#ifndef LIGHTTPD_STATIC if (use_dlclose && p->lib) { #ifdef __WIN32 FreeLibrary(p->lib); @@ -73,6 +74,7 @@ static void plugin_free(plugin *p) { dlclose(p->lib); #endif } +#endif free(p); } @@ -100,7 +102,23 @@ static int plugins_register(server *srv, plugin *p) { * */ +#ifdef LIGHTTPD_STATIC +int plugins_load(server *srv) { + plugin *p; +#define PLUGIN_INIT(x)\ + p = plugin_init(); \ + if (x ## _plugin_init(p)) { \ + log_error_write(srv, __FILE__, __LINE__, "ss", #x, "plugin init failed" ); \ + plugin_free(p); \ + return -1;\ + }\ + plugins_register(srv, p); + PLUGIN_INIT(mod_access); + + return 0; +} +#else int plugins_load(server *srv) { plugin *p; int (*init)(plugin *pl); @@ -205,6 +223,7 @@ int plugins_load(server *srv) { return 0; } +#endif #define PLUGIN_TO_SLOT(x, y) \ handler_t plugins_call_##y(server *srv, connection *con) {\