aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/osquery/Makefile
blob: 3078f3b34e2b485e106d599262518c139eeb3e8d (plain) (blame)
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
# Created by: Ryan Steinmetz <zi@FreeBSD.org>
# $FreeBSD$

PORTNAME=   osquery
PORTVERSION=    1.4.7
PORTREVISION=   6
CATEGORIES= sysutils

MAINTAINER= zi@FreeBSD.org
COMMENT=    SQL powered OS instrumentation, monitoring, and analytics

LICENSE=    BSD3CLAUSE
LICENSE_FILE=   ${WRKSRC}/LICENSE

BUILD_DEPENDS=  snappy>0:archivers/snappy \
        rocksdb>0:databases/rocksdb \
        thrift>0:devel/thrift \
        thrift-cpp>0:devel/thrift-cpp \
        bash>0:shells/bash \
        yara>0:security/yara \
        doxygen:devel/doxygen \
        ${PYTHON_PKGNAMEPREFIX}MarkupSafe>0:textproc/py-MarkupSafe \
        ${PYTHON_PKGNAMEPREFIX}psutil>0:sysutils/py-psutil \
        ${PYTHON_PKGNAMEPREFIX}pexpect>0:misc/py-pexpect \
        ${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2  \
        ${PYTHON_PKGNAMEPREFIX}thrift>0:devel/py-thrift \
        ${PYTHON_PKGNAMEPREFIX}pip>0:devel/py-pip
LIB_DEPENDS=    libboost_regex.so:devel/boost-libs \
        libgflags.so:devel/gflags \
        libicuuc.so:devel/icu

BROKEN=     does not build (error: no matching constructor for initialization of 'gflags::FlagRegisterer')

USES=       cmake:outsource gmake libtool python:build compiler:c++11-lib
CONFIGURE_ENV+= OSQUERY_BUILD_VERSION="${PORTVERSION}" HOME="${WRKDIR}" \
        SKIP_TESTS="yes" CC="${CC}" CXX="${CXX}"
CMAKE_ARGS+=    -DFREEBSD=awesome -DCMAKE_SYSTEM_NAME="FreeBSD"
BLDDIR=     ${WRKDIR}/.build/${PORTNAME}
USE_RC_SUBR=    ${PORTNAME}d
USE_GITHUB= yes
GH_ACCOUNT= facebook ${PORTNAME}:tp
GH_PROJECT= third-party:tp
GH_SUBDIR=  third-party:tp
MAKE_JOBS_UNSAFE=   yes

post-patch:
    ${REINPLACE_CMD} -e 's|/var/osquery|/var/db/osquery|g' \
        ${WRKSRC}/osquery/core/init.cpp
    ${REINPLACE_CMD} -e 's|/var/osquery/osquery.em|/var/run/osquery.em|g' \
        -e 's|/etc/osquery/extensions.load|${PREFIX}/etc/osquery.extensions|g' \
        -e 's|/etc/osquery/modules.load|${PREFIX}/etc/osquery.modules|g' \
        ${WRKSRC}/osquery/extensions/extensions.cpp
    ${REINPLACE_CMD} -e 's|/var/osquery/osquery.conf|${PREFIX}/etc/osquery.conf|g' \
        ${WRKSRC}/osquery/config/plugins/filesystem.cpp
    ${REINPLACE_CMD} -e 's|/var/osquery/|/var/db/osquery/|g' \
        ${WRKSRC}/tools/deployment/osquery.example.conf
    ${REINPLACE_CMD} -e 's|python |${PYTHON_CMD} |g' \
        ${WRKSRC}/CMake/CMakeLibs.cmake \
        ${WRKSRC}/CMakeLists.txt

do-install:
    ${INSTALL_PROGRAM} ${BLDDIR}/osqueryi ${STAGEDIR}${PREFIX}/bin
    ${INSTALL_PROGRAM} ${BLDDIR}/osqueryd ${STAGEDIR}${PREFIX}/sbin
    ${INSTALL_DATA} ${BLDDIR}/libosquery.a ${STAGEDIR}${PREFIX}/lib
    (cd ${WRKSRC}/include && ${COPYTREE_SHARE} ${PORTNAME} ${STAGEDIR}${PREFIX}/include)
    ${INSTALL_DATA} ${WRKSRC}/tools/deployment/osquery.example.conf \
        ${STAGEDIR}${PREFIX}/etc/osquery.conf.sample

    ${MKDIR} ${STAGEDIR}/var/db/osquery

.include <bsd.port.mk>