V{DESTDIR}${RULESDIR})") INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${LUALIBDIR})") # Install configs only if they are unchanged LIST(LENGTH CONFFILES CONFLIST_COUNT) MATH(EXPR CONFLIST_MAX ${CONFLIST_COUNT}-1) FILE(GLOB_RECURSE CONF_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/conf" "${CMAKE_CURRENT_SOURCE_DIR}/conf/*" ) FOREACH(CONF_FILE ${CONF_FILES}) GET_FILENAME_COMPONENT(_rp ${CONF_FILE} PATH) INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${CONFDIR}/${_rp})") INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/conf/${CONF_FILE}" DESTINATION ${CONFDIR}/${_rp}) ENDFOREACH(CONF_FILE) SET(MAIN_CONF "conf/rspamd.conf") IF(BUILD_PORT) INSTALL_IF_NOT_EXISTS(${MAIN_CONF} ${CONFDIR} "rspamd.conf" ".sample") ELSE(BUILD_PORT) INSTALL_IF_NOT_EXISTS(${MAIN_CONF} ${CONFDIR} "rspamd.conf" "") ENDIF(BUILD_PORT) IF(INSTALL_EXAMPLES MATCHES "ON") INSTALL(FILES ${MAIN_CONF} DESTINATION ${EXAMPLESDIR}) ENDIF(INSTALL_EXAMPLES MATCHES "ON") # Lua plugins FILE(GLOB LUA_PLUGINS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/lua" "${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/lua/*.lua" ) FOREACH(LUA_PLUGIN ${LUA_PLUGINS}) GET_FILENAME_COMPONENT(_rp ${LUA_PLUGIN} PATH) INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${PLUGINSDIR}/lua/${_rp})") INSTALL(FILES "src/plugins/lua/${LUA_PLUGIN}" DESTINATION ${PLUGINSDIR}/lua/${_rp}) ENDFOREACH(LUA_PLUGIN) # Install TLD list INSTALL(FILES "contrib/publicsuffix/effective_tld_names.dat" DESTINATION "${PLUGINSDIR}") # Install languages data INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${PLUGINSDIR}/languages)") FILE(GLOB LANGUAGES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/languages-data/*.json") FOREACH(_LANG ${LANGUAGES}) INSTALL(FILES "${_LANG}" DESTINATION ${PLUGINSDIR}/languages) ENDFOREACH() # Lua config FILE(GLOB_RECURSE LUA_CONFIGS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/rules" "${CMAKE_CURRENT_SOURCE_DIR}/rules/*.lua") FOREACH(LUA_CONF ${LUA_CONFIGS}) GET_FILENAME_COMPONENT(_rp ${LUA_CONF} PATH) INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${RULESDIR}/${_rp})") 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 "lualib/${LUA_LIB}" DESTINATION ${LUALIBDIR}/${_rp}) ENDFOREACH(LUA_LIB) # Install lua fun library INSTALL(FILES "contrib/lua-fun/fun.lua" DESTINATION ${LUALIBDIR}) INSTALL(FILES "contrib/lua-argparse/argparse.lua" DESTINATION ${LUALIBDIR}) IF(ENABLE_TORCH MATCHES "ON") INSTALL(FILES "contrib/lua-moses/moses.lua" DESTINATION ${LUALIBDIR}) ENDIF() # systemd unit IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND WANT_SYSTEMD_UNITS MATCHES "ON") INSTALL(FILES "rspamd.service" DESTINATION ${SYSTEMDDIR}) ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND WANT_SYSTEMD_UNITS MATCHES "ON") # Manual pages INSTALL(FILES "doc/rspamd.8" DESTINATION ${MANDIR}/man8) INSTALL(FILES "doc/rspamc.1" DESTINATION ${MANDIR}/man1) INSTALL(FILES "doc/rspamadm.1" DESTINATION ${MANDIR}/man1) # Utils INSTALL(PROGRAMS "utils/rspamd_stats.pl" RENAME rspamd_stats DESTINATION bin) # Install webui IF(INSTALL_WEBUI MATCHES "ON") INSTALL(DIRECTORY "interface/" DESTINATION ${WWWDIR} PATTERN ".git" EXCLUDE) ENDIF(INSTALL_WEBUI MATCHES "ON") INSTALL(DIRECTORY "contrib/elastic/" DESTINATION "${PLUGINSDIR}/elastic" PATTERN ".git" EXCLUDE) ADD_CUSTOM_TARGET(dist ${CMAKE_SOURCE_DIR}/dist.sh "${CMAKE_BINARY_DIR}/rspamd-${RSPAMD_VERSION}.tar.xz" "${TAR}" COMMENT "Create source distribution" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) IF(NOT DEBIAN_BUILD) ADD_CUSTOM_TARGET(check DEPENDS rspamd-test) ADD_CUSTOM_TARGET(run-test DEPENDS check COMMAND test/rspamd-test) ENDIF(NOT DEBIAN_BUILD)