summary refs log tree commit diff
path: root/pkgs/tools/system/osquery
diff options
context:
space:
mode:
authorCharles Strahan <charles@cstrahan.com>2017-07-13 00:18:52 -0400
committerCharles Strahan <charles@cstrahan.com>2017-07-24 21:48:08 -0400
commit232c34b8f42a44ada8ded9d1022008e6537c4c27 (patch)
tree77d0c8abdce9817ba18fed0b8612fc11fa43cade /pkgs/tools/system/osquery
parent53426f6cb93f3fbaa2ad974659da271d08ea0594 (diff)
downloadnixlib-232c34b8f42a44ada8ded9d1022008e6537c4c27.tar
nixlib-232c34b8f42a44ada8ded9d1022008e6537c4c27.tar.gz
nixlib-232c34b8f42a44ada8ded9d1022008e6537c4c27.tar.bz2
nixlib-232c34b8f42a44ada8ded9d1022008e6537c4c27.tar.lz
nixlib-232c34b8f42a44ada8ded9d1022008e6537c4c27.tar.xz
nixlib-232c34b8f42a44ada8ded9d1022008e6537c4c27.tar.zst
nixlib-232c34b8f42a44ada8ded9d1022008e6537c4c27.zip
osquery: use packaged sqlite and gtest/gmock
Diffstat (limited to 'pkgs/tools/system/osquery')
-rw-r--r--pkgs/tools/system/osquery/default.nix5
-rw-r--r--pkgs/tools/system/osquery/misc.patch71
2 files changed, 70 insertions, 6 deletions
diff --git a/pkgs/tools/system/osquery/default.nix b/pkgs/tools/system/osquery/default.nix
index 72d43354ff73..7924054b7203 100644
--- a/pkgs/tools/system/osquery/default.nix
+++ b/pkgs/tools/system/osquery/default.nix
@@ -4,6 +4,7 @@
 , beecrypt, augeas, libxml2, sleuthkit, yara, lldpd, google-gflags
 , thrift, boost, rocksdb_lite, cpp-netlib, glog, gbenchmark, snappy
 , openssl, linenoise-ng, file, doxygen, devicemapper
+, gtest, sqlite
 }:
 
 let
@@ -49,6 +50,7 @@ stdenv.mkDerivation rec {
     yara lldpd google-gflags thrift boost
     cpp-netlib glog gbenchmark snappy openssl linenoise-ng
     file doxygen devicemapper cryptsetup
+    gtest sqlite
 
     # need to be consistent about the malloc implementation
     (rocksdb_lite.override { jemalloc = null; gperftools = null; })
@@ -59,11 +61,12 @@ stdenv.mkDerivation rec {
 
     cmakeFlagsArray+=(
       -DCMAKE_LIBRARY_PATH=${cryptsetup}/lib
-      -DCMAKE_VERBOSE_MAKEFILE=ON
+      -DCMAKE_VERBOSE_MAKEFILE=OFF
     )
 
     cp -r ${thirdparty}/* third-party
     chmod +w -R third-party
+    rm -r third-party/{googletest,sqlite3}
   '';
 
   meta = with lib; {
diff --git a/pkgs/tools/system/osquery/misc.patch b/pkgs/tools/system/osquery/misc.patch
index bcd393e5e239..1a0ef267f0df 100644
--- a/pkgs/tools/system/osquery/misc.patch
+++ b/pkgs/tools/system/osquery/misc.patch
@@ -1,5 +1,5 @@
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index a976a46d..73a95575 100644
+index a976a46d..408ac308 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -125,14 +125,13 @@ else()
@@ -26,7 +26,20 @@ index a976a46d..73a95575 100644
        -fvisibility=hidden
        -fvisibility-inlines-hidden
      )
-@@ -439,6 +437,8 @@ endif()
+@@ -372,12 +370,6 @@ elseif(NOT FREEBSD)
+   endif()
+ endif()
+ 
+-if(NOT IS_DIRECTORY "${CMAKE_SOURCE_DIR}/third-party/sqlite3")
+-  WARNING_LOG("Cannot find git submodule third-party/sqlite3 directory")
+-  WARNING_LOG("Please run: make deps or git submodule update --init")
+-  message(FATAL_ERROR "No sqlite3 directory")
+-endif()
+-
+ # Make sure deps were built before compiling (else show warning).
+ execute_process(
+   COMMAND "${CMAKE_SOURCE_DIR}/tools/provision.sh" check "${CMAKE_BINARY_DIR}"
+@@ -439,6 +431,8 @@ endif()
  
  if(APPLE)
    LOG_PLATFORM("OS X")
@@ -35,6 +48,36 @@ index a976a46d..73a95575 100644
  elseif(OSQUERY_BUILD_PLATFORM STREQUAL "debian")
    LOG_PLATFORM("Debian")
  elseif(OSQUERY_BUILD_PLATFORM STREQUAL "ubuntu")
+@@ -477,7 +471,6 @@ if(POSIX)
+   include_directories("${BUILD_DEPS}/include/openssl")
+ endif()
+ 
+-include_directories("${CMAKE_SOURCE_DIR}/third-party/sqlite3")
+ include_directories("${CMAKE_SOURCE_DIR}/include")
+ include_directories("${CMAKE_SOURCE_DIR}")
+ 
+@@ -559,21 +552,10 @@ else()
+   set(GTEST_FLAGS "-DGTEST_USE_OWN_TR1_TUPLE=0")
+ endif()
+ 
+-set(GTEST_FLAGS
+-  ${GTEST_FLAGS}
+-  "-I${CMAKE_SOURCE_DIR}/third-party/googletest/googletest/include"
+-  "-I${CMAKE_SOURCE_DIR}/third-party/googletest/googlemock/include"
+-)
+-join("${GTEST_FLAGS}" " " GTEST_FLAGS)
+-
+ set(BUILD_GTEST TRUE)
+ 
+-add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/googletest")
+-
+ include(Thrift)
+ 
+-add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/sqlite3")
+-
+ add_subdirectory(osquery)
+ add_subdirectory(tools/tests)
+ 
 diff --git a/include/osquery/core.h b/include/osquery/core.h
 index b597edee..b0628037 100644
 --- a/include/osquery/core.h
@@ -73,10 +116,28 @@ index b597edee..b0628037 100644
  
  /**
 diff --git a/osquery/CMakeLists.txt b/osquery/CMakeLists.txt
-index 77913d31..c833c289 100644
+index 77913d31..671b20d4 100644
 --- a/osquery/CMakeLists.txt
 +++ b/osquery/CMakeLists.txt
-@@ -157,6 +157,7 @@ ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-client-connections${WO_KEY}")
+@@ -57,7 +57,7 @@ endif()
+ 
+ # Construct a set of all object files, starting with third-party and all
+ # of the osquery core objects (sources from ADD_CORE_LIBRARY macros).
+-set(OSQUERY_OBJECTS $<TARGET_OBJECTS:osquery_sqlite>)
++set(OSQUERY_OBJECTS "")
+ 
+ # Add subdirectories
+ add_subdirectory(config)
+@@ -138,6 +138,8 @@ elseif(FREEBSD)
+   ADD_OSQUERY_LINK_ADDITIONAL("rocksdb-lite")
+ endif()
+ 
++ADD_OSQUERY_LINK_CORE("sqlite3")
++
+ if(POSIX)
+   ADD_OSQUERY_LINK_CORE("boost_system")
+   ADD_OSQUERY_LINK_CORE("boost_filesystem")
+@@ -157,6 +159,7 @@ ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-client-connections${WO_KEY}")
  ADD_OSQUERY_LINK_CORE("glog${WO_KEY}")
  
  if(POSIX)
@@ -84,7 +145,7 @@ index 77913d31..c833c289 100644
    ADD_OSQUERY_LINK_ADDITIONAL("snappy")
    ADD_OSQUERY_LINK_ADDITIONAL("ssl")
    ADD_OSQUERY_LINK_ADDITIONAL("crypto")
-@@ -336,13 +337,6 @@ if(NOT OSQUERY_BUILD_SDK_ONLY)
+@@ -336,13 +339,6 @@ if(NOT OSQUERY_BUILD_SDK_ONLY)
  
    install(DIRECTORY "${CMAKE_SOURCE_DIR}/packs/"
      DESTINATION "${CMAKE_INSTALL_PREFIX}/share/osquery/packs" COMPONENT main)