aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-03 18:56:10 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-03 18:56:10 +0300
commit89569341997df14df1f3fdfe2bbbb5bb6fa0e7a9 (patch)
tree9914bd27e698e1b0884070500013a0dc9b88c449 /CMakeLists.txt
parent5424cc32d47c5e98b9edfb2b342d9d98d97a1175 (diff)
downloadrspamd-89569341997df14df1f3fdfe2bbbb5bb6fa0e7a9.tar.gz
rspamd-89569341997df14df1f3fdfe2bbbb5bb6fa0e7a9.zip
* Add ability to fork multiply lmtp workers
* Add ability to drop privilleges of rspamd processes * Add ability to install redirector with rspamd * Add FreeBSD start scripts for rspamd and redirector * Remove command line parsing from util.c as it has specific usage only in main process
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt34
1 files changed, 33 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 060541513..19172f15d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,12 +11,15 @@ SET(RSPAMD_VERSION_PATCH 0)
SET(RSPAMD_VERSION "${RSPAMD_VERSION_MAJOR}.${RSPAMD_VERSION_MINOR}.${RSPAMD_VERSION_PATCH}")
SET(RSPAMD_MASTER_SITE_URL "http://cebka.pp.ru/hg/rspamd")
+SET(RSPAMD_USER "nobody")
+SET(RSPAMD_GROUP "nobody")
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
OPTION(DEBUG_MODE "Enable debug output [default: ON]" ON)
OPTION(ENABLE_OPTIMIZATION "Enable optimization [default: OFF]" OFF)
OPTION(SKIP_RELINK_RPATH "Skip relinking and full RPATH for the install tree" OFF)
+OPTION(ENABLE_REDIRECTOR "Enable redirector install [default: OFF]" OFF)
# Build optimized code for following CPU (default i386)
#SET(CPU_TUNE "i686")
@@ -152,6 +155,8 @@ CHECK_INCLUDE_FILES(arpa/inet.h HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILES(netdb.h HAVE_NETDB_H)
CHECK_INCLUDE_FILES(syslog.h HAVE_SYSLOG_H)
CHECK_INCLUDE_FILES(libgen.h HAVE_LIBGEN_H)
+CHECK_INCLUDE_FILES(pwd.h HAVE_PWD_H)
+CHECK_INCLUDE_FILES(grp.h HAVE_GRP_H)
IF(HAVE_SYS_WAIT_H)
LIST(APPEND CMAKE_REQUIRED_INCLUDES sys/wait.h)
@@ -202,6 +207,20 @@ ENDIF (MD5_INCLUDE)
SET(CMAKE_C_WARN_FLAGS " -Wall -W -Wpointer-arith -Wno-unused-parameter -Wno-unused-function -Wunused-variable -Wno-sign-compare -Wunused-value")
+# Platform specific routines
+IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ CONFIGURE_FILE(freebsd/rspamd.sh.in freebsd/rspamd.sh @ONLY)
+
+ IF(ENABLE_REDIRECTOR MATCHES "ON")
+ CONFIGURE_FILE(freebsd/redirector.sh.in freebsd/redirector.sh @ONLY)
+ ENDIF(ENABLE_REDIRECTOR MATCHES "ON")
+
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+
+IF(ENABLE_REDIRECTOR MATCHES "ON")
+ CONFIGURE_FILE(utils/redirector.pl.in utils/redirector.pl @ONLY)
+ENDIF(ENABLE_REDIRECTOR MATCHES "ON")
+
IF(DEBUG_MODE MATCHES "ON")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb ")
ENDIF(DEBUG_MODE MATCHES "ON")
@@ -299,7 +318,7 @@ IF(PERL_DYNALOADER)
TARGET_LINK_LIBRARIES(rspamd dynaloader)
ENDIF(PERL_DYNALOADER)
TARGET_LINK_LIBRARIES(rspamd ${GMIME2_LIBRARIES})
-ADD_DEPENDENCIES(rspamd perlxs)
+ADD_DEPENDENCIES(rspamd perlxs ${LEX_OUTPUT} ${YACC_OUTPUT})
ADD_EXECUTABLE(test/rspamd-test ${TESTDEPENDS} ${CONTRIBSRC} ${TESTSRC})
SET_TARGET_PROPERTIES(test/rspamd-test PROPERTIES LINKER_LANGUAGE C)
@@ -319,3 +338,16 @@ TARGET_LINK_LIBRARIES(utils/url-extracter ${GMIME2_LIBRARIES})
INSTALL(PROGRAMS rspamd-${RSPAMD_VERSION} DESTINATION bin RENAME rspamd)
INSTALL(PROGRAMS rspamc.pl DESTINATION bin RENAME rspamc)
INSTALL(CODE "EXECUTE_PROCESS(COMMAND make install WORKING_DIRECTORY perl)")
+
+IF(ENABLE_REDIRECTOR MATCHES "ON")
+ INSTALL(PROGRAMS utils/redirector.pl DESTINATION bin RENAME rspamd-redirector)
+ENDIF(ENABLE_REDIRECTOR MATCHES "ON")
+
+IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ INSTALL(PROGRAMS freebsd/rspamd.sh DESTINATION etc/rc.d)
+ IF(ENABLE_REDIRECTOR MATCHES "ON")
+ INSTALL(PROGRAMS freebsd/redirector.sh DESTINATION etc/rc.d)
+ ENDIF(ENABLE_REDIRECTOR MATCHES "ON")
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory /var/run/rspamd/)")
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND chown ${RSPAMD_USER}:${RSPAMD_GROUP} /var/run/rspamd/)")
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")