From b7f323b3fb7affad8f26511530ec0bb295f81c18 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 3 Jan 2016 17:47:31 +0100 Subject: [PATCH] Fixed: Sign OS X binaries needed by client and copy them in Ryzom bundle --- code/CMakeLists.txt | 22 ++++++++++++++++++ .../tools/misc/crash_report/CMakeLists.txt | 8 +++++++ code/ryzom/client/src/CMakeLists.txt | 23 ++----------------- .../client/client_config_qt/CMakeLists.txt | 8 +++++++ .../client/client_patcher/CMakeLists.txt | 8 +++++++ 5 files changed, 48 insertions(+), 21 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 0fb80a76a..ae2b7257f 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -140,6 +140,28 @@ IF(WITH_SSE2) ENDIF(WITH_SSE3) ENDIF(WITH_SSE2) +IF(APPLE_CERTIFICATE) + # Find codesign_allocate + + # Xcode 7.0 and later versions + SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate) + + IF(NOT EXISTS "${CODESIGN_ALLOCATE}") + # Xcode 6.4 and previous versions + SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate) + ENDIF() + + IF(NOT EXISTS "${CODESIGN_ALLOCATE}") + # System path + SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate) + ENDIF() + + IF(NOT EXISTS "${CODESIGN_ALLOCATE}") + MESSAGE(WARNING "Unable to find codesign_allocate in standard directories") + SET(CODESIGN_ALLOCATE) + ENDIF() +ENDIF() + MACRO(ADD_QT_LIBRARY _NAME) IF(WIN32) SET(_PREFIX "Qt5") diff --git a/code/nel/tools/misc/crash_report/CMakeLists.txt b/code/nel/tools/misc/crash_report/CMakeLists.txt index 1169aab8d..221f7cabe 100644 --- a/code/nel/tools/misc/crash_report/CMakeLists.txt +++ b/code/nel/tools/misc/crash_report/CMakeLists.txt @@ -48,3 +48,11 @@ NL_DEFAULT_PROPS(crash_report "NeL, Tools, Misc: Crash Report") NL_ADD_RUNTIME_FLAGS(crash_report) INSTALL(TARGETS crash_report RUNTIME DESTINATION ${NL_BIN_PREFIX}) + +IF(WITH_RYZOM_CLIENT AND APPLE) + IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE) + ADD_CUSTOM_COMMAND(TARGET crash_report POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crash_report" COMMENT "Signing crash_report executable...") + ENDIF() + + ADD_CUSTOM_COMMAND(TARGET crash_report POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crash_report ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app/Contents/MacOS/CrashReport) +ENDIF() diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 588073d7d..ad55fd3d7 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -78,27 +78,8 @@ IF(WITH_RYZOM_CLIENT) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -RpX ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR}) ENDIF() - IF(APPLE_CERTIFICATE) - # Find codesign_allocate - - # Xcode 7.0 and later versions - SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate) - - IF(NOT EXISTS "${CODESIGN_ALLOCATE}") - # Xcode 6.4 and previous versions - SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate) - ENDIF() - - IF(NOT EXISTS "${CODESIGN_ALLOCATE}") - # System path - SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate) - ENDIF() - - IF(NOT EXISTS "${CODESIGN_ALLOCATE}") - MESSAGE(WARNING "Unable to find codesign_allocate in standard directories") - ELSE() - ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${RYZOM_OUTPUT_DIR}" COMMENT "Signing bundle...") - ENDIF() + IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE) + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${RYZOM_OUTPUT_DIR}" COMMENT "Signing bundle...") ENDIF() ENDIF() diff --git a/code/ryzom/tools/client/client_config_qt/CMakeLists.txt b/code/ryzom/tools/client/client_config_qt/CMakeLists.txt index f0bb295b3..f27589afa 100644 --- a/code/ryzom/tools/client/client_config_qt/CMakeLists.txt +++ b/code/ryzom/tools/client/client_config_qt/CMakeLists.txt @@ -69,3 +69,11 @@ IF(WITH_PCH) ENDIF() INSTALL(TARGETS ryzom_configuration_qt RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client) + +IF(WITH_RYZOM_CLIENT AND APPLE) + IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE) + ADD_CUSTOM_COMMAND(TARGET ryzom_configuration_qt POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_configuration_qt" COMMENT "Signing ryzom_configuration_qt executable...") + ENDIF() + + ADD_CUSTOM_COMMAND(TARGET ryzom_configuration_qt POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_configuration_qt ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app/Contents/MacOS/RyzomConfiguration) +ENDIF() diff --git a/code/ryzom/tools/client/client_patcher/CMakeLists.txt b/code/ryzom/tools/client/client_patcher/CMakeLists.txt index ce7d4d67a..f71f21a35 100644 --- a/code/ryzom/tools/client/client_patcher/CMakeLists.txt +++ b/code/ryzom/tools/client/client_patcher/CMakeLists.txt @@ -43,3 +43,11 @@ IF(WITH_PCH) ENDIF(WITH_PCH) INSTALL(TARGETS ryzom_client_patcher RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications) + +IF(WITH_RYZOM_CLIENT AND APPLE) + IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE) + ADD_CUSTOM_COMMAND(TARGET ryzom_client_patcher POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_client_patcher" COMMENT "Signing ryzom_client_patcher executable...") + ENDIF() + + ADD_CUSTOM_COMMAND(TARGET ryzom_client_patcher POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_client_patcher ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app/Contents/MacOS/RyzomClientPatcher) +ENDIF()