/usr/local/lib
DOC "Path where the libintl library can be found")
LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIBRARY})
+ MESSAGE(STATUS "Configuring for FreeBSD")
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
/usr/local/lib
DOC "Path where the libintl library can be found")
LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIBRARY})
+ MESSAGE(STATUS "Configuring for Darwin")
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
ENDIF(NOT ETC_PREFIX)
LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt)
LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl)
+ MESSAGE(STATUS "Configuring for Linux")
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl)
LIST(APPEND CMAKE_REQUIRED_LIBRARIES resolv)
LIST(APPEND CMAKE_REQUIRED_LIBRARIES m)
+ MESSAGE(STATUS "Configuring for Solaris")
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
IF(ENABLE_PERL MATCHES "ON")
# Configs
-INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd)")
+IF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd)
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd)")
+ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd)
INSTALL(FILES conf/2tld.inc RENAME 2tld.inc.orig DESTINATION ${ETC_PREFIX}/rspamd)
IF(NOT EXISTS ${ETC_PREFIX}/rspamd/2tld.inc)
-INSTALL(FILES conf/2tld.inc DESTINATION ${ETC_PREFIX}/rspamd)
+ INSTALL(FILES conf/2tld.inc DESTINATION ${ETC_PREFIX}/rspamd)
ENDIF(NOT EXISTS ${ETC_PREFIX}/rspamd/2tld.inc)
INSTALL(FILES conf/rspamd.xml.sample DESTINATION ${ETC_PREFIX}/)
# Lua plugins
-INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins)")
-INSTALL(DIRECTORY src/plugins/lua DESTINATION ${ETC_PREFIX}/rspamd/plugins PATTERN "*.lua")
+IF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua)
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua)")
+ENDIF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua)
+
+FILE(GLOB LUA_PLUGINS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/lua" "${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/lua/*.lua" )
+FOREACH(LUA_PLUGIN IN LISTS LUA_PLUGINS)
+ GET_FILENAME_COMPONENT(_rp ${LUA_PLUGIN} PATH)
+ MESSAGE(STATUS ${LUA_PLUGIN})
+ MESSAGE(STATUS ${_rp})
+ IF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua/${_rp})
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua/${_rp})")
+ ENDIF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua/${_rp})
+ IF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/${_rp}/${LUA_PLUGIN})
+ INSTALL(FILES "src/plugins/lua/${LUA_PLUGIN}" DESTINATION ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua/${_rp})
+ ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/${_rp}/${LUA_PLUGIN})
+ENDFOREACH(LUA_PLUGIN)
# Lua config
-INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/lua)")
-INSTALL(DIRECTORY conf/lua DESTINATION ${ETC_PREFIX}/rspamd/ PATTERN "*.lua")
+IF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/lua)
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/lua)")
+ENDIF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/lua)
+FILE(GLOB_RECURSE LUA_CONFIGS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/conf/lua" "${CMAKE_CURRENT_SOURCE_DIR}/conf/lua/*.lua")
+FOREACH(LUA_CONF IN LISTS LUA_CONFIGS)
+ GET_FILENAME_COMPONENT(_rp ${LUA_CONF} PATH)
+ IF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp})
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp})")
+ ENDIF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp})
+ IF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp}/${LUA_CONF})
+ INSTALL(FILES "conf/lua/${LUA_CONF}" DESTINATION ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp})
+ ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp}/${LUA_CONF})
+ENDFOREACH(LUA_CONF)
# Perl lib
IF(PERL_EXECUTABLE)