summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorSajid Ali <30510036+s-sajid-ali@users.noreply.github.com>2020-04-22 09:49:07 -0500
committerGitHub <noreply@github.com>2020-04-22 09:49:07 -0500
commit5f285fdd053b14b6a05ea1a48add80fa79b4cefb (patch)
tree27c3a4f2294747b89c56b7855969761f6400881d /var
parent2a5592f4196b61c043f61f26031de1c302f1affe (diff)
downloadspack-5f285fdd053b14b6a05ea1a48add80fa79b4cefb.tar.gz
spack-5f285fdd053b14b6a05ea1a48add80fa79b4cefb.tar.bz2
spack-5f285fdd053b14b6a05ea1a48add80fa79b4cefb.tar.xz
spack-5f285fdd053b14b6a05ea1a48add80fa79b4cefb.zip
fix code-signing on macOS (#15592)
* rebase * move if statement location * remove whitespace * spec to self.spec * switch statements as per review * fix erronous indent * add missing cmake arg * minor placement fix for cmake args * edit comment * fix erronous return * clarify conflicts with messages * remove duplicate comment * simplify logic * macos wasn't a variant, fix that * remove extra blank line * address reviewer comments on spaces
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/llvm/package.py67
1 files changed, 43 insertions, 24 deletions
diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
index f56a68403b..bf8a77933c 100644
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -119,6 +119,8 @@ class Llvm(CMakePackage, CudaPackage):
default=False,
description="Build with OpenMP capable thread sanitizer",
)
+ variant('code_signing', default=False,
+ description="Enable code-signing on macOS")
variant("python", default=False, description="Install python bindings")
extends("python", when="+python")
@@ -176,6 +178,20 @@ class Llvm(CMakePackage, CudaPackage):
# MLIR exists in > 10.x
conflicts("+mlir", when="@:9")
+ # code signing is only necessary on macOS",
+ conflicts('+code_signing', when='platform=linux')
+ conflicts('+code_signing', when='platform=bgq')
+ conflicts('+code_signing', when='platform=cray')
+
+ conflicts(
+ '+code_signing',
+ when='~lldb platform=darwin',
+ msg="code signing is only necessary for building the "
+ "in-tree debug server on macOS. Turning this variant "
+ "off enables a build of llvm with lldb that uses the "
+ "system debug server",
+ )
+
# Github issue #4986
patch("llvm_gcc7.patch", when="@4.0.0:4.0.1+lldb %gcc@7.0:")
# Backport from llvm master + additional fix
@@ -192,31 +208,31 @@ class Llvm(CMakePackage, CudaPackage):
# https://bugs.llvm.org/show_bug.cgi?id=39696
patch("thread-p9.patch", when="@develop+libcxx")
- @run_before("cmake")
- def check_darwin_lldb_codesign_requirement(self):
- if not self.spec.satisfies("+lldb platform=darwin"):
- return
- codesign = which("codesign")
- mkdir("tmp")
- llvm_check_file = join_path("tmp", "llvm_check")
- copy("/usr/bin/false", llvm_check_file)
-
- try:
- codesign("-f", "-s", "lldb_codesign", "--dryrun", llvm_check_file)
-
- except ProcessError:
- # Newer LLVM versions have a simple script that sets up
- # automatically
- setup = Executable("./lldb/scripts/macos-setup-codesign.sh")
+ @run_before('cmake')
+ def codesign_check(self):
+ if self.spec.satisfies("+code_signing"):
+ codesign = which('codesign')
+ mkdir('tmp')
+ llvm_check_file = join_path('tmp', 'llvm_check')
+ copy('/usr/bin/false', llvm_check_file)
try:
- setup()
- except Exception:
- raise RuntimeError(
- 'The "lldb_codesign" identity must be available to build '
- "LLVM with LLDB. See https://lldb.llvm.org/resources/"
- "build.html#code-signing-on-macos for details on how to "
- "create this identity."
- )
+ codesign('-f', '-s', 'lldb_codesign', '--dryrun',
+ llvm_check_file)
+
+ except ProcessError:
+ # Newer LLVM versions have a simple script that sets up
+ # automatically when run with sudo priviliges
+ setup = Executable("./lldb/scripts/macos-setup-codesign.sh")
+ try:
+ setup()
+ except Exception:
+ raise RuntimeError(
+ 'spack was unable to either find or set up'
+ 'code-signing on your system. Please refer to'
+ 'https://lldb.llvm.org/resources/build.html#'
+ 'code-signing-on-macos for details on how to'
+ 'create this identity.'
+ )
def setup_build_environment(self, env):
env.append_flags("CXXFLAGS", self.compiler.cxx11_flag)
@@ -355,6 +371,9 @@ class Llvm(CMakePackage, CudaPackage):
):
cmake_args.append("-DCMAKE_BUILD_WITH_INSTALL_RPATH=1")
+ if self.spec.satisfies("~code_signing platform=darwin"):
+ cmake_args.append('-DLLDB_USE_SYSTEM_DEBUGSERVER=ON')
+
# Semicolon seperated list of projects to enable
cmake_args.append(
"-DLLVM_ENABLE_PROJECTS:STRING={0}".format(";".join(projects))