--- src/CMakeLists.txt.orig 2019-02-13 22:20:23 UTC +++ src/CMakeLists.txt @@ -33,6 +33,13 @@ set (FASTNETMON_VERSION_MINOR 1) set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "/lib/systemd/system" CACHE PATH "Location for systemd service files") +# Respect PREFIX variable in FreeBSD +if($ENV{PREFIX}) + set(PREFIX $ENV{PREFIX}) +else() + set(PREFIX "/usr/local") +endif() + if (ENABLE_GOBGP_SUPPORT) # We could not compile gRPC without C++ 11 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") @@ -65,12 +72,12 @@ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};/opt/l message(STATUS "C++ compilation flags: ${CMAKE_CXX_FLAGS_RELEASE}") -set(HIREDIS_CUSTOM_INSTALL_PATH "/opt/libhiredis_0_13") -set(LOG4CPP_CUSTOM_INSTALL_PATH "/opt/log4cpp1.1.1") -set(JSONC_CUSTOM_INSTALL_PATH "/opt/json-c-0.12") -set(PFRING_CUSTOM_INSTALL_PATH "/opt/pf_ring_6.0.3") -set(LIBPCAP_CUSTOM_INSTALL_PATH "/opt/libpcap_1.7.4") -set(MONGO_C_CUSTOM_INSTALL_PATH "/opt/mongo_c_driver_1_1_9") +set(HIREDIS_CUSTOM_INSTALL_PATH ${PREFIX}) +set(LOG4CPP_CUSTOM_INSTALL_PATH ${PREFIX}) +set(JSONC_CUSTOM_INSTALL_PATH ${PREFIX}) +set(PFRING_CUSTOM_INSTALL_PATH ${PREFIX}) +set(LIBPCAP_CUSTOM_INSTALL_PATH ${PREFIX}) +set(MONGO_C_CUSTOM_INSTALL_PATH ${PREFIX}) set(FASTNETMON_PROFILER OFF) @@ -227,21 +234,22 @@ add_library(sflow_plugin STATIC sflow_plugin/sflow_col add_library(netflow_plugin STATIC netflow_plugin/netflow_collector.cpp) target_link_libraries(netflow_plugin ipfix_rfc) -option(ENABLE_DPI_SUPPORT "Enable Deep Packet Inspection support" ON) +option(ENABLE_DPI_SUPPORT "Enable Deep Packet Inspection support" OFF) if (ENABLE_DPI_SUPPORT) message(STATUS "We will enable nDPI support") add_library(fast_dpi STATIC fast_dpi.cpp) - set(NDPI_INCLUDE_DIRS "/opt/ndpi/include/libndpi-1.7.1") + set(NDPI_INCLUDE_DIRS ${PREFIX}) - find_library(NDPI_LIBRARIES NAMES ndpi PATHS "/opt/ndpi/lib" NO_DEFAULT_PATH) + file(GLOB NDPI_SEARCH_PATHS "${NDPI_CUSTOM_INSTALL_PATH}/include/libndpi-*") + find_library(NDPI_LIBRARIES NAMES ndpi PATHS "${NDPI_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH) if (NOT NDPI_LIBRARIES) message(FATAL_ERROR "Could not find nDPI library") endif() - link_directories("/opt/ndpi/lib") + link_directories(${NDPI_LIBRARIES}) include_directories(${NDPI_INCLUDE_DIRS}) add_definitions(-DENABLE_DPI) @@ -258,7 +266,7 @@ if (ENABLE_LUA_SUPPORT) add_definitions(-DENABLE_LUA_HOOKS) - set(LUAJIT_CUSTOM_INSTALL_PATH "/opt/luajit_2.0.4") + set(LUAJIT_CUSTOM_INSTALL_PATH ${PREFIX}) link_directories("${LUAJIT_CUSTOM_INSTALL_PATH}/lib") include_directories("${LUAJIT_CUSTOM_INSTALL_PATH}/include") @@ -656,12 +664,12 @@ install(FILES networks_list DESTINATION "${CMAKE_INSTA install(FILES networks_whitelist DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}") # man pages -install(FILES man/fastnetmon.1 DESTINATION /usr/share/man/man1) -install(FILES man/fastnetmon_client.1 DESTINATION /usr/share/man/man1) +#install(FILES man/fastnetmon.1 DESTINATION /usr/share/man/man1) +#install(FILES man/fastnetmon_client.1 DESTINATION /usr/share/man/man1) # service files -configure_file(fastnetmon.service.in "${CMAKE_CURRENT_BINARY_DIR}/fastnetmon.service" @ONLY) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/fastnetmon.service" DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR}) +#configure_file(fastnetmon.service.in "${CMAKE_CURRENT_BINARY_DIR}/fastnetmon.service" @ONLY) +#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/fastnetmon.service" DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR}) if (${OS_ID} MATCHES debian|ubuntu) install(FILES fastnetmon_init_script_debian_6_7 DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/init.d RENAME fastnetmon)