1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class AppleLibunwind(Package):
"""Placeholder package for Apple's analogue to non-GNU libunwind"""
homepage = "https://opensource.apple.com/source/libunwind/libunwind-35.3/"
provides('unwind')
# The 'conflicts' directive only accepts valid spack specs;
# platforms cannot be negated -- 'platform!=darwin' is not a valid
# spec -- so expressing a conflict for any platform that isn't
# Darwin must be expressed by listing a conflict with every
# platform that isn't Darwin/macOS
conflicts('platform=linux')
conflicts('platform=bgq')
conflicts('platform=cray')
# Override the fetcher method to throw a useful error message;
# avoids GitHub issue (#7061) in which the opengl placeholder
# package threw a generic, uninformative error during the `fetch`
# step,
@property
def fetcher(self):
msg = """This package is intended to be a placeholder for Apple's
system-provided, non-GNU-compatible libunwind library.
Add to your packages.yaml:
packages:
apple-libunwind:
paths:
apple-libunwind@35.3: /usr
buildable: False
"""
raise InstallError(msg)
def install(self, spec, prefix):
# sanity_check_prefix requires something in the install directory
mkdirp(prefix.lib)
@property
def libs(self):
"""Export the Apple libunwind library. The Apple libunwind library
cannot be linked to directly using an absolute path; doing so
will cause the linker to throw an error 'cannot link directly
with /usr/lib/system/libunwind.dylib' and the linker will
suggest linking with System.framework instead. Linking to this
framework is equivalent to linking with libSystem.dylib, which
can be confirmed on a macOS system by executing at a terminal
the command `ls -l
/System/Library/Frameworks/System.Framework` -- the file
"System" is a symlink to `/usr/lib/libSystem.B.dylib`, and
`/usr/lib/libSystem.dylib` also symlinks to this file.
Running `otool -L /usr/lib/libSystem.dylib` confirms that
it will link dynamically to `/usr/lib/system/libunwind.dylib`.
"""
libs = find_libraries('libSystem',
self.prefix.lib,
shared=True, recursive=False)
if libs:
return libs
return None
@property
def headers(self):
""" Export the Apple libunwind header
"""
hdrs = HeaderList(find(self.prefix.include, 'libunwind.h',
recursive=False))
return hdrs or None
|