diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-01-26 21:37:48 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-01-26 21:37:48 +0300 |
commit | a4caaed0a2699936cc40b4f260a49033ae2ea807 (patch) | |
tree | 1b7e78c095ff6beaf519adefd2ecebc0a1b41770 /CMakeLists.txt | |
parent | 61078f0274de4d99c153349dc01a27567c50e489 (diff) | |
download | rspamd-a4caaed0a2699936cc40b4f260a49033ae2ea807.tar.gz rspamd-a4caaed0a2699936cc40b4f260a49033ae2ea807.zip |
* Add ability to build FreeBSD package from rspamd sources
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 136 |
1 files changed, 84 insertions, 52 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ad2d777a..17dd4d738 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,15 +55,21 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") IF(ENABLE_REDIRECTOR MATCHES "ON") CONFIGURE_FILE(freebsd/redirector.sh.in freebsd/redirector.sh @ONLY) ENDIF(ENABLE_REDIRECTOR MATCHES "ON") - IF(NOT ETC_PREFIX) - SET(ETC_PREFIX /usr/local/etc) - ENDIF(NOT ETC_PREFIX) - IF(NOT MAN_PREFIX) - SET(MAN_PREFIX /usr/local/man) - ENDIF(NOT MAN_PREFIX) - IF(NOT PREFIX) - SET(PREFIX /usr/local) - ENDIF(NOT PREFIX) + IF(CMAKE_INSTALL_PREFIX) + SET(ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc") + SET(MAN_PREFIX "${CMAKE_INSTALL_PREFIX}/etc") + SET(PREFIX "${CMAKE_INSTALL_PREFIX}") + ELSE(CMAKE_INSTALL_PREFIX) + IF(NOT ETC_PREFIX) + SET(ETC_PREFIX /usr/local/etc) + ENDIF(NOT ETC_PREFIX) + IF(NOT MAN_PREFIX) + SET(MAN_PREFIX /usr/local/man) + ENDIF(NOT MAN_PREFIX) + IF(NOT PREFIX) + SET(PREFIX /usr/local) + ENDIF(NOT PREFIX) + ENDIF(CMAKE_INSTALL_PREFIX) FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl PATHS /lib /opt/lib /usr/lib @@ -76,16 +82,22 @@ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DDARWIN") - - IF(NOT ETC_PREFIX) - SET(ETC_PREFIX /usr/local/etc) - ENDIF(NOT ETC_PREFIX) - IF(NOT MAN_PREFIX) - SET(MAN_PREFIX /usr/local/man) - ENDIF(NOT MAN_PREFIX) - IF(NOT PREFIX) - SET(PREFIX /usr/local) - ENDIF(NOT PREFIX) + + IF(CMAKE_INSTALL_PREFIX) + SET(ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc") + SET(MAN_PREFIX "${CMAKE_INSTALL_PREFIX}/etc") + SET(PREFIX "${CMAKE_INSTALL_PREFIX}") + ELSE(CMAKE_INSTALL_PREFIX) + IF(NOT ETC_PREFIX) + SET(ETC_PREFIX /usr/local/etc) + ENDIF(NOT ETC_PREFIX) + IF(NOT MAN_PREFIX) + SET(MAN_PREFIX /usr/local/man) + ENDIF(NOT MAN_PREFIX) + IF(NOT PREFIX) + SET(PREFIX /usr/local) + ENDIF(NOT PREFIX) + ENDIF(CMAKE_INSTALL_PREFIX) FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl PATHS /lib /opt/lib @@ -99,15 +111,22 @@ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DLINUX") - IF(NOT ETC_PREFIX) - SET(ETC_PREFIX /etc) - ENDIF(NOT ETC_PREFIX) - IF(NOT PREFIX) - SET(PREFIX /usr) - ENDIF(NOT PREFIX) - IF(NOT MAN_PREFIX) - SET(MAN_PREFIX /usr/share/man) - ENDIF(NOT MAN_PREFIX) + IF(CMAKE_INSTALL_PREFIX) + SET(ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc") + SET(MAN_PREFIX "${CMAKE_INSTALL_PREFIX}/etc") + SET(PREFIX "${CMAKE_INSTALL_PREFIX}") + ELSE(CMAKE_INSTALL_PREFIX) + IF(NOT ETC_PREFIX) + SET(ETC_PREFIX /etc) + ENDIF(NOT ETC_PREFIX) + IF(NOT PREFIX) + SET(PREFIX /usr) + ENDIF(NOT PREFIX) + IF(NOT MAN_PREFIX) + SET(MAN_PREFIX /usr/share/man) + ENDIF(NOT MAN_PREFIX) + ENDIF(CMAKE_INSTALL_PREFIX) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt) LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl) MESSAGE(STATUS "Configuring for Linux") @@ -115,16 +134,22 @@ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DSOLARIS") - IF(NOT ETC_PREFIX) - SET(ETC_PREFIX /etc) - ENDIF(NOT ETC_PREFIX) - IF(NOT PREFIX) - SET(PREFIX /opt/rspamd) - ENDIF(NOT PREFIX) - IF(NOT MAN_PREFIX) - SET(MAN_PREFIX /usr/share/man) - ENDIF(NOT MAN_PREFIX) - + IF(CMAKE_INSTALL_PREFIX) + SET(ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc") + SET(MAN_PREFIX "${CMAKE_INSTALL_PREFIX}/etc") + SET(PREFIX "${CMAKE_INSTALL_PREFIX}") + ELSE(CMAKE_INSTALL_PREFIX) + IF(NOT ETC_PREFIX) + SET(ETC_PREFIX /etc) + ENDIF(NOT ETC_PREFIX) + IF(NOT PREFIX) + SET(PREFIX /opt/rspamd) + ENDIF(NOT PREFIX) + IF(NOT MAN_PREFIX) + SET(MAN_PREFIX /usr/share/man) + ENDIF(NOT MAN_PREFIX) + ENDIF(CMAKE_INSTALL_PREFIX) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt) LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl) LIST(APPEND CMAKE_REQUIRED_LIBRARIES resolv) @@ -626,15 +651,15 @@ ADD_CUSTOM_COMMAND(OUTPUT src/modules.c WORKING_DIRECTORY src) IF(PERL_EXECUTABLE) - ADD_CUSTOM_COMMAND(OUTPUT perl/Makefile - DEPENDS perl/Makefile.PL + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_SOURCE_DIR}/perl/Makefile + DEPENDS ${CMAKE_SOURCE_DIR}/perl/Makefile.PL COMMAND ${PERL_EXECUTABLE} ./Makefile.PL DESTDIR=${DESTDIR} PREFIX=${PREFIX} INSTALLMAN3DIR=${MAN_PREFIX}/man3 - WORKING_DIRECTORY perl) + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/perl) CONFIGURE_FILE(perl/Makefile.PL.in perl/Makefile.PL) ADD_CUSTOM_TARGET(perlmodule - COMMAND make - DEPENDS perl/Makefile - WORKING_DIRECTORY perl + COMMAND ${CMAKE_MAKE_PROGRAM} DESTDIR=${DESTDIR} + DEPENDS ${CMAKE_SOURCE_DIR}/perl/Makefile + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/perl VERBATIM) ENDIF(PERL_EXECUTABLE) @@ -746,12 +771,12 @@ 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) +INSTALL(FILES conf/2tld.inc RENAME 2tld.inc.orig DESTINATION etc/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/rspamd) ENDIF(NOT EXISTS ${ETC_PREFIX}/rspamd/2tld.inc) -INSTALL(FILES conf/rspamd.xml.sample DESTINATION ${ETC_PREFIX}/) +INSTALL(FILES conf/rspamd.xml.sample DESTINATION etc/) # Lua plugins IF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua) @@ -765,7 +790,7 @@ FOREACH(LUA_PLUGIN ${LUA_PLUGINS}) 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 ${ETC_PREFIX}/rspamd/plugins/lua/${_rp}) + INSTALL(FILES "src/plugins/lua/${LUA_PLUGIN}" DESTINATION etc/rspamd/plugins/lua/${_rp}) ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/${_rp}/${LUA_PLUGIN}) ENDFOREACH(LUA_PLUGIN) @@ -780,7 +805,7 @@ FOREACH(LUA_CONF ${LUA_CONFIGS}) 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 ${ETC_PREFIX}/rspamd/lua/${_rp}) + INSTALL(FILES "conf/lua/${LUA_CONF}" DESTINATION etc/rspamd/lua/${_rp}) ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp}/${LUA_CONF}) ENDFOREACH(LUA_CONF) @@ -804,7 +829,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT BUILD_PORT) INSTALL(CODE "EXECUTE_PROCESS(COMMAND chown ${RSPAMD_USER}:${RSPAMD_GROUP} ${DESTDIR}/var/run/rspamd/)") ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT BUILD_PORT) IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - INSTALL(PROGRAMS linux/rspamd DESTINATION ${ETC_PREFIX}/init.d) + INSTALL(PROGRAMS linux/rspamd DESTINATION etc/init.d) 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/)") ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") @@ -824,6 +849,10 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") INCLUDE("linux/cmake/UseRPMTools.cmake") ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") +IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + INCLUDE("freebsd/cmake/PkgCreate.cmake") +ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + SET(RPMNAME "rspamd") SET(PACKAGE_NAME "rspamd") SET(PACKAGE_RELEASE "1") @@ -840,7 +869,7 @@ ELSE(GMIME24) SET(PACKAGE_DEPENDS "libc6, libevent-1.4-2, libgmime-2.0-2, libxml-parser-perl, libterm-readkey-perl, libglib2.0-0") ENDIF(GMIME24) -SET(PACKAGE_VERSION "${RSPAMD_VERSION_MAJOR}.${RSPAMD_VERSION_MINOR}.${RSPAMD_VERSION_PATCH}") +SET(PACKAGE_VERSION "${RSPAMD_VERSION_MAJOR}.${RSPAMD_VERSION_MINOR}.${RSPAMD_VERSION_PATCH}_${ID}") IF(RPMTools_FOUND) @@ -896,4 +925,7 @@ ENDIF(RPMTools_FOUND) IF(DPKG_FOUND STREQUAL "YES") ADD_DEBIAN_PACKAGE("rspamd") -ENDIF(DPKG_FOUND STREQUAL "YES")
\ No newline at end of file +ENDIF(DPKG_FOUND STREQUAL "YES") +IF(PKGCREATE_FOUND STREQUAL "YES") + ADD_FREEBSD_PACKAGE("rspamd" "freebsd/rspamd.plist") +ENDIF(PKGCREATE_FOUND STREQUAL "YES")
\ No newline at end of file |