選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

CMakeLists.txt 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. cmake_minimum_required(VERSION 2.4)
  2. project(postsrsd C)
  3. option(GENERATE_SRS_SECRET "Generate a random SRS secret if none exists during install" ON)
  4. option(USE_APPARMOR "Enable AppArmor profile" OFF)
  5. set(CHROOT_DIR "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}" CACHE PATH "Chroot jail for daemon")
  6. set(CONFIG_DIR "/etc/default" CACHE PATH "Location of configuration file")
  7. find_program(HELP2MAN help2man DOC "path to help2man executable")
  8. find_program(DD dd DOC "path to dd executable")
  9. find_program(BASE64 base64 DOC "path to base64 executable")
  10. find_program(INSSERV insserv DOC "path to insserv executable")
  11. find_program(CHKCONFIG chkconfig DOC "path to chkconfig executable")
  12. if(NOT DEFINED INIT_FLAVOR)
  13. if(IS_DIRECTORY "/etc/init" AND EXISTS "/lib/init/upstart-job")
  14. message(STATUS "Detected init flavor: upstart")
  15. set(INIT_FLAVOR "upstart" CACHE STRING "Init daemon of this system")
  16. elseif(IS_DIRECTORY "/etc/init.d" AND EXISTS "/lib/lsb/init-functions")
  17. message(STATUS "Detected init flavor: sysv-lsb")
  18. set(INIT_FLAVOR "sysv-lsb" CACHE STRING "Init daemon of this system")
  19. elseif(IS_DIRECTORY "/etc/init.d" AND EXISTS "/etc/init.d/functions")
  20. message(STATUS "Detected init flavor: sysv-redhat")
  21. set(INIT_FLAVOR "sysv-redhat" CACHE STRING "Init daemon of this system")
  22. else()
  23. message(STATUS "Detected init flavor: none")
  24. message(STATUS "System startup files will not be installed")
  25. set(INIT_FLAVOR "" CACHE STRING "Init daemon of this system")
  26. endif()
  27. endif()
  28. add_executable(${PROJECT_NAME} postsrsd.c sha1.c srs2.c)
  29. get_target_property(POSTSRSD ${PROJECT_NAME} LOCATION)
  30. get_filename_component(POSTSRSD ${POSTSRSD} NAME_WE)
  31. set(APPARMOR_PROFILE "${CMAKE_INSTALL_PREFIX}/sbin/${POSTSRSD}")
  32. string(REGEX REPLACE "^/+" "" APPARMOR_PROFILE "${APPARMOR_PROFILE}")
  33. string(REPLACE "/" "." APPARMOR_PROFILE "${APPARMOR_PROFILE}")
  34. configure_file(${PROJECT_NAME}.lsb_init.in ${PROJECT_NAME}.lsb_init @ONLY)
  35. configure_file(${PROJECT_NAME}.rh_init.in ${PROJECT_NAME}.rh_init @ONLY)
  36. configure_file(${PROJECT_NAME}.upstart.in ${PROJECT_NAME}.upstart @ONLY)
  37. configure_file(${PROJECT_NAME}.apparmor.in ${PROJECT_NAME}.apparmor @ONLY)
  38. configure_file(postinstall.cmake.in postinstall.cmake @ONLY)
  39. if(HELP2MAN)
  40. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  41. COMMAND ${HELP2MAN} ARGS -s8 -o${PROJECT_NAME}.8 -n "Postfix Sender Rewriting Scheme daemon" -N -h-h -v-v ${CMAKE_CURRENT_BINARY_DIR}/${POSTSRSD}
  42. VERBATIM
  43. )
  44. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.8 DESTINATION "share/man/man8")
  45. endif()
  46. if(USE_APPARMOR)
  47. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.apparmor DESTINATION "/etc/apparmor.d" RENAME "${APPARMOR_PROFILE}")
  48. endif()
  49. install(TARGETS ${PROJECT_NAME} DESTINATION "sbin")
  50. install(FILES README.md main.cf.ex DESTINATION "share/doc/${PROJECT_NAME}")
  51. install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/postinstall.cmake")