summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2020-12-30 10:13:34 -0600
committerGitHub <noreply@github.com>2020-12-30 10:13:34 -0600
commit5964cb49d9dede06a0bf2e5ea3c86669c3ffe9b2 (patch)
tree3a6a237bf3082d07874b202fb74e81d330b5b2d6
parenteca1dd8738df73a9f621e5b32dedb2bccf316bbe (diff)
downloadspack-5964cb49d9dede06a0bf2e5ea3c86669c3ffe9b2.tar.gz
spack-5964cb49d9dede06a0bf2e5ea3c86669c3ffe9b2.tar.bz2
spack-5964cb49d9dede06a0bf2e5ea3c86669c3ffe9b2.tar.xz
spack-5964cb49d9dede06a0bf2e5ea3c86669c3ffe9b2.zip
Use system libuuid on macOS (#20608)
-rw-r--r--etc/spack/defaults/darwin/packages.yaml9
-rw-r--r--var/spack/repos/builtin/packages/apple-libuuid/package.py45
-rw-r--r--var/spack/repos/builtin/packages/python/package.py9
3 files changed, 55 insertions, 8 deletions
diff --git a/etc/spack/defaults/darwin/packages.yaml b/etc/spack/defaults/darwin/packages.yaml
index 948e90ea5a..ccfe8682d8 100644
--- a/etc/spack/defaults/darwin/packages.yaml
+++ b/etc/spack/defaults/darwin/packages.yaml
@@ -25,6 +25,8 @@ packages:
- libelf
unwind:
- apple-libunwind
+ uuid:
+ - apple-libuuid
apple-libunwind:
buildable: false
externals:
@@ -32,3 +34,10 @@ packages:
# although the version number used here isn't critical
- spec: apple-libunwind@35.3
prefix: /usr
+ apple-libuuid:
+ buildable: false
+ externals:
+ # Apple bundles libuuid in libsystem_c version 1353.100.2,
+ # although the version number used here isn't critical
+ - spec: apple-libuuid@1353.100.2
+ prefix: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr
diff --git a/var/spack/repos/builtin/packages/apple-libuuid/package.py b/var/spack/repos/builtin/packages/apple-libuuid/package.py
new file mode 100644
index 0000000000..09b8ae9dc2
--- /dev/null
+++ b/var/spack/repos/builtin/packages/apple-libuuid/package.py
@@ -0,0 +1,45 @@
+# 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 AppleLibuuid(BundlePackage):
+ """Placeholder package for Apple's analogue to non-GNU libuuid"""
+
+ homepage = "https://opensource.apple.com/tarballs/Libsystem/"
+
+ version('1353.100.2')
+
+ provides('uuid')
+
+ # Only supported on 'platform=darwin'
+ conflicts('platform=linux')
+ conflicts('platform=cray')
+
+ @property
+ def libs(self):
+ """Export the Apple libuuid library.
+
+ According to https://bugs.freedesktop.org/show_bug.cgi?id=105366,
+ libuuid is provided as part of libsystem_c. The Apple libsystem_c
+ 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/libsystem_c.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/libsystem_c.dylib`."""
+
+ return LibraryList('/usr/lib/libSystem.dylib')
+
+ @property
+ def headers(self):
+ """Export the Apple libuuid header."""
+ return HeaderList(self.prefix.include.uuid.join('uuid.h'))
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 2b5f1faeb7..a8e2d9b740 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -7,7 +7,6 @@ import ast
import os
import platform
import re
-import sys
import llnl.util.tty as tty
from llnl.util.lang import match_predicate
@@ -167,14 +166,8 @@ class Python(AutotoolsPackage):
depends_on('libffi', when='+ctypes')
depends_on('tk', when='+tkinter')
depends_on('tcl', when='+tkinter')
+ depends_on('uuid', when='+uuid')
depends_on('tix', when='+tix')
- if sys.platform != 'darwin':
- # On macOS systems, Spack's libuuid conflicts with the system-installed
- # version and breaks anything linked against Cocoa/Carbon. Since the
- # system-provided version is sufficient to build Python's UUID support,
- # the easy solution is to only depend on Spack's libuuid when *not* on
- # a Mac.
- depends_on('uuid', when='+uuid')
# Python needs to be patched to build extensions w/ mixed C/C++ code:
# https://github.com/NixOS/nixpkgs/pull/19585/files