llvm.org GIT mirror llvm / 3688cb5
Support codesigning bundles and forcing Summary: Clangd's framework is assembled by copying binaries from the lib and bin directories into a bundle shape. This results in an invalid bundle code signature because the signature only applies to the binaries not the resources. This patch adds two new options to `llvm_codesign` to enable re-signing the library and XPC service as bundles. The `BUNDLE_PATH` option allow specifying an explicit path to codesign, which enables signing bundles which aren't generated using CMake's `FRAMEWORK` or `BUNDLE` target properties. The `FORCE` option allows re-signing binaries that have already been signed. This is required for how clangd exposes the clangd library and tools as both XPC and non-XPC services using the same binary. Reviewers: jkorous, bogner Reviewed By: bogner Subscribers: mgorny, ilya-biryukov, dexonsmith, arphaman, kadircet, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D62693 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362169 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Bieneman a month ago
1 changed file(s) with 11 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
16581658 endif()
16591659 endfunction()
16601660
1661 # Usage: llvm_codesign(name [ENTITLEMENTS file])
1661 # Usage: llvm_codesign(name [FORCE] [ENTITLEMENTS file] [BUNDLE_PATH path])
16621662 function(llvm_codesign name)
1663 cmake_parse_arguments(ARG "" "ENTITLEMENTS" "" ${ARGN})
1663 cmake_parse_arguments(ARG "FORCE" "ENTITLEMENTS;BUNDLE_PATH" "" ${ARGN})
16641664
16651665 if(NOT LLVM_CODESIGNING_IDENTITY)
16661666 return()
16901690 set(pass_entitlements --entitlements ${ARG_ENTITLEMENTS})
16911691 endif()
16921692
1693 if (NOT ARG_BUNDLE_PATH)
1694 set(ARG_BUNDLE_PATH $)
1695 endif()
1696
1697 if(ARG_FORCE)
1698 set(force_flag "-f")
1699 endif()
1700
16931701 add_custom_command(
16941702 TARGET ${name} POST_BUILD
16951703 COMMAND ${CMAKE_COMMAND} -E
16961704 env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE}
16971705 ${CMAKE_CODESIGN} -s ${LLVM_CODESIGNING_IDENTITY}
1698 ${pass_entitlements} $
1706 ${pass_entitlements} ${force_flag} ${ARG_BUNDLE_PATH}
16991707 )
17001708 endif()
17011709 endfunction()