Package: bro / 2.5.5-1

0001-Use-sqlite3-provided-by-system.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
From: Hilko Bengen <bengen@debian.org>
Date: Fri, 21 Nov 2014 18:44:33 +0100
Subject: Use sqlite3 provided by system

---
 CMakeLists.txt                      |  3 ++
 cmake/FindSqlite3.cmake             | 74 +++++++++++++++++++++++++++++++++++++
 src/CMakeLists.txt                  |  2 -
 src/input/readers/sqlite/SQLite.h   |  2 +-
 src/logging/writers/sqlite/SQLite.h |  2 +-
 src/main.cc                         |  2 +-
 6 files changed, 80 insertions(+), 5 deletions(-)
 create mode 100644 cmake/FindSqlite3.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a7fba4..33b2d94 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,6 +68,7 @@ FindRequiredPackage(PCAP)
 FindRequiredPackage(OpenSSL)
 FindRequiredPackage(BIND)
 FindRequiredPackage(ZLIB)
+FindRequiredPackage(Sqlite3)
 
 if (NOT BinPAC_ROOT_DIR AND
     EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/aux/binpac/CMakeLists.txt)
@@ -144,7 +145,9 @@ set(brodeps
     ${OPENSSL_LIBRARIES}
     ${BIND_LIBRARY}
     ${ZLIB_LIBRARY}
+    ${SQLITE3_LIBRARY}
     ${JEMALLOC_LIBRARIES}
+    ${SQLITE3_LIBRARIES}
     ${OPTLIBS}
 )
 
diff --git a/cmake/FindSqlite3.cmake b/cmake/FindSqlite3.cmake
new file mode 100644
index 0000000..bc5dfa8
--- /dev/null
+++ b/cmake/FindSqlite3.cmake
@@ -0,0 +1,74 @@
+# We define:
+# - SQLITE3_INCLUDE_DIR - Where to find Sqlite 3 header files (directory)
+# - SQLITE3_LIBRARIES - Sqlite 3 libraries
+# - SQLITE3_LIBRARY_RELEASE - Where the release library is
+# - SQLITE3_LIBRARY_DEBUG - Where the debug library is
+# - SQLITE3_FOUND - Set to TRUE if we found everything 
+#   (library, includes and executable)
+# Taking into account:
+# - SQLITE3_PREFIX
+
+# Copyright (c) 2010 Pau Garcia i Quiles, <pgquiles@elpauer.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+# Generated by CModuler, a CMake Module Generator - http://gitorious.org/cmoduler
+
+IF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
+    SET(SQLITE3_FIND_QUIETLY TRUE)
+ENDIF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
+
+FIND_PATH(SQLITE3_INCLUDE_DIR
+    sqlite3.h
+  PATHS
+    ${SQLITE3_PREFIX}/include
+    /usr/include
+    /usr/local/include
+)
+
+FIND_LIBRARY(SQLITE3_LIBRARY_RELEASE
+  NAMES
+    sqlite3
+  PATHS
+    ${SQLITE3_PREFIX}/lib
+)
+
+FIND_LIBRARY(SQLITE3_LIBRARY_DEBUG
+  NAMES
+    sqlite3 
+  HINTS
+    ${SQLITE3_PREFIX}/lib/debug/usr/lib )
+
+IF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
+	SET( SQLITE3_FOUND TRUE )
+ENDIF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
+
+IF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
+	# if the generator supports configuration types then set
+	# optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+	IF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+		SET( SQLITE3_LIBRARIES optimized ${SQLITE3_LIBRARY_RELEASE} debug ${SQLITE3_LIBRARY_DEBUG} )
+	ELSE( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+    # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+    # then just use the release libraries
+		SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
+	ENDIF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ELSEIF( SQLITE3_LIBRARY_RELEASE )
+	SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
+ELSE( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
+	SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_DEBUG} )
+ENDIF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
+
+IF( SQLITE3_FOUND )
+	IF( NOT SQLITE3_FIND_QUIETLY )
+		MESSAGE( STATUS "Found Sqlite3 header file in ${SQLITE3_INCLUDE_DIR}")
+		MESSAGE( STATUS "Found Sqlite3 libraries: ${SQLITE3_LIBRARIES}")
+	ENDIF( NOT SQLITE3_FIND_QUIETLY )
+ELSE(SQLITE3_FOUND)
+	IF( SQLITE3_FIND_REQUIRED)
+		MESSAGE( FATAL_ERROR "Could not find Sqlite3" )
+	ELSE( SQLITE3_FIND_REQUIRED)
+		MESSAGE( STATUS "Optional package Sqlite3 was not found" )
+	ENDIF( SQLITE3_FIND_REQUIRED)
+ENDIF(SQLITE3_FOUND)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a564f16..80853e6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -357,8 +357,6 @@ set(bro_SRCS
     threading/formatters/Ascii.cc
     threading/formatters/JSON.cc
 
-    3rdparty/sqlite3.c
-
     plugin/Component.cc
     plugin/ComponentManager.h
     plugin/TaggedComponent.h
diff --git a/src/input/readers/sqlite/SQLite.h b/src/input/readers/sqlite/SQLite.h
index 5add678..655f6ff 100644
--- a/src/input/readers/sqlite/SQLite.h
+++ b/src/input/readers/sqlite/SQLite.h
@@ -10,7 +10,7 @@
 
 #include "input/ReaderBackend.h"
 #include "threading/formatters/Ascii.h"
-#include "3rdparty/sqlite3.h"
+#include "sqlite3.h"
 
 namespace input { namespace reader {
 
diff --git a/src/logging/writers/sqlite/SQLite.h b/src/logging/writers/sqlite/SQLite.h
index 1db5361..f9066f8 100644
--- a/src/logging/writers/sqlite/SQLite.h
+++ b/src/logging/writers/sqlite/SQLite.h
@@ -9,7 +9,7 @@
 
 #include "logging/WriterBackend.h"
 #include "threading/formatters/Ascii.h"
-#include "3rdparty/sqlite3.h"
+#include "sqlite3.h"
 
 namespace logging { namespace writer {
 
diff --git a/src/main.cc b/src/main.cc
index d9f8ff5..0aa8899 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -61,7 +61,7 @@ extern "C" void OPENSSL_add_all_algorithms_conf(void);
 
 #include "binpac_bro.h"
 
-#include "3rdparty/sqlite3.h"
+#include "sqlite3.h"
 
 #ifdef ENABLE_BROKER
 #include "broker/Manager.h"