You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. cmake_minimum_required(VERSION 2.8)
  2. project(postsrsd C)
  3. option(GENERATE_SRS_SECRET "Generate a random SRS secret if none exists during install" ON)
  4. find_program(HELP2MAN help2man DOC "path to help2man executable")
  5. find_program(DD dd DOC "path to dd executable")
  6. find_program(BASE64 base64 DOC "path to base64 executable")
  7. find_program(INSSERV insserv DOC "path to insserv executable")
  8. if(NOT DEFINED INIT_FLAVOR)
  9. if(IS_DIRECTORY "/etc/init" AND EXISTS "/lib/init/upstart-job")
  10. message(STATUS "Detected init flavor: upstart")
  11. set(INIT_FLAVOR "upstart" CACHE STRING "Init daemon of this system")
  12. elseif(IS_DIRECTORY "/etc/init.d")
  13. message(STATUS "Detected init flavor: sysv")
  14. set(INIT_FLAVOR "sysv" CACHE STRING "Init daemon of this system")
  15. else()
  16. message(STATUS "Detected init flavor: none")
  17. message(STATUS "System startup files will not be installed")
  18. set(INIT_FLAVOR "" CACHE STRING "Init daemon of this system")
  19. endif()
  20. endif()
  21. add_executable(${PROJECT_NAME} postsrsd.c sha1.c srs2.c)
  22. get_target_property(POSTSRSD ${PROJECT_NAME} LOCATION)
  23. get_filename_component(POSTSRSD ${POSTSRSD} NAME_WE)
  24. configure_file(${PROJECT_NAME}.init.in ${PROJECT_NAME}.init @ONLY)
  25. configure_file(${PROJECT_NAME}.upstart.in ${PROJECT_NAME}.upstart @ONLY)
  26. configure_file(postinstall.cmake.in postinstall.cmake @ONLY)
  27. if(HELP2MAN)
  28. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  29. COMMAND ${HELP2MAN} ARGS -s8 -o${PROJECT_NAME}.8 -N -h-h -v-v ${CMAKE_CURRENT_BINARY_DIR}/${POSTSRSD}
  30. VERBATIM
  31. )
  32. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.8 DESTINATION "share/man/man8")
  33. endif()
  34. install(TARGETS ${PROJECT_NAME} DESTINATION "sbin")
  35. install(FILES README.md main.cf.ex DESTINATION "share/doc/${PROJECT_NAME}")
  36. install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/postinstall.cmake")