mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-06 17:45:22 +00:00
Easier build host-based sync
This commit is contained in:
parent
3131a97d95
commit
70e3c190bb
@ -6,20 +6,6 @@ endif()
|
||||
set(GLOG_ROOT_DIR "${CMAKE_BINARY_DIR}/third-party/glog")
|
||||
set(GLOG_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third-party/glog")
|
||||
|
||||
if(NOT APPLE)
|
||||
include(CheckIncludeFiles)
|
||||
unset(LIBUNWIND_FOUND CACHE)
|
||||
check_include_files("libunwind.h;unwind.h" LIBUNWIND_FOUND)
|
||||
if(LIBUNWIND_FOUND)
|
||||
unset(libglog_FOUND CACHE)
|
||||
execute_process(
|
||||
COMMAND rm -rf "${GLOG_ROOT_DIR}" "${CMAKE_BINARY_DIR}/libglog-prefix"
|
||||
ERROR_QUIET
|
||||
)
|
||||
message(WARNING "${Esc}[31mWarning: libunwind headers found [Issue #596], please: make deps\n${Esc}[m")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(GLOG_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register -Wno-unnamed-type-template-args -Wno-deprecated -Wno-error")
|
||||
|
||||
INCLUDE(ExternalProject)
|
||||
@ -31,8 +17,8 @@ ExternalProject_Add(
|
||||
CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
|
||||
CXXFLAGS=${GLOG_CXX_FLAGS}
|
||||
--enable-frame-pointers --enable-shared=no --prefix=${GLOG_ROOT_DIR}
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND make install
|
||||
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
|
||||
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
|
||||
LOG_CONFIGURE ON
|
||||
LOG_INSTALL ON
|
||||
LOG_BUILD ON
|
||||
|
@ -36,10 +36,12 @@ if(APPLE)
|
||||
"-x objective-c++ -fobjc-arc -Wno-c++11-extensions -mmacosx-version-min=${APPLE_MIN_ABI}")
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
set(FREEBSD TRUE)
|
||||
set(LINUX FALSE)
|
||||
set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -std=c++11 -stdlib=libc++")
|
||||
set(OS_WHOLELINK_PRE "")
|
||||
set(OS_WHOLELINK_POST "")
|
||||
else()
|
||||
set(FREEBSD FALSE)
|
||||
set(LINUX TRUE)
|
||||
# Do not use the shared linker flags for modules.
|
||||
set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -std=c++11")
|
||||
@ -164,7 +166,8 @@ elseif(OSQUERY_BUILD_PLATFORM STREQUAL "centos")
|
||||
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "rhel")
|
||||
set(RHEL TRUE)
|
||||
message("-- Building for RHEL")
|
||||
elseif(FREEBSD)
|
||||
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "freebsd")
|
||||
set(FREEBSD TRUE)
|
||||
message("-- Building for FreeBSD")
|
||||
endif()
|
||||
|
||||
@ -244,4 +247,5 @@ add_custom_target(
|
||||
"${CMAKE_SOURCE_DIR}/tools/sync.sh" "${CMAKE_BINARY_DIR}"
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
COMMENT "Generating sdk sync: ${CMAKE_BINARY_DIR}/sync"
|
||||
DEPENDS osquery_extensions osquery_amalgamation
|
||||
)
|
||||
|
21
Makefile
21
Makefile
@ -1,8 +1,11 @@
|
||||
PLATFORM := $(shell uname -s)
|
||||
VERSION := $(shell git describe --tags HEAD --always)
|
||||
MAKE = make
|
||||
SHELL := $(shell which bash)
|
||||
|
||||
SHELL := /bin/bash
|
||||
MAKE = make
|
||||
ifeq ($(PLATFORM),FreeBSD)
|
||||
MAKE = gmake
|
||||
endif
|
||||
|
||||
DISTRO := $(shell . ./tools/lib.sh; _platform)
|
||||
DISTRO_VERSION := $(shell . ./tools/lib.sh; _distro $(DISTRO))
|
||||
@ -16,11 +19,11 @@ DEFINES := CTEST_OUTPUT_ON_FAILURE=1
|
||||
.PHONY: docs build
|
||||
|
||||
all: .setup
|
||||
cd build/$(BUILD_DIR) && cmake ../.. && \
|
||||
cd build/$(BUILD_DIR) && cmake ../../ && \
|
||||
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
|
||||
|
||||
docs: .setup
|
||||
cd build && cmake .. && \
|
||||
cd build && cmake ../ && \
|
||||
$(DEFINES) $(MAKE) docs --no-print-directory $(MAKEFLAGS)
|
||||
|
||||
debug: .setup
|
||||
@ -74,6 +77,10 @@ test_debug_build:
|
||||
deps: .setup
|
||||
./tools/provision.sh build build/$(BUILD_DIR)
|
||||
|
||||
clean: .setup
|
||||
cd build/$(BUILD_DIR) && cmake ../../ && \
|
||||
$(DEFINES) $(MAKE) clean --no-print-directory $(MAKEFLAGS)
|
||||
|
||||
distclean:
|
||||
rm -rf .sources build/$(BUILD_DIR) build/debug_$(BUILD_DIR) build/docs
|
||||
ifeq ($(PLATFORM),Linux)
|
||||
@ -101,6 +108,10 @@ packages: .setup
|
||||
cd build/$(BUILD_DIR) && PACKAGE=True cmake ../../ && \
|
||||
$(DEFINES) $(MAKE) packages --no-print-directory $(MAKEFLAGS)
|
||||
|
||||
sync: .setup
|
||||
cd build/$(BUILD_DIR) && PACKAGE=True cmake ../../ && \
|
||||
$(DEFINES) $(MAKE) sync --no-print-directory $(MAKEFLAGS)
|
||||
|
||||
%::
|
||||
cd build/$(BUILD_DIR) && cmake ../.. && \
|
||||
cd build/$(BUILD_DIR) && cmake ../../ && \
|
||||
$(DEFINES) $(MAKE) --no-print-directory $@
|
||||
|
@ -19,7 +19,11 @@
|
||||
|
||||
#include <osquery/core.h>
|
||||
|
||||
#ifdef FREEBSD
|
||||
#define GFLAGS_NAMESPACE gflags
|
||||
#elif !defined(GFLAGS_NAMESPACE)
|
||||
#define GFLAGS_NAMESPACE google
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
/// We define a lexical_cast template for boolean for Gflags boolean string
|
||||
|
@ -22,11 +22,14 @@ set(OSQUERY_LIBS
|
||||
|
||||
readline
|
||||
pthread
|
||||
dl
|
||||
bz2
|
||||
z
|
||||
)
|
||||
|
||||
if(NOT FREEBSD)
|
||||
set(OSQUERY_LIBS ${OSQUERY_LIBS} dl)
|
||||
endif()
|
||||
|
||||
# Add default linking details (the first argument means SDK + core).
|
||||
ADD_OSQUERY_LINK(TRUE "-rdynamic")
|
||||
|
||||
|
@ -4,6 +4,7 @@ if(APPLE)
|
||||
)
|
||||
|
||||
ADD_OSQUERY_LINK(TRUE "-framework Foundation")
|
||||
elseif(FREEBSD)
|
||||
elseif(LINUX)
|
||||
ADD_OSQUERY_LIBRARY(TRUE osquery_filesystem_linux
|
||||
linux/mem.cpp
|
||||
|
@ -59,10 +59,12 @@ else()
|
||||
ADD_OSQUERY_LINK(FALSE "uuid")
|
||||
endif()
|
||||
|
||||
file(GLOB OSQUERY_CROSS_TABLES "[!u]*/*.cpp")
|
||||
ADD_OSQUERY_LIBRARY(FALSE osquery_tables
|
||||
${OSQUERY_CROSS_TABLES}
|
||||
)
|
||||
if(NOT FREEBSD)
|
||||
file(GLOB OSQUERY_CROSS_TABLES "[!u]*/*.cpp")
|
||||
ADD_OSQUERY_LIBRARY(FALSE osquery_tables
|
||||
${OSQUERY_CROSS_TABLES}
|
||||
)
|
||||
endif()
|
||||
|
||||
file(GLOB OSQUERY_CROSS_TABLES_TESTS "[!u]*/tests/*.cpp")
|
||||
ADD_OSQUERY_TABLE_TEST(${OSQUERY_CROSS_TABLES_TESTS})
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4638db8e130945e4d350bab3f133d6c139c62799
|
||||
Subproject commit 0e3be38505985a82bf741e67b1e29a48c497fb0a
|
@ -13,5 +13,7 @@ function main_freebsd() {
|
||||
package python
|
||||
package py27-pip
|
||||
package rocksdb
|
||||
package thrift
|
||||
package thrift-cpp
|
||||
package yara
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ function package() {
|
||||
brew install --build-bottle $1 || brew upgrade $@
|
||||
fi
|
||||
elif [[ $OS = "freebsd" ]]; then
|
||||
if [[ -z "$(pkg info -q $1)" ]]; then
|
||||
if pkg info -q $1; then
|
||||
log "$1 is already installed. skipping."
|
||||
else
|
||||
log "installing $1"
|
||||
@ -285,7 +285,7 @@ function remove_package() {
|
||||
log "Removing: $1 is not installed. skipping."
|
||||
fi
|
||||
elif [[ $OS = "freebsd" ]]; then
|
||||
if [[ -n "$(pkg info -q $1)" ]]; then
|
||||
if ! pkg info -q $1; then
|
||||
log "removing $1"
|
||||
sudo pkg delete -y $1
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user