Browse Source

* CMakeLists.txt : optional install of system init scripts

master
Alex 'AdUser' Z 7 months ago
parent
commit
5f1fa6ef7f
  1. 8
      CMakeLists.txt
  2. 1
      docs/install.md

8
CMakeLists.txt

@ -17,6 +17,8 @@ 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 ()
@ -76,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"

1
docs/install.md

@ -25,6 +25,7 @@ Other noticeable options are:
* `CMAKE_BUILD_TYPE` (Debug, Release or unset) -- sets compiler optimization level and debugging info. Set to "Release" for production code.
* `CMAKE_C_COMPILER` -- allows specify another compiler
* `CMAKE_INSTALL_PREFIX` -- set root of install dir ($DESTDIR also will be prefixed if set).
* `INIT_SCRIPT` -- install system init script (values: off/openrc/systemd, default: off)
After building you may type `sudo make install` to install compiled binaries and other files.
Default install layout is:

Loading…
Cancel
Save