aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-07 15:37:24 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-07 15:37:24 +0100
commitdbd4da541353736bcc9cbee062decd7a33169893 (patch)
tree37bf520b38f7a7af7303315b6353fde2882c1305
parent6973dc14dfb11e54d198da676e6214f60bfb9cb7 (diff)
downloadrspamd-dbd4da541353736bcc9cbee062decd7a33169893.tar.gz
rspamd-dbd4da541353736bcc9cbee062decd7a33169893.zip
Allow explicit turning off of options.
Now there is a way to specify cmake to skip linking with undesired libraries. Fix rpm spec to include libevent and optional Judy.
-rw-r--r--CMakeLists.txt146
-rw-r--r--centos/rspamd.spec18
2 files changed, 94 insertions, 70 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5687f5eb..e08944e14 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,10 @@ OPTION(ENABLE_PROFILING "Enable profiling [default: OFF]"
OPTION(ENABLE_GPERF_TOOLS "Enable google perftools [default: OFF]" OFF)
OPTION(ENABLE_STATIC "Enable static compiling [default: OFF]" OFF)
OPTION(ENABLE_LUAJIT "Link with libluajit [default: OFF]" OFF)
+OPTION(ENABLE_JUDY "Find and link with Judy library [default: ON]" ON)
+OPTION(ENABLE_DB "Find and link with DB library [default: OFF]" OFF)
+OPTION(ENABLE_SQLITE "Find and link with sqlite3 library [default: OFF]" OFF)
+OPTION(ENABLE_HIREDIS "Find and link with external redis library [default: OFF]" OFF)
OPTION(NO_SHARED "Build internal libs static [default: OFF]" OFF)
OPTION(FORCE_GMIME24 "Link with gmime2.4 [default: OFF]" OFF)
@@ -413,17 +417,19 @@ IF(PCRE_LIBRARY_DIRS)
LINK_DIRECTORIES("${PCRE_LIBRARY_DIRS}")
ENDIF(PCRE_LIBRARY_DIRS)
-# Find optional sqlite3 support
-pkg_check_modules(SQLITE sqlite3>=3.6.0)
-IF(SQLITE_FOUND)
- SET(WITH_SQLITE 1)
-ENDIF(SQLITE_FOUND)
-IF(SQLITE_INCLUDE_DIRS)
- INCLUDE_DIRECTORIES("${SQLITE_INCLUDE_DIRS}")
-ENDIF(SQLITE_INCLUDE_DIRS)
-IF(SQLITE_LIBRARY_DIRS)
- LINK_DIRECTORIES("${SQLITE_LIBRARY_DIRS}")
-ENDIF(SQLITE_LIBRARY_DIRS)
+IF(ENABLE_SQLITE MATCHES "ON")
+ # Find optional sqlite3 support
+ pkg_check_modules(SQLITE sqlite3>=3.6.0)
+ IF(SQLITE_FOUND)
+ SET(WITH_SQLITE 1)
+ ENDIF(SQLITE_FOUND)
+ IF(SQLITE_INCLUDE_DIRS)
+ INCLUDE_DIRECTORIES("${SQLITE_INCLUDE_DIRS}")
+ ENDIF(SQLITE_INCLUDE_DIRS)
+ IF(SQLITE_LIBRARY_DIRS)
+ LINK_DIRECTORIES("${SQLITE_LIBRARY_DIRS}")
+ ENDIF(SQLITE_LIBRARY_DIRS)
+ENDIF(ENABLE_SQLITE MATCHES "ON")
#Check for openssl (required for dkim)
IF(OPENSSL_FOUND)
@@ -455,17 +461,19 @@ IF(GLIB2_VERSION VERSION_GREATER "2.30.0")
ENDIF(GLIB2_VERSION VERSION_GREATER "2.30.0")
pkg_check_modules(GMIME2 gmime-2.0)
-# Try to find hiredis library
-pkg_check_modules(HIREDIS libhiredis)
-IF(HIREDIS_INCLUDE_DIRS)
- INCLUDE_DIRECTORIES("${HIREDIS_INCLUDE_DIRS}")
-ENDIF(HIREDIS_INCLUDE_DIRS)
-IF(HIREDIS_LIBRARY_DIRS)
- LINK_DIRECTORIES("${HIREDIS_LIBRARY_DIRS}")
-ENDIF(HIREDIS_LIBRARY_DIRS)
-IF(HIREDIS_FOUND)
- SET(WITH_SYSTEM_HIREDIS 1)
-ENDIF(HIREDIS_FOUND)
+IF(ENABLE_HIREDIS MATCHES "ON")
+ # Try to find hiredis library
+ pkg_check_modules(HIREDIS REQUIRED libhiredis)
+ IF(HIREDIS_INCLUDE_DIRS)
+ INCLUDE_DIRECTORIES("${HIREDIS_INCLUDE_DIRS}")
+ ENDIF(HIREDIS_INCLUDE_DIRS)
+ IF(HIREDIS_LIBRARY_DIRS)
+ LINK_DIRECTORIES("${HIREDIS_LIBRARY_DIRS}")
+ ENDIF(HIREDIS_LIBRARY_DIRS)
+ IF(HIREDIS_FOUND)
+ SET(WITH_SYSTEM_HIREDIS 1)
+ ENDIF(HIREDIS_FOUND)
+ENDIF(ENABLE_HIREDIS MATCHES "ON")
# Try to link with gmime24
IF(NOT GMIME2_FOUND OR FORCE_GMIME24)
@@ -578,53 +586,57 @@ GET_FILENAME_COMPONENT(LIBEVENT_PATH "${LIBEVENT_LIBRARY}" PATH)
INCLUDE_DIRECTORIES("${LIBEVENT_INCLUDE}")
LINK_DIRECTORIES("${LIBEVENT_PATH}")
-# Find libjudy
-FIND_LIBRARY(LIBJUDY_LIBRARY NAMES Judy PATH_SUFFIXES lib64 lib
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /sw
- /opt/local
- /opt/csw
- /opt
- DOC "Path where the libjudy library can be found")
-IF(LIBJUDY_LIBRARY)
- FIND_PATH(LIBJUDY_INCLUDE Judy.h PATHS /opt/include
- /usr/include
- /usr/local/include
- DOC "Path where the judy header files can be found")
-
- GET_FILENAME_COMPONENT(LIBJUDY_PATH "${LIBJUDY_LIBRARY}" PATH)
- INCLUDE_DIRECTORIES("${LIBJUDY_INCLUDE}")
- LINK_DIRECTORIES("${LIBJUDY_PATH}")
- SET(WITH_JUDY 1)
-ENDIF(LIBJUDY_LIBRARY)
+IF(ENABLE_JUDY MATCHES "ON")
+ # Find libjudy
+ FIND_LIBRARY(LIBJUDY_LIBRARY NAMES Judy PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /usr
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ DOC "Path where the libjudy library can be found")
+ IF(LIBJUDY_LIBRARY)
+ FIND_PATH(LIBJUDY_INCLUDE Judy.h PATHS /opt/include
+ /usr/include
+ /usr/local/include
+ DOC "Path where the judy header files can be found")
+
+ GET_FILENAME_COMPONENT(LIBJUDY_PATH "${LIBJUDY_LIBRARY}" PATH)
+ INCLUDE_DIRECTORIES("${LIBJUDY_INCLUDE}")
+ LINK_DIRECTORIES("${LIBJUDY_PATH}")
+ SET(WITH_JUDY 1)
+ ENDIF(LIBJUDY_LIBRARY)
+ENDIF(ENABLE_JUDY MATCHES "ON")
# Find libbd
-FIND_LIBRARY(LIBDB_LIBRARY NAMES db PATHS PATH_SUFFIXES lib64 lib
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /sw
- /opt/local
- /opt/csw
- /opt
- DOC "Path where the libdb library can be found")
-IF(LIBDB_LIBRARY)
- FIND_PATH(LIBDB_INCLUDE db.h PATHS /opt/include
- /usr/include
- /usr/local/include
- DOC "Path where the bdb header files can be found")
-
- GET_FILENAME_COMPONENT(LIBDB_PATH "${LIBDB_LIBRARY}" PATH)
- INCLUDE_DIRECTORIES("${LIBDB_INCLUDE}")
- LINK_DIRECTORIES("${LIBDB_PATH}")
- SET(WITH_DB 1)
-ENDIF(LIBDB_LIBRARY)
+IF(ENABLE_DB MATCHES "ON")
+ FIND_LIBRARY(LIBDB_LIBRARY NAMES db PATHS PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /usr
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ DOC "Path where the libdb library can be found")
+ IF(LIBDB_LIBRARY)
+ FIND_PATH(LIBDB_INCLUDE db.h PATHS /opt/include
+ /usr/include
+ /usr/local/include
+ DOC "Path where the bdb header files can be found")
+
+ GET_FILENAME_COMPONENT(LIBDB_PATH "${LIBDB_LIBRARY}" PATH)
+ INCLUDE_DIRECTORIES("${LIBDB_INCLUDE}")
+ LINK_DIRECTORIES("${LIBDB_PATH}")
+ SET(WITH_DB 1)
+ ENDIF(LIBDB_LIBRARY)
+ENDIF(ENABLE_DB MATCHES "ON")
IF(ENABLE_PROFILING MATCHES "ON")
SET(WITH_PROFILER 1)
diff --git a/centos/rspamd.spec b/centos/rspamd.spec
index b0e4e881d..bbe66f1a0 100644
--- a/centos/rspamd.spec
+++ b/centos/rspamd.spec
@@ -4,6 +4,8 @@
%define rspamd_logdir %{_localstatedir}/log/rspamd
%define rspamd_confdir %{_sysconfdir}/rspamd
+%define USE_JUDY 0
+
Name: rspamd
Version: 0.5.5
Release: 1
@@ -15,8 +17,13 @@ Group: System Environment/Daemons
License: BSD
URL: https://bitbucket.org/vstakhov/rspamd/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
-BuildRequires: cmake,glib2-devel,gmime-devel,openssl-devel,lua-devel,Judy-devel
-Requires: glib2,gmime,lua,Judy
+%if USE_JUDY
+BuildRequires: cmake,glib2-devel,gmime-devel,libevent-devel,openssl-devel,lua-devel,Judy-devel
+Requires: glib2,gmime,lua,Judy,libevent
+%else
+BuildRequires: cmake,glib2-devel,gmime-devel,libevent-devel,openssl-devel,lua-devel
+Requires: glib2,gmime,lua,libevent
+%endif
# for /user/sbin/useradd
Requires(pre): shadow-utils
Requires(post): chkconfig
@@ -49,7 +56,12 @@ rm -rf %{buildroot}
-DNO_SHARED=ON \
-DDEBIAN_BUILD=1 \
-DRSPAMD_GROUP=%{rspamd_group} \
- -DRSPAMD_USER=%{rspamd_user}
+ -DRSPAMD_USER=%{rspamd_user} \
+%if USE_JUDY
+ -DENABLE_JUDY=ON
+%else
+ -DENABLE_JUDY=OFF
+%endif
%{__make} %{?jobs:-j%jobs}