minimal support for freebsd (#41434)
This commit is contained in:
parent
f7fc4b201d
commit
4fc73bd7f3
@ -16,6 +16,7 @@
|
||||
import llnl.util.filesystem as fs
|
||||
from llnl.util import tty
|
||||
|
||||
import spack.platforms
|
||||
import spack.store
|
||||
import spack.util.environment
|
||||
import spack.util.executable
|
||||
@ -206,17 +207,19 @@ def _root_spec(spec_str: str) -> str:
|
||||
"""Add a proper compiler and target to a spec used during bootstrapping.
|
||||
|
||||
Args:
|
||||
spec_str (str): spec to be bootstrapped. Must be without compiler and target.
|
||||
spec_str: spec to be bootstrapped. Must be without compiler and target.
|
||||
"""
|
||||
# Add a proper compiler hint to the root spec. We use GCC for
|
||||
# everything but MacOS and Windows.
|
||||
if str(spack.platforms.host()) == "darwin":
|
||||
# Add a compiler requirement to the root spec.
|
||||
platform = str(spack.platforms.host())
|
||||
if platform == "darwin":
|
||||
spec_str += " %apple-clang"
|
||||
elif str(spack.platforms.host()) == "windows":
|
||||
elif platform == "windows":
|
||||
# TODO (johnwparent): Remove version constraint when clingo patch is up
|
||||
spec_str += " %msvc@:19.37"
|
||||
else:
|
||||
elif platform == "linux":
|
||||
spec_str += " %gcc"
|
||||
elif platform == "freebsd":
|
||||
spec_str += " %clang"
|
||||
|
||||
target = archspec.cpu.host().family
|
||||
spec_str += f" target={target}"
|
||||
|
@ -5,11 +5,20 @@
|
||||
from ._operating_system import OperatingSystem
|
||||
from .cray_backend import CrayBackend
|
||||
from .cray_frontend import CrayFrontend
|
||||
from .freebsd import FreeBSDOs
|
||||
from .linux_distro import LinuxDistro
|
||||
from .mac_os import MacOs
|
||||
from .windows_os import WindowsOs
|
||||
|
||||
__all__ = ["OperatingSystem", "LinuxDistro", "MacOs", "CrayFrontend", "CrayBackend", "WindowsOs"]
|
||||
__all__ = [
|
||||
"OperatingSystem",
|
||||
"LinuxDistro",
|
||||
"MacOs",
|
||||
"CrayFrontend",
|
||||
"CrayBackend",
|
||||
"WindowsOs",
|
||||
"FreeBSDOs",
|
||||
]
|
||||
|
||||
#: List of all the Operating Systems known to Spack
|
||||
operating_systems = [LinuxDistro, MacOs, CrayFrontend, CrayBackend, WindowsOs]
|
||||
operating_systems = [LinuxDistro, MacOs, CrayFrontend, CrayBackend, WindowsOs, FreeBSDOs]
|
||||
|
15
lib/spack/spack/operating_systems/freebsd.py
Normal file
15
lib/spack/spack/operating_systems/freebsd.py
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright 2013-2023 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)
|
||||
import platform as py_platform
|
||||
|
||||
from spack.version import Version
|
||||
|
||||
from ._operating_system import OperatingSystem
|
||||
|
||||
|
||||
class FreeBSDOs(OperatingSystem):
|
||||
def __init__(self):
|
||||
release = py_platform.release().split("-", 1)[0]
|
||||
super().__init__("freebsd", Version(release))
|
@ -8,6 +8,7 @@
|
||||
from ._platform import Platform
|
||||
from .cray import Cray
|
||||
from .darwin import Darwin
|
||||
from .freebsd import FreeBSD
|
||||
from .linux import Linux
|
||||
from .test import Test
|
||||
from .windows import Windows
|
||||
@ -17,6 +18,7 @@
|
||||
"Cray",
|
||||
"Darwin",
|
||||
"Linux",
|
||||
"FreeBSD",
|
||||
"Test",
|
||||
"Windows",
|
||||
"platforms",
|
||||
|
@ -10,12 +10,13 @@
|
||||
|
||||
from .cray import Cray
|
||||
from .darwin import Darwin
|
||||
from .freebsd import FreeBSD
|
||||
from .linux import Linux
|
||||
from .test import Test
|
||||
from .windows import Windows
|
||||
|
||||
#: List of all the platform classes known to Spack
|
||||
platforms = [Cray, Darwin, Linux, Windows, Test]
|
||||
platforms = [Cray, Darwin, Linux, Windows, FreeBSD, Test]
|
||||
|
||||
|
||||
@llnl.util.lang.memoized
|
||||
|
37
lib/spack/spack/platforms/freebsd.py
Normal file
37
lib/spack/spack/platforms/freebsd.py
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright 2013-2023 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)
|
||||
import platform
|
||||
|
||||
import archspec.cpu
|
||||
|
||||
import spack.target
|
||||
from spack.operating_systems.freebsd import FreeBSDOs
|
||||
|
||||
from ._platform import Platform
|
||||
|
||||
|
||||
class FreeBSD(Platform):
|
||||
priority = 102
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("freebsd")
|
||||
|
||||
for name in archspec.cpu.TARGETS:
|
||||
self.add_target(name, spack.target.Target(name))
|
||||
|
||||
# Get specific default
|
||||
self.default = archspec.cpu.host().name
|
||||
self.front_end = self.default
|
||||
self.back_end = self.default
|
||||
|
||||
os = FreeBSDOs()
|
||||
self.default_os = str(os)
|
||||
self.front_os = self.default_os
|
||||
self.back_os = self.default_os
|
||||
self.add_operating_system(str(os), os)
|
||||
|
||||
@classmethod
|
||||
def detect(cls):
|
||||
return platform.system().lower() == "freebsd"
|
@ -50,6 +50,7 @@ class Clingo(CMakePackage):
|
||||
depends_on("re2c@0.13:", type="build")
|
||||
depends_on("bison@2.5:", type="build", when="platform=linux")
|
||||
depends_on("bison@2.5:", type="build", when="platform=darwin")
|
||||
depends_on("bison@2.5:", type="build", when="platform=freebsd")
|
||||
depends_on("bison@2.5:", type="build", when="platform=cray")
|
||||
|
||||
with when("platform=windows"):
|
||||
@ -61,8 +62,9 @@ class Clingo(CMakePackage):
|
||||
depends_on("python", type=("build", "link", "run"))
|
||||
# Clingo 5.5.0 supports Python 3.6 or later and needs CFFI
|
||||
depends_on("python@3.6.0:", type=("build", "link", "run"), when="@5.5.0:")
|
||||
depends_on("py-cffi", type=("build", "run"), when="@5.5.0: platform=darwin")
|
||||
depends_on("py-cffi", type=("build", "run"), when="@5.5.0: platform=linux")
|
||||
depends_on("py-cffi", type=("build", "run"), when="@5.5.0: platform=darwin")
|
||||
depends_on("py-cffi", type=("build", "run"), when="@5.5.0: platform=freebsd")
|
||||
depends_on("py-cffi", type=("build", "run"), when="@5.5.0: platform=cray")
|
||||
|
||||
patch("python38.patch", when="@5.3:5.4.0")
|
||||
|
@ -105,7 +105,7 @@ class Expat(AutotoolsPackage, CMakePackage):
|
||||
# `~libbsd`.
|
||||
variant(
|
||||
"libbsd",
|
||||
default=sys.platform != "darwin" and sys.platform != "win32",
|
||||
default=sys.platform == "linux",
|
||||
description="Use libbsd (for high quality randomness)",
|
||||
)
|
||||
|
||||
|
11
var/spack/repos/builtin/packages/krb5/freebsd-link.patch
Normal file
11
var/spack/repos/builtin/packages/krb5/freebsd-link.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/src/config/shlib.conf
|
||||
+++ b/src/config/shlib.conf
|
||||
@@ -327,7 +327,7 @@ mips-*-netbsd*)
|
||||
CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CFLAGS) $(LDFLAGS)'
|
||||
CXX_LINK_SHARED='$(CXX) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CXXFLAGS) $(LDFLAGS)'
|
||||
SHLIBEXT=.so
|
||||
- LDCOMBINE='ld -Bshareable'
|
||||
+ LDCOMBINE='$(CC) -shared'
|
||||
SHLIB_RPATH_FLAGS='--enable-new-dtags -rpath $(SHLIB_RDIRS)'
|
||||
SHLIB_EXPFLAGS='$(SHLIB_RPATH_FLAGS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
|
||||
CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(CFLAGS) $(LDFLAGS)'
|
@ -42,6 +42,7 @@ class Krb5(AutotoolsPackage):
|
||||
)
|
||||
# This patch is applied in newer upstream releases
|
||||
patch("mit-krb5-1.17-static-libs.patch", level=0, when="@:1.18.9")
|
||||
patch("freebsd-link.patch", when="platform=freebsd")
|
||||
|
||||
configure_directory = "src"
|
||||
build_directory = "src"
|
||||
|
@ -35,6 +35,8 @@ class Libbsd(AutotoolsPackage):
|
||||
patch("cdefs.h.patch", when="@0.8.6 %gcc@:4")
|
||||
patch("local-elf.h.patch", when="@:0.10 %intel")
|
||||
|
||||
conflicts("platform=freebsd")
|
||||
|
||||
# https://gitlab.freedesktop.org/libbsd/libbsd/issues/1
|
||||
conflicts("platform=darwin")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user