diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-18 16:04:23 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-18 16:40:48 +0100 |
commit | 01d8f7e7a8f62a4797ebbd446b0b975d1ae735ae (patch) | |
tree | 4e3e31c62160eda5f9a6bd664fed029fa35c134a | |
parent | de8eb1d9a3b915fc932cc9f97581505ecefa47df (diff) | |
download | rspamd-01d8f7e7a8f62a4797ebbd446b0b975d1ae735ae.tar.gz rspamd-01d8f7e7a8f62a4797ebbd446b0b975d1ae735ae.zip |
[Rework] Move global functions to a separate directory
-rw-r--r-- | CMakeLists.txt | 14 | ||||
-rw-r--r-- | lualib/global_functions.lua (renamed from rules/global_functions.lua) | 0 | ||||
-rw-r--r-- | rules/rspamd.lua | 3 |
3 files changed, 16 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d556e801..18604702b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,10 @@ IF(NOT RULESDIR) SET(RULESDIR "${PLUGINSDIR}/rules") ENDIF(NOT RULESDIR) +IF(NOT LUALIBDIR) + SET(LUALIBDIR "${PLUGINSDIR}/lib") +ENDIF(NOT LUALIBDIR) + IF(NOT WWWDIR) SET(WWWDIR "${CMAKE_INSTALL_PREFIX}/share/rspamd/www") ENDIF(NOT WWWDIR) @@ -1278,6 +1282,7 @@ INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${CONFDIR})") INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${EXAMPLESDIR})") INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${PLUGINSDIR}/lua)") INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${RULESDIR})") +INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${LUALIBDIR})") # Install configs only if they are unchanged LIST(LENGTH CONFFILES CONFLIST_COUNT) @@ -1337,6 +1342,15 @@ FOREACH(LUA_CONF ${LUA_CONFIGS}) INSTALL(FILES "rules/${LUA_CONF}" DESTINATION ${RULESDIR}/${_rp}) ENDFOREACH(LUA_CONF) +# Lua libs +FILE(GLOB_RECURSE LUA_LIBS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/lualib" + "${CMAKE_CURRENT_SOURCE_DIR}/lualib/*.lua") +FOREACH(LUA_LIB ${LUA_LIBS}) + GET_FILENAME_COMPONENT(_rp ${LUA_LIB} PATH) + INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${LUALIBDIR}/${_rp})") + INSTALL(FILES "rules/${LUA_LIB}" DESTINATION ${LUALIBDIR}/${_rp}) +ENDFOREACH(LUA_LIB) + # systemd unit IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND WANT_SYSTEMD_UNITS MATCHES "ON") INSTALL(FILES "rspamd.service" DESTINATION ${SYSTEMDDIR}) diff --git a/rules/global_functions.lua b/lualib/global_functions.lua index e3c95c549..e3c95c549 100644 --- a/rules/global_functions.lua +++ b/lualib/global_functions.lua diff --git a/rules/rspamd.lua b/rules/rspamd.lua index ce461d8d3..3cdd626f9 100644 --- a/rules/rspamd.lua +++ b/rules/rspamd.lua @@ -16,12 +16,13 @@ limitations under the License. -- This is main lua config file for rspamd +require "global_functions" () + 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/misc.lua') dofile(local_rules .. '/regexp/upstream_spam_filters.lua') |