|
|
@ -1,9 +1,8 @@ |
|
|
|
cmake_minimum_required(VERSION 3.4) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set(CNAME "f2b") |
|
|
|
set(CNAME "f2b") |
|
|
|
set(VERSION "0.6.1") |
|
|
|
set(VERSION "0.6") |
|
|
|
|
|
|
|
|
|
|
|
project(${CNAME} C) |
|
|
|
project(${CNAME} C) |
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.6) |
|
|
|
|
|
|
|
|
|
|
|
include(CTest) |
|
|
|
include(CTest) |
|
|
|
|
|
|
|
|
|
|
@ -17,11 +16,14 @@ option(WITH_PCRE "Build pcre-compatible filter" ON) |
|
|
|
option(WITH_REDIS "Build redis source/backend" OFF) |
|
|
|
option(WITH_REDIS "Build redis source/backend" OFF) |
|
|
|
option(WITH_IPSET "Build native ipset 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) |
|
|
|
if (NOT DEFINED CMAKE_INSTALL_PREFIX) |
|
|
|
set(CMAKE_INSTALL_PREFIX "/usr") |
|
|
|
set(CMAKE_INSTALL_PREFIX "/usr") |
|
|
|
endif () |
|
|
|
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) |
|
|
|
include(GNUInstallDirs) |
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99") |
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99") |
|
|
@ -78,12 +80,6 @@ install(DIRECTORY "configs/" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/${CNAM |
|
|
|
install(FILES "configs/f2b.conf" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/${CNAME}" |
|
|
|
install(FILES "configs/f2b.conf" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/${CNAME}" |
|
|
|
RENAME "f2b.conf.sample") |
|
|
|
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 |
|
|
|
add_custom_target("dist" COMMAND |
|
|
|
"git" "archive" "--format=tar.gz" |
|
|
|
"git" "archive" "--format=tar.gz" |
|
|
|
"--output=${CNAME}_v${VERSION}.tar.gz" |
|
|
|
"--output=${CNAME}_v${VERSION}.tar.gz" |
|
|
|