Extract some package changes from compiler as deps (#49138)

This commit is contained in:
Massimiliano Culpo 2025-02-21 12:52:34 +01:00 committed by GitHub
parent b8ec69112f
commit f4614a4931
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 51 additions and 39 deletions

View File

@ -262,6 +262,7 @@ class Gromacs(CMakePackage, CudaPackage):
depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("fortran", type="build", when="@:4.5.5") # No core Fortran code since 4.6
depends_on("fortran", type="build", when="+cp2k") # Need Fortan compiler for CP2K
variant(
"mpi", default=True, description="Activate MPI support (disable for Thread-MPI support)"

View File

@ -70,5 +70,5 @@ def url_for_version(self, version):
return url.format(version)
def configure_args(self):
args = ["--with-xml-catalog={0}".format(self.spec["docbook-xml"].package.catalog)]
args = ["--with-xml-catalog={0}".format(self["docbook-xml"].catalog)]
return args

View File

@ -26,7 +26,8 @@ class Hztool(AutotoolsPackage):
version("4.1", sha256="a24b5d483d1dacaa991958956e838601a426133c74885b3aa2fc27c98b42d22a")
version("4.0", sha256="e6f6955159da46156bf9182f61754a59dd14e407d40c2448e3f821d55bf963a0")
depends_on("fortran", type="build") # generated
depends_on("c", type="build")
depends_on("fortran", type="build")
def patch(self):
filter_file("-fno-automatic", "-fno-automatic -fallow-argument-mismatch", "configure.ac")

View File

@ -28,7 +28,7 @@ def filter_detected_exes(cls, prefix, exes_in_prefix):
reject = re.compile(
r"-(vscode|cpp|cl|ocl|gpu|tidy|rename|scan-deps|format|refactor|offload|"
r"check|query|doc|move|extdef|apply|reorder|change-namespace|"
r"include-fixer|import-test|dap|server)"
r"include-fixer|import-test|dap|server|PerfectShuffle)"
)
return [x for x in exes_in_prefix if not reject.search(x)]

View File

@ -35,6 +35,11 @@ class LuaLpeg(LuaPackage):
depends_on("lua-lang@:5.1.9", when="@:0.12.1 ^[virtuals=lua-lang] lua")
@property
def libs(self):
libraries = [f"**/lua/{self.spec['lua-lang'].version.up_to(2)}/lpeg"]
return find_libraries(libraries, root=self.prefix)
class LuaBuilder(spack.build_systems.lua.LuaBuilder):
# without this, the resulting library cannot be linked by a normal link phase, the

View File

@ -35,7 +35,8 @@ class LuaLuajitOpenresty(LuaImplPackage):
description="add symlinks to make lua-luajit a drop-in lua replacement",
)
provides("luajit", "lua-lang@5.1", when="+lualinks")
provides("luajit", "lua-lang", when="+lualinks")
provides("lua-lang@5.1", when="+lualinks")
lua_version_override = "5.1"
@run_after("install")

View File

@ -133,8 +133,7 @@ def cmake_python_hints(self):
"""Include the python include path to the
CMake based on current spec
"""
python = self.spec["python"]
return [self.define("Python_INCLUDE_DIR", python.package.config_vars["include"])]
return [self.define("Python_INCLUDE_DIR", self["python"].config_vars["include"])]
@classmethod
def determine_version(cls, lib):

View File

@ -38,10 +38,11 @@ def cmake_args(self):
args.append(self.define("CMAKE_C_FLAGS", " ".join(cflags)))
nc = self.spec["netcdf-c"]
if "~shared" in nc:
if nc.satisfies("~shared"):
nc_flags = Executable("nc-config")("--static", "--libs", output=str).strip()
args.append(self.define("CMAKE_EXE_LINKER_FLAGS", nc_flags))
if "+mpi" in nc:
args.append(self.define("CMAKE_C_COMPILER", self.spec["mpi"].mpicc))
if nc.satisfies("+mpi"):
args.append(self.define("CMAKE_C_COMPILER", self.spec["mpi"].mpicc))
return args

View File

@ -88,6 +88,7 @@ class Neovim(CMakePackage):
)
# depend on virtual, lua-luajit-openresty preferred
depends_on("lua-lang")
depends_on("luajit", when="~no_luajit")
depends_on("lua-lang@5.1", when="+no_luajit")
@ -153,4 +154,7 @@ class Neovim(CMakePackage):
@when("^lua")
def cmake_args(self):
return [self.define("PREFER_LUA", True)]
return [
self.define("PREFER_LUA", True),
self.define("LPEG_LIBRARY", self.spec["lua-lpeg"].libs),
]

View File

@ -401,9 +401,9 @@ class Openmpi(AutotoolsPackage, CudaPackage):
"1.0", sha256="cf75e56852caebe90231d295806ac3441f37dc6d9ad17b1381791ebb78e21564"
) # libmpi.so.0.0.0
depends_on("c", type="build") # generated
depends_on("cxx", type="build") # generated
depends_on("fortran", type="build") # generated
depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("fortran", type="build")
patch("ad_lustre_rwcontig_open_source.patch", when="@1.6.5")
patch("llnl-platforms.patch", when="@1.6.5")
@ -971,37 +971,37 @@ def with_or_without_ofi(self, activated):
def with_or_without_fca(self, activated):
if not activated:
return "--without-fca"
return "--with-fca={0}".format(self.spec["fca"].prefix)
return f"--with-fca={self.spec['fca'].prefix}"
def with_or_without_hcoll(self, activated):
if not activated:
return "--without-hcoll"
return "--with-hcoll={0}".format(self.spec["hcoll"].prefix)
return f"--with-hcoll={self.spec['hcoll'].prefix}"
def with_or_without_ucc(self, activated):
if not activated:
return "--without-ucc"
return "--with-ucc={0}".format(self.spec["ucc"].prefix)
return f"--with-ucc={self.spec['ucc'].prefix}"
def with_or_without_xpmem(self, activated):
if not activated:
return "--without-xpmem"
return "--with-xpmem={0}".format(self.spec["xpmem"].prefix)
return f"--with-xpmem={self.spec['xpmem'].prefix}"
def with_or_without_knem(self, activated):
if not activated:
return "--without-knem"
return "--with-knem={0}".format(self.spec["knem"].prefix)
return f"--with-knem={self.spec['knem'].prefix}"
def with_or_without_lsf(self, activated):
if not activated:
return "--without-lsf"
return "--with-lsf={0}".format(self.spec["lsf"].prefix)
return f"--with-lsf={self.spec['lsf'].prefix}"
def with_or_without_tm(self, activated):
if not activated:
return "--without-tm"
return "--with-tm={0}".format(self.spec["pbs"].prefix)
return f"--with-tm={self.spec['pbs'].prefix}"
@run_before("autoreconf")
def die_without_fortran(self):

View File

@ -49,7 +49,7 @@ def edit(self, spec, prefix):
vars = [
("VERSUFF", "-%s" % gcc_version),
("CXX", compiler.cxx),
("GCJ", spec["eclipse-gcj-parser"].package.gcj),
("GCJ", self["eclipse-gcj-parser"].gcj),
("GCJH", join_path(gcc_base, "bin", "gcjh")),
("GJAR", join_path(gcc_base, "bin", "gjar")),
("LIBGCJ", join_path(gcc_base, "share", "java", "libgcj-{0}.jar".format(gcc_version))),

View File

@ -67,9 +67,9 @@ def build_pl_args(self):
def setup_build_environment(self, env):
# These variables are exected by by the Build.PL file
# even though we override the results via PERL_MB_OPT
kent = self.spec["kentutils"]
env.set("KENT_SRC", kent.prefix)
env.set("MACHTYPE", kent.package.machtype)
kent_pkg = self["kentutils"]
env.set("KENT_SRC", kent_pkg.prefix)
env.set("MACHTYPE", kent_pkg.machtype)
# Overriding this explicitly as an environmental variable
# as the Build.PL script doesn't honnor the command line

View File

@ -120,7 +120,7 @@ def cmake_args(self):
options.append(self.define("{}_PROVIDER".format(lib), provider))
if "cray-libsci" in self.spec:
for lib in ("CBLAS", "LAPACKE"):
libsci_prefix = self.spec["cray-libsci"].package.external_prefix
libsci_prefix = self["cray-libsci"].external_prefix
options.append(self.define("{}_PROVIDER".format(lib), "generic"))
options.append(
self.define("{}_INCLUDE_DIRS".format(lib), join_path(libsci_prefix, "include"))

View File

@ -195,7 +195,7 @@ def cmake_args(self):
python_library = spec["python"].libs[0]
python_include = spec["python"].headers.directories[0]
numpy_include = join_path(
spec["py-numpy"].package.module.python_platlib, "numpy", "core", "include"
self["py-numpy"].module.python_platlib, "numpy", "core", "include"
)
cmake_args.extend(
[

View File

@ -60,7 +60,7 @@ def patch(self):
python_include = spec["python"].headers.directories[0]
numpy_include = join_path(
spec["py-numpy"].package.module.python_platlib, "numpy", "core", "include"
self["py-numpy"].module.python_platlib, "numpy", "core", "include"
)
libs = blas.libs + lapack.libs + libxc.libs

View File

@ -265,11 +265,11 @@ def setup_build_environment(self, env):
# Pick up BLAS/LAPACK from numpy
if self.spec.satisfies("@:1.8"):
self.spec["py-numpy"].package.setup_build_environment(env)
self["py-numpy"].setup_build_environment(env)
@when("@1.9:")
def config_settings(self, spec, prefix):
blas, lapack = self.spec["py-numpy"].package.blas_lapack_pkg_config()
blas, lapack = self["py-numpy"].blas_lapack_pkg_config()
if spec.satisfies("%aocc") or spec.satisfies("%clang@18:"):
fortran_std = "none"
@ -287,10 +287,9 @@ def config_settings(self, spec, prefix):
},
}
@when("@:1.8")
@run_before("install")
@run_before("install", when="@:1.8")
def set_blas_lapack(self):
self.spec["py-numpy"].package.blas_lapack_site_cfg()
self["py-numpy"].blas_lapack_site_cfg()
@run_after("install")
@on_package_attributes(run_tests=True)

View File

@ -198,7 +198,7 @@ class Qgis(CMakePackage):
@run_before("cmake", when="^py-pyqt5")
def fix_pyqt5_cmake(self):
cmfile = FileFilter(join_path("cmake", "FindPyQt5.cmake"))
pyqtpath = join_path(self.spec["py-pyqt5"].package.module.python_platlib, "PyQt5")
pyqtpath = join_path(self["py-pyqt5"].module.python_platlib, "PyQt5")
cmfile.filter(
'SET(PYQT5_MOD_DIR "${Python_SITEARCH}/PyQt5")',
'SET(PYQT5_MOD_DIR "' + pyqtpath + '")',

View File

@ -77,9 +77,7 @@ def with_torch(self):
@property
def torch_dir(self):
return (
join_path(self.spec["py-torch"].package.cmake_prefix_paths[0], "Torch")
if self.with_torch
else None
join_path(self["py-torch"].cmake_prefix_paths[0], "Torch") if self.with_torch else None
)
@property

View File

@ -20,7 +20,7 @@ class RpcsvcProto(AutotoolsPackage):
version("1.4.1", sha256="9429e143bb8dd33d34bf0663f571d4d4a1103e1afd7c49791b367b7ae1ef7f35")
version("1.4", sha256="4149d5f05d8f7224a4d207362fdfe72420989dc1b028b28b7b62b6c2efe22345")
depends_on("c", type="build") # generated
depends_on("c", type="build")
depends_on("gettext")

View File

@ -19,7 +19,8 @@ class Snappy(CMakePackage):
version("1.1.8", sha256="16b677f07832a612b0836178db7f374e414f94657c138e6993cbfc5dcc58651f")
version("1.1.7", sha256="3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4")
depends_on("cxx", type="build") # generated
depends_on("c", type="build")
depends_on("cxx", type="build")
variant("shared", default=True, description="Build shared libraries")
variant("pic", default=True, description="Build position independent code")

View File

@ -26,6 +26,8 @@ class Tree(Package):
version("1.8.0", sha256="715d5d4b434321ce74706d0dd067505bb60c5ea83b5f0b3655dae40aa6f9b7c2")
version("1.7.0", sha256="6957c20e82561ac4231638996e74f4cfa4e6faabc5a2f511f0b4e3940e8f7b12")
depends_on("c", type="build")
depends_on("gmake", type="build")
@when("@2:")

View File

@ -63,7 +63,7 @@ def configure_args(self):
]
if self.spec.satisfies("^intel-oneapi-mpi"):
args.append("--with-mpi=" + self.spec["intel-oneapi-mpi"].package.component_prefix)
args.append("--with-mpi=" + self["intel-oneapi-mpi"].component_prefix)
else:
args.append("--with-mpi=" + self.spec["mpi"].prefix)