|
|
|
@ -1,8 +1,9 @@
|
|
|
|
|
cmake_minimum_required(VERSION 3.4) |
|
|
|
|
|
|
|
|
|
set(CNAME "f2b") |
|
|
|
|
set(VERSION "0.6") |
|
|
|
|
set(VERSION "0.6.1") |
|
|
|
|
|
|
|
|
|
project(${CNAME} C) |
|
|
|
|
cmake_minimum_required(VERSION 2.6) |
|
|
|
|
|
|
|
|
|
include(CTest) |
|
|
|
|
|
|
|
|
@ -16,14 +17,11 @@ option(WITH_PCRE "Build pcre-compatible filter" ON)
|
|
|
|
|
option(WITH_REDIS "Build redis source/backend" OFF) |
|
|
|
|
option(WITH_IPSET "Build native ipset backend" OFF) |
|
|
|
|
|
|
|
|
|
set(INIT_SCRIPT "OFF") # valid variants: "off", "sysvinit", "openrc", "systemd" |
|
|
|
|
|
|
|
|
|
if (NOT DEFINED CMAKE_INSTALL_PREFIX) |
|
|
|
|
set(CMAKE_INSTALL_PREFIX "/usr") |
|
|
|
|
endif () |
|
|
|
|
# HACK: cmake >= 3.4 fixes this |
|
|
|
|
if (CMAKE_INSTALL_PREFIX MATCHES "^/usr/?$") |
|
|
|
|
set(CMAKE_INSTALL_SYSCONFDIR "/etc") |
|
|
|
|
set(CMAKE_INSTALL_LOCALSTATEDIR "/var") |
|
|
|
|
endif () |
|
|
|
|
include(GNUInstallDirs) |
|
|
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99") |
|
|
|
@ -80,6 +78,12 @@ install(DIRECTORY "configs/" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/${CNAM
|
|
|
|
|
install(FILES "configs/f2b.conf" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/${CNAME}" |
|
|
|
|
RENAME "f2b.conf.sample") |
|
|
|
|
|
|
|
|
|
if (INIT_SCRIPT STREQUAL "openrc") |
|
|
|
|
install(FILES "contrib/init.openrc" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/init.d" RENAME "f2b") |
|
|
|
|
elseif (INIT_SCRIPT STREQUAL "systemd") |
|
|
|
|
install(FILES "contrib/f2b.service" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/systemd/system") |
|
|
|
|
endif () |
|
|
|
|
|
|
|
|
|
add_custom_target("dist" COMMAND |
|
|
|
|
"git" "archive" "--format=tar.gz" |
|
|
|
|
"--output=${CNAME}_v${VERSION}.tar.gz" |
|
|
|
|