[PATCH] D65566: [lldb][CMake] Workaround debugserver code-signing issue in generated Xcode project

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 04:01:52 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL368151: [lldb][CMake] Workaround debugserver code-signing issue in generated Xcode… (authored by stefan.graenitz, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65566?vs=212762&id=213838#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65566/new/

https://reviews.llvm.org/D65566

Files:
  lldb/trunk/tools/debugserver/source/CMakeLists.txt


Index: lldb/trunk/tools/debugserver/source/CMakeLists.txt
===================================================================
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt
@@ -208,6 +208,34 @@
   ENTITLEMENTS ${entitlements}
 )
 
+# Workaround for Xcode-specific code-signing behavior:
+# The XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY option causes debugserver to be copied
+# into the framework first and code-signed afterwards. Sign the copy manually.
+if (debugserver_codesign_identity AND LLDB_BUILD_FRAMEWORK AND
+    CMAKE_GENERATOR STREQUAL "Xcode")
+  if(NOT CMAKE_CODESIGN_ALLOCATE)
+    execute_process(
+      COMMAND xcrun -f codesign_allocate
+      OUTPUT_STRIP_TRAILING_WHITESPACE
+      OUTPUT_VARIABLE CMAKE_CODESIGN_ALLOCATE
+    )
+  endif()
+  if(entitlements)
+    set(pass_entitlements --entitlements ${entitlements})
+  endif()
+
+  get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
+  set(copy_location ${framework_build_dir}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources/debugserver)
+
+  add_custom_command(TARGET debugserver POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E
+            env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE}
+            xcrun codesign -f -s ${debugserver_codesign_identity}
+            ${pass_entitlements} ${copy_location}
+    COMMENT "Code-sign debugserver copy in the build-tree framework: ${copy_location}"
+  )
+endif()
+
 set_target_properties(debugserver PROPERTIES FOLDER "lldb libraries/debugserver")
 
 if(IOS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65566.213838.patch
Type: text/x-patch
Size: 1569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190807/20fb01ac/attachment.bin>


More information about the llvm-commits mailing list