From 6f1bb45f4777fae7a146a7ab747de79ac3dbb398 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 20 Oct 2016 13:53:23 +0200 Subject: [PATCH] Changed: Allow to enable Sandbox under OS X --- code/CMakeModules/nel.cmake | 1 + code/ryzom/client/macosx/ryzom.entitlements | 10 ++++++++++ code/ryzom/client/src/CMakeLists.txt | 14 ++++++++++---- 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 code/ryzom/client/macosx/ryzom.entitlements diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 5c2d99d30..e06164570 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -333,6 +333,7 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) OPTION(WITH_RYZOM_CLIENT_UAC "Ask to run as Administrator" OFF) OPTION(WITH_RYZOM_PATCH "Enable Ryzom in-game patch support" OFF) OPTION(WITH_RYZOM_CUSTOM_PATCH_SERVER "Only use patch server from CFG file" OFF) + OPTION(WITH_RYZOM_SANDBOX "Enable Sandbox under OS X" OFF) ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) diff --git a/code/ryzom/client/macosx/ryzom.entitlements b/code/ryzom/client/macosx/ryzom.entitlements new file mode 100644 index 000000000..ee95ab7e5 --- /dev/null +++ b/code/ryzom/client/macosx/ryzom.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 6793314f6..e515e5989 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -87,6 +87,12 @@ IF(WITH_RYZOM_CLIENT) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -RpX ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR}) ENDIF() + IF(WITH_RYZOM_SANDBOX) + SET(ENTITLEMENTS --entitlements ${MAC_RESOURCES_DIR}/ryzom.entitlements) + ELSE() + SET(ENTITLEMENTS) + ENDIF() + IF(TARGET crash_report) ADD_DEPENDENCIES(ryzom_client crash_report) @@ -94,7 +100,7 @@ IF(WITH_RYZOM_CLIENT) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crash_report ${RYZOM_CONTENTS_DIR}/MacOS/CrashReport) IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE) - ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/CrashReport" COMMENT "Signing CrashReport executable...") + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign ${ENTITLEMENTS} -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/CrashReport" COMMENT "Signing CrashReport executable...") ENDIF() ENDIF() @@ -105,7 +111,7 @@ IF(WITH_RYZOM_CLIENT) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_client_patcher ${RYZOM_CONTENTS_DIR}/MacOS/RyzomClientPatcher) IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE) - ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/RyzomClientPatcher" COMMENT "Signing RyzomClientPatcher executable...") + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign ${ENTITLEMENTS} -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/RyzomClientPatcher" COMMENT "Signing RyzomClientPatcher executable...") ENDIF() ENDIF() @@ -116,12 +122,12 @@ IF(WITH_RYZOM_CLIENT) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_configuration_qt ${RYZOM_CONTENTS_DIR}/MacOS/RyzomConfiguration) IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE) - ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/RyzomConfiguration" COMMENT "Signing RyzomConfiguration executable...") + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign ${ENTITLEMENTS} -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/RyzomConfiguration" COMMENT "Signing RyzomConfiguration executable...") ENDIF() 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 Ryzom bundle...") + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign ${ENTITLEMENTS} -fs "${APPLE_CERTIFICATE}" "${RYZOM_OUTPUT_DIR}" COMMENT "Signing Ryzom bundle...") ENDIF() ENDIF()