]> source.dussan.org Git - rspamd.git/commitdiff
Install files and directories respecting DESTDIR environment variable.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 29 Jul 2011 21:14:03 +0000 (01:14 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 29 Jul 2011 21:14:03 +0000 (01:14 +0400)
Install sample config fgom binary dir.

CMakeLists.txt

index 6bfc718b2ce3fa8638587dc5a68954bdaa2e76c0..4a817241815b048cfd144a9aee7a831fcdfe52cc 100644 (file)
@@ -51,10 +51,10 @@ ENDIF(CMAKE_INSTALL_PREFIX)
 # Platform specific routines
 IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DFREEBSD")
-       CONFIGURE_FILE(freebsd/rspamd.sh.in freebsd/rspamd.sh @ONLY)
+       CONFIGURE_FILE(freebsd/rspamd.sh.in freebsd/rspamd @ONLY)
 
        IF(ENABLE_REDIRECTOR MATCHES "ON")
-               CONFIGURE_FILE(freebsd/redirector.sh.in freebsd/redirector.sh @ONLY)
+               CONFIGURE_FILE(freebsd/redirector.sh.in freebsd/redirector @ONLY)
        ENDIF(ENABLE_REDIRECTOR MATCHES "ON")
        IF(CMAKE_INSTALL_PREFIX)
            SET(ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc")
@@ -673,9 +673,7 @@ ENDIF(GLIB_COMPAT)
 INSTALL(TARGETS rspamd RUNTIME DESTINATION bin)
 
 # Configs
-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(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${ETC_PREFIX}/rspamd)")
 
 INSTALL(FILES conf/2tld.inc RENAME 2tld.inc.orig DESTINATION etc/rspamd)
 IF(NOT EXISTS ${ETC_PREFIX}/rspamd/2tld.inc)
@@ -687,32 +685,24 @@ IF(NOT EXISTS ${ETC_PREFIX}/rspamd/surbl-whitelist.inc)
        INSTALL(FILES conf/surbl-whitelist.inc DESTINATION etc/rspamd)
 ENDIF(NOT EXISTS ${ETC_PREFIX}/rspamd/surbl-whitelist.inc)
 
-INSTALL(FILES conf/rspamd.xml.sample DESTINATION etc/)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/conf/rspamd.xml.sample DESTINATION etc/)
 
 # Lua plugins
-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)
+INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{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 ${LUA_PLUGINS})
        GET_FILENAME_COMPONENT(_rp ${LUA_PLUGIN} PATH)
-       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})
+       INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${ETC_PREFIX}/rspamd/plugins/lua/${_rp})")
        INSTALL(FILES "src/plugins/lua/${LUA_PLUGIN}" DESTINATION etc/rspamd/plugins/lua/${_rp})
 ENDFOREACH(LUA_PLUGIN)
 
 # Lua config
-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)
+INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{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 ${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})
+       INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${ETC_PREFIX}/rspamd/lua/${_rp})")
        IF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${LUA_CONF})
                INSTALL(FILES "conf/lua/${LUA_CONF}" DESTINATION etc/rspamd/lua/${_rp})
        ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${LUA_CONF})
@@ -724,17 +714,17 @@ INSTALL(FILES "doc/rspamc.1" DESTINATION man/man1)
 
 # Start scripts
 IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT BUILD_PORT)
-       INSTALL(PROGRAMS freebsd/rspamd.sh DESTINATION etc/rc.d)
+       INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/freebsd/rspamd DESTINATION etc/rc.d)
        IF(ENABLE_REDIRECTOR MATCHES "ON")
-               INSTALL(PROGRAMS freebsd/redirector.sh DESTINATION etc/rc.d)
+               INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/freebsd/redirector DESTINATION etc/rc.d)
        ENDIF(ENABLE_REDIRECTOR MATCHES "ON")
-       INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/var/run/rspamd/)")
-       INSTALL(CODE "EXECUTE_PROCESS(COMMAND chown ${RSPAMD_USER}:${RSPAMD_GROUP} ${DESTDIR}/var/run/rspamd/)")
+       INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}/var/run/rspamd)")
+       INSTALL(CODE "EXECUTE_PROCESS(COMMAND chown ${RSPAMD_USER}:${RSPAMD_GROUP} \$ENV{DESTDIR}/var/run/rspamd/)")
 ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT BUILD_PORT)
 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
        INSTALL(PROGRAMS "linux/${LINUX_START_SCRIPT}" DESTINATION etc/init.d RENAME rspamd)
-       INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/var/run/rspamd/)")
-       INSTALL(CODE "EXECUTE_PROCESS(COMMAND chown ${RSPAMD_USER}:${RSPAMD_GROUP} ${DESTDIR}/var/run/rspamd/)")
+       INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}/var/run/rspamd)")
+       INSTALL(CODE "EXECUTE_PROCESS(COMMAND chown ${RSPAMD_USER}:${RSPAMD_GROUP} \$ENV{DESTDIR}/var/run/rspamd/)")
 ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 
 # CPack section