From: Vsevolod Stakhov Date: Wed, 11 Jan 2017 14:06:18 +0000 (+0000) Subject: [Fix] Stop hardcoding of lua in C X-Git-Tag: 1.5.0~370 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9249726a98a417c82aee9ef14353cad6c63da91;p=thirdparty%2Frspamd.git [Fix] Stop hardcoding of lua in C --- diff --git a/src/lua/global_functions.lua b/rules/global_functions.lua similarity index 100% rename from src/lua/global_functions.lua rename to rules/global_functions.lua diff --git a/rules/rspamd.lua b/rules/rspamd.lua index a9ead440d2..a89f0a002a 100644 --- a/rules/rspamd.lua +++ b/rules/rspamd.lua @@ -21,6 +21,7 @@ config['regexp'] = {} local local_conf = rspamd_paths['CONFDIR'] local local_rules = rspamd_paths['RULESDIR'] +dofile(local_rules .. '/global_functions.lua') dofile(local_rules .. '/regexp/headers.lua') dofile(local_rules .. '/regexp/lotto.lua') dofile(local_rules .. '/regexp/fraud.lua') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 36ab66f739..33bc454065 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -170,7 +170,6 @@ TARGET_LINK_LIBRARIES(rspamd-server rspamd-zstd) IF (ENABLE_CLANG_PLUGIN MATCHES "ON") ADD_DEPENDENCIES(rspamd-server rspamd-clang) ENDIF() -ADD_DEPENDENCIES(rspamd-server rspamd_lua_preprocess) ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${CMAKE_CURRENT_BINARY_DIR}/workers.c) SET_TARGET_PROPERTIES(rspamd PROPERTIES LINKER_LANGUAGE C) diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt index ba1a7c16a7..9c561c0e43 100644 --- a/src/lua/CMakeLists.txt +++ b/src/lua/CMakeLists.txt @@ -27,11 +27,4 @@ SET(LUASRC ${CMAKE_CURRENT_SOURCE_DIR}/lua_common.c ${CMAKE_CURRENT_SOURCE_DIR}/lua_cryptobox.c ${CMAKE_CURRENT_SOURCE_DIR}/lua_map.c) -SET(RSPAMD_LUA ${LUASRC} PARENT_SCOPE) -SET(RSPAMDMLUASRC "${CMAKE_CURRENT_SOURCE_DIR}/global_functions.lua") -ADD_CUSTOM_TARGET(rspamd_lua_preprocess - ${PERL_EXECUTABLE} - "${CMAKE_SOURCE_DIR}/lua_preprocess.pl" - "${CMAKE_CURRENT_SOURCE_DIR}" - "${CMAKE_CURRENT_BINARY_DIR}" - SOURCES ${RSPAMDMLUASRC} ${CMAKE_SOURCE_DIR}/lua_preprocess.pl) \ No newline at end of file +SET(RSPAMD_LUA ${LUASRC} PARENT_SCOPE) \ No newline at end of file diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 3dc02991b3..b9eabe7903 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -14,7 +14,6 @@ * limitations under the License. */ #include "lua_common.h" -#include "lua/global_functions.lua.h" #include "lptree.h" #include "utlist.h" #include @@ -302,11 +301,6 @@ rspamd_lua_init () rspamd_lua_new_class (L, "rspamd{worker}", worker_reg); rspamd_lua_add_preload (L, "ucl", luaopen_ucl); - if (luaL_dostring (L, rspamadm_script_global_functions) != 0) { - msg_err ("cannot execute lua global script: %s", - lua_tostring (L, -1)); - } - /* Add plugins global */ lua_newtable (L); lua_setglobal (L, "rspamd_plugins");