mirror of
https://github.com/outbackdingo/nDPId.git
synced 2026-01-27 10:19:45 +00:00
Build system cleanup / cosmetics.
* libnDPI submodule update Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -4,3 +4,6 @@ __pycache__
|
||||
|
||||
# go related
|
||||
*.sum
|
||||
|
||||
# lockfiles generated by some shell scripts
|
||||
*.lock
|
||||
|
||||
@@ -14,5 +14,5 @@ script:
|
||||
- ./build/nDPId-test || test $? -eq 1
|
||||
- ./build/nDPId -h || test $? -eq 1
|
||||
# dameon start/stop test
|
||||
- ./daemon.sh ./build/nDPId ./build/nDPIsrvd
|
||||
- ./daemon.sh ./build/nDPId ./build/nDPIsrvd
|
||||
- ./scripts/daemon.sh ./build/nDPId ./build/nDPIsrvd
|
||||
- ./scripts/daemon.sh ./build/nDPId ./build/nDPIsrvd
|
||||
|
||||
@@ -3,21 +3,6 @@ project(nDPId C)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
function(initialize_submodule DIRECTORY)
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${DIRECTORY}/.git)
|
||||
find_package(Git QUIET REQUIRED)
|
||||
message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}/${DIRECTORY}/.git does not exist. "
|
||||
"Initializing ${DIRECTORY} submodule ...")
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init ${DIRECTORY}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
RESULT_VARIABLE GIT_EXIT_CODE)
|
||||
if(NOT GIT_EXIT_CODE EQUAL "0")
|
||||
message(FATAL_ERROR "${GIT_EXECUTABLE} submodule update --init ${DIRECTORY} "
|
||||
"failed with exit code ${GIT_EXIT_CODE}, please checkout submodules")
|
||||
endif()
|
||||
endif()
|
||||
endfunction(initialize_submodule)
|
||||
|
||||
option(ENABLE_SANITIZER "Enable ASAN/LSAN/UBSAN." OFF)
|
||||
option(ENABLE_SANITIZER_THREAD "Enable TSAN (does not work together with ASAN)." OFF)
|
||||
option(ENABLE_MEMORY_PROFILING "Enable dynamic memory tracking." OFF)
|
||||
@@ -73,17 +58,20 @@ if(ENABLE_SANITIZER_THREAD)
|
||||
endif()
|
||||
|
||||
if(STATIC_LIBNDPI_INSTALLDIR STREQUAL "" AND BUILD_NDPI)
|
||||
initialize_submodule(libnDPI)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(
|
||||
libnDPI
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libnDPI
|
||||
CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CFLAGS=${CMAKE_C_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/libnDPI/autogen.sh
|
||||
--prefix=${CMAKE_CURRENT_BINARY_DIR}/libnDPI
|
||||
--with-only-libndpi
|
||||
CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CFLAGS=${CMAKE_C_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS}
|
||||
MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} DEST_INSTALL=${CMAKE_BINARY_DIR}/libnDPI
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scripts/get-and-build-libndpi.sh
|
||||
BUILD_COMMAND make
|
||||
BUILD_IN_SOURCE 1)
|
||||
|
||||
add_custom_target(clean-libnDPI
|
||||
COMMAND rm -rf ${CMAKE_BINARY_DIR}/libnDPI ${CMAKE_BINARY_DIR}/libnDPI-prefix
|
||||
)
|
||||
|
||||
set(STATIC_LIBNDPI_INSTALLDIR "${CMAKE_BINARY_DIR}/libnDPI")
|
||||
add_dependencies(nDPId libnDPI)
|
||||
add_dependencies(nDPId-test libnDPI)
|
||||
|
||||
2
libnDPI
2
libnDPI
Submodule libnDPI updated: c4084ca3c7...2af7b33de0
@@ -905,6 +905,10 @@ int main(int argc, char ** argv)
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
signal(SIGQUIT, SIG_IGN);
|
||||
|
||||
epollfd = setup_event_queue();
|
||||
if (epollfd < 0)
|
||||
{
|
||||
|
||||
@@ -29,8 +29,6 @@ if [ -r "/tmp/nDPId-${NSUFFIX}.pid" -o -r "/tmp/nDPIsrvd-${NSUFFIX}.pid" ]; then
|
||||
printf '%s\n' "${2} not started .." >&2
|
||||
fi
|
||||
|
||||
sudo rm -f "/tmp/nDPId-${NSUFFIX}.pid"
|
||||
rm -f "/tmp/nDPIsrvd-${NSUFFIX}.pid"
|
||||
printf '%s\n' "daemons stopped" >&2
|
||||
else
|
||||
set -x
|
||||
@@ -40,5 +38,5 @@ else
|
||||
sudo ${1} -p "/tmp/nDPId-${NSUFFIX}.pid" -c "/tmp/nDPIsrvd-${NSUFFIX}-collector.sock" -d -u "${NUSER}"
|
||||
set +x
|
||||
printf '%s\n' "daemons started" >&2
|
||||
printf '%s\n' "You may now run examples e.g.: ./examples/py-flow-info/flow-info.py --unix /tmp/nDPIsrvd-${NSUFFIX}-distributor.sock"
|
||||
printf '%s\n' "You may now run examples e.g.: $(realpath --relative-to="$(pwd)" $(dirname "${0}")/../examples/py-flow-info/flow-info.py) --unix /tmp/nDPIsrvd-${NSUFFIX}-distributor.sock"
|
||||
fi
|
||||
23
scripts/get-and-build-libndpi.sh
Executable file
23
scripts/get-and-build-libndpi.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
LOCKFILE="$(realpath "${0}").lock"
|
||||
touch "${LOCKFILE}"
|
||||
exec 42< "${LOCKFILE}"
|
||||
flock -x -n 42 || {
|
||||
printf '%s\n' "Could not aquire file lock for ${0}. Already running instance?" >&2;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
cd "$(dirname "${0}")/.."
|
||||
git submodule update --init ./libnDPI
|
||||
|
||||
cd ./libnDPI
|
||||
DEST_INSTALL="${DEST_INSTALL:-$(realpath ./install)}"
|
||||
MAKE_PROGRAM="${MAKE_PROGRAM:-make -j4}"
|
||||
./autogen.sh --prefix="${DEST_INSTALL}" --with-only-libndpi
|
||||
${MAKE_PROGRAM} install
|
||||
|
||||
rm -f "${LOCKFILE}"
|
||||
Reference in New Issue
Block a user