From a2ea30aceb6b09d48d4a0c76bbadaf9bff1a5437 Mon Sep 17 00:00:00 2001 From: Robert Cohn Date: Wed, 10 May 2023 06:25:00 -0400 Subject: Create include/lib in prefix for oneapi packages (#37552) --- lib/spack/spack/build_systems/oneapi.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lib') diff --git a/lib/spack/spack/build_systems/oneapi.py b/lib/spack/spack/build_systems/oneapi.py index a6f96d45eb..a8b03689f4 100644 --- a/lib/spack/spack/build_systems/oneapi.py +++ b/lib/spack/spack/build_systems/oneapi.py @@ -4,13 +4,16 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) """Common utilities for managing intel oneapi packages.""" import getpass +import os import platform import shutil from os.path import basename, dirname, isdir from llnl.util.filesystem import find_headers, find_libraries, join_path +from llnl.util.link_tree import LinkTree from spack.directives import conflicts, variant +from spack.package import mkdirp from spack.util.environment import EnvironmentModifications from spack.util.executable import Executable @@ -125,6 +128,31 @@ class IntelOneApiPackage(Package): ) ) + def symlink_dir(self, src, dest): + # Taken from: https://github.com/spack/spack/pull/31285/files + # oneapi bin/lib directories are 2 or 3 levels below the + # prefix, but it is more typical to have them directly in the + # prefix. The location has changed over time. Rather than make + # every package that needs to know where include/lib are + # located be aware of this, put in symlinks to conform. This + # is good enough for some, but not all packages. + + # If we symlink top-level directories directly, files won't + # show up in views Create real dirs and symlink files instead + + # Create a real directory at dest + mkdirp(dest) + + # Symlink all files in src to dest keeping directories as dirs + for entry in os.listdir(src): + src_path = join_path(src, entry) + dest_path = join_path(dest, entry) + if isdir(src_path) and os.access(src_path, os.X_OK): + link_tree = LinkTree(src_path) + link_tree.merge(dest_path) + else: + os.symlink(src_path, dest_path) + class IntelOneApiLibraryPackage(IntelOneApiPackage): """Base class for Intel oneAPI library packages. -- cgit v1.2.3-60-g2f50