]> source.dussan.org Git - rspamd.git/commitdiff
* Do not overwrite lua plugins and configs if they already exists in target directory
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 19 Jul 2010 07:57:45 +0000 (11:57 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 19 Jul 2010 07:57:45 +0000 (11:57 +0400)
CMakeLists.txt

index 71c47785090fbfc7b6516a6564e2bf29bd2347be..9bf5a89b370bd87c4b65e009fed1db30e6404a08 100644 (file)
@@ -60,6 +60,7 @@ IF(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 FreeBSD")
  
 ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
 
@@ -76,6 +77,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
                                                /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")
 
@@ -87,6 +89,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
        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")
@@ -99,6 +102,7 @@ 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")
@@ -661,22 +665,49 @@ ENDIF(PERL_EXECUTABLE)
 
 
 # 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)