builtin: replace self.spec[self.name] by self (#49567)

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Massimiliano Culpo 2025-03-19 08:56:55 +01:00 committed by GitHub
parent 31fa12ebd3
commit ec34e88d79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 87 additions and 109 deletions

View File

@ -56,13 +56,11 @@ def url_for_version(self, version):
# To enable this plug-in to work with NCCL add it to the LD_LIBRARY_PATH # To enable this plug-in to work with NCCL add it to the LD_LIBRARY_PATH
def setup_run_environment(self, env): def setup_run_environment(self, env):
aws_ofi_nccl_home = self.spec.prefix env.append_path("LD_LIBRARY_PATH", self.prefix.lib)
env.append_path("LD_LIBRARY_PATH", aws_ofi_nccl_home.lib)
# To enable this plug-in to work with NCCL add it to the LD_LIBRARY_PATH # To enable this plug-in to work with NCCL add it to the LD_LIBRARY_PATH
def setup_dependent_run_environment(self, env, dependent_spec): def setup_dependent_run_environment(self, env, dependent_spec):
aws_ofi_nccl_home = self.spec["aws-ofi-nccl"].prefix env.append_path("LD_LIBRARY_PATH", self.prefix.lib)
env.append_path("LD_LIBRARY_PATH", aws_ofi_nccl_home.lib)
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec

View File

@ -170,7 +170,7 @@ def install(self, spec, prefix):
@run_after("install") @run_after("install")
def install_pkgconfig(self): def install_pkgconfig(self):
# Add pkgconfig file after installation # Add pkgconfig file after installation
libdir = self.spec["bzip2"].libs.directories[0] libdir = self.libs.directories[0]
pkg_path = join_path(self.prefix.lib, "pkgconfig") pkg_path = join_path(self.prefix.lib, "pkgconfig")
mkdirp(pkg_path) mkdirp(pkg_path)

View File

@ -52,7 +52,7 @@ def test_smoke_test(self):
ctest = Executable(spec["cmake"].prefix.bin.ctest) ctest = Executable(spec["cmake"].prefix.bin.ctest)
cmake( cmake(
spec["diy"].prefix.share.DIY.examples.smoke_test, self.prefix.share.DIY.examples.smoke_test,
f"-DMPI_HOME={spec['mpi'].prefix}", f"-DMPI_HOME={spec['mpi'].prefix}",
f"-DCMAKE_PREFIX_PATH={spec['diy'].prefix}", f"-DCMAKE_PREFIX_PATH={spec['diy'].prefix}",
) )

View File

@ -40,20 +40,17 @@ def flag_handler(self, name, flags):
return flags, None, None return flags, None, None
def install(self, spec, prefix): def install(self, spec, prefix):
options = ["--prefix=%s" % prefix]
oapp = options.append
# Specify installation directory for Fortran module files # Specify installation directory for Fortran module files
# Default is [INCLUDEDIR/FC_TYPE] # Default is [INCLUDEDIR/FC_TYPE]
oapp("--with-moduledir=%s" % prefix.include) options = [f"--prefix={prefix}", f"--with-moduledir={prefix.include}"]
# Netcdf4/HDF # Netcdf4/HDF
hdf_libs = "-L%s -lhdf5_hl -lhdf5" % spec["hdf5"].prefix.lib hdf_libs = f"-L{spec['hdf5'].prefix.lib} -lhdf5_hl -lhdf5"
options.extend( options.extend(
[ [
"--with-netcdf-incs=-I%s" % spec["netcdf-fortran"].prefix.include, f"--with-netcdf-incs=-I{spec['netcdf-fortran'].prefix.include}",
"--with-netcdf-libs=-L%s -lnetcdff -lnetcdf %s" f"--with-netcdf-libs=-L{spec['netcdf-fortran'].prefix.lib} "
% (spec["netcdf-fortran"].prefix.lib, hdf_libs), f"-lnetcdff -lnetcdf {hdf_libs}",
] ]
) )
@ -66,7 +63,6 @@ def install(self, spec, prefix):
def test_etsf_io_help(self): def test_etsf_io_help(self):
"""check etsf_io can execute (--help)""" """check etsf_io can execute (--help)"""
path = self.spec["etsf-io"].prefix.bin.etsf_io etsfio = which(self.prefix.bin.etsf_io)
etsfio = which(path)
out = etsfio("--help", output=str.split, error=str.split) out = etsfio("--help", output=str.split, error=str.split)
assert "Usage: etsf_io" in out assert "Usage: etsf_io" in out

View File

@ -25,7 +25,7 @@ class Hiptt(MakefilePackage, ROCmPackage):
# To enable this package add it to the LD_LIBRARY_PATH # To enable this package add it to the LD_LIBRARY_PATH
def setup_dependent_build_environment(self, env, dependent_spec): def setup_dependent_build_environment(self, env, dependent_spec):
hiptt_home = self.spec["hiptt"].prefix hiptt_home = self.prefix
env.prepend_path("cuTT_ROOT", hiptt_home) env.prepend_path("cuTT_ROOT", hiptt_home)
env.prepend_path("cuTT_LIBRARY", hiptt_home.lib) env.prepend_path("cuTT_LIBRARY", hiptt_home.lib)
env.prepend_path("cuTT_INCLUDE_PATH", hiptt_home.include) env.prepend_path("cuTT_INCLUDE_PATH", hiptt_home.include)

View File

@ -100,7 +100,7 @@ def check_install(self):
prefixes = ";".join( prefixes = ";".join(
[ [
self.spec["libdrm"].prefix, self.spec["libdrm"].prefix,
self.spec["hsakmt-roct"].prefix, self.prefix,
self.spec["numactl"].prefix, self.spec["numactl"].prefix,
self.spec["pkgconfig"].prefix, self.spec["pkgconfig"].prefix,
self.spec["llvm-amdgpu"].prefix, self.spec["llvm-amdgpu"].prefix,
@ -108,7 +108,7 @@ def check_install(self):
self.spec["ncurses"].prefix, self.spec["ncurses"].prefix,
] ]
) )
hsakmt_path = ";".join([self.spec["hsakmt-roct"].prefix]) hsakmt_path = ";".join([self.prefix])
cc_options = [ cc_options = [
"-DCMAKE_PREFIX_PATH=" + prefixes, "-DCMAKE_PREFIX_PATH=" + prefixes,
"-DLIBHSAKMT_PATH=" + hsakmt_path, "-DLIBHSAKMT_PATH=" + hsakmt_path,

View File

@ -33,5 +33,4 @@ class Keepalived(AutotoolsPackage):
depends_on("openssl") depends_on("openssl")
def configure_args(self): def configure_args(self):
args = ["--with-systemdsystemunitdir=" + self.spec["keepalived"].prefix.lib.systemd.system] return [f"--with-systemdsystemunitdir={self.prefix.lib.systemd.system}"]
return args

View File

@ -176,15 +176,13 @@ def setup_build_environment(self, env):
# To enable this package add it to the LD_LIBRARY_PATH # To enable this package add it to the LD_LIBRARY_PATH
def setup_run_environment(self, env): def setup_run_environment(self, env):
libfabric_home = self.spec["libfabric"].prefix env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib)
env.prepend_path("LD_LIBRARY_PATH", libfabric_home.lib) env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib64)
env.prepend_path("LD_LIBRARY_PATH", libfabric_home.lib64)
# To enable this package add it to the LD_LIBRARY_PATH # To enable this package add it to the LD_LIBRARY_PATH
def setup_dependent_run_environment(self, env, dependent_spec): def setup_dependent_run_environment(self, env, dependent_spec):
libfabric_home = self.spec["libfabric"].prefix env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib)
env.prepend_path("LD_LIBRARY_PATH", libfabric_home.lib) env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib64)
env.prepend_path("LD_LIBRARY_PATH", libfabric_home.lib64)
@when("@main") @when("@main")
def autoreconf(self, spec, prefix): def autoreconf(self, spec, prefix):

View File

@ -308,15 +308,13 @@ def cmake_args(self):
# Make sure that the compiler paths are in the LD_LIBRARY_PATH # Make sure that the compiler paths are in the LD_LIBRARY_PATH
def setup_run_environment(self, env): def setup_run_environment(self, env):
llvm_amdgpu_home = self.spec["llvm-amdgpu"].prefix env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib)
env.prepend_path("LD_LIBRARY_PATH", llvm_amdgpu_home + "/lib")
# Make sure that the compiler paths are in the LD_LIBRARY_PATH # Make sure that the compiler paths are in the LD_LIBRARY_PATH
def setup_dependent_run_environment(self, env, dependent_spec): def setup_dependent_run_environment(self, env, dependent_spec):
llvm_amdgpu_home = self.spec["llvm-amdgpu"].prefix env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib)
env.prepend_path("LD_LIBRARY_PATH", llvm_amdgpu_home + "/lib")
# Required for enabling asan on dependent packages # Required for enabling asan on dependent packages
for root, _, files in os.walk(self.spec["llvm-amdgpu"].prefix): for root, _, files in os.walk(self.prefix):
if "libclang_rt.asan-x86_64.so" in files: if "libclang_rt.asan-x86_64.so" in files:
env.prepend_path("LD_LIBRARY_PATH", root) env.prepend_path("LD_LIBRARY_PATH", root)
env.prune_duplicate_paths("LD_LIBRARY_PATH") env.prune_duplicate_paths("LD_LIBRARY_PATH")
@ -339,7 +337,7 @@ def post_install(self):
# Required for enabling asan on dependent packages # Required for enabling asan on dependent packages
def setup_dependent_build_environment(self, env, dependent_spec): def setup_dependent_build_environment(self, env, dependent_spec):
for root, _, files in os.walk(self.spec["llvm-amdgpu"].prefix): for root, _, files in os.walk(self.prefix):
if "libclang_rt.asan-x86_64.so" in files: if "libclang_rt.asan-x86_64.so" in files:
env.prepend_path("LD_LIBRARY_PATH", root) env.prepend_path("LD_LIBRARY_PATH", root)
env.prune_duplicate_paths("LD_LIBRARY_PATH") env.prune_duplicate_paths("LD_LIBRARY_PATH")

View File

@ -27,5 +27,4 @@ class Moosefs(AutotoolsPackage):
depends_on("c", type="build") # generated depends_on("c", type="build") # generated
def configure_args(self): def configure_args(self):
args = ["--with-systemdsystemunitdir=" + self.spec["moosefs"].prefix.lib.systemd.system] return [f"--with-systemdsystemunitdir={self.prefix.lib.systemd.system}"]
return args

View File

@ -96,7 +96,7 @@ def filter_compilers(self):
"-I{0}".format( "-I{0}".format(
" -I".join( " -I".join(
[ [
os.path.join(spec["psi4"].prefix.include, "psi4"), os.path.join(self.prefix.include, "psi4"),
os.path.join(spec["boost"].prefix.include, "boost"), os.path.join(spec["boost"].prefix.include, "boost"),
os.path.join(spec["python"].headers.directories[0]), os.path.join(spec["python"].headers.directories[0]),
spec["lapack"].prefix.include, spec["lapack"].prefix.include,

View File

@ -345,23 +345,21 @@ class RocmOpenmpExtras(Package):
def setup_run_environment(self, env): def setup_run_environment(self, env):
devlibs_prefix = self.spec["llvm-amdgpu"].prefix devlibs_prefix = self.spec["llvm-amdgpu"].prefix
openmp_extras_prefix = self.spec["rocm-openmp-extras"].prefix
llvm_prefix = self.spec["llvm-amdgpu"].prefix llvm_prefix = self.spec["llvm-amdgpu"].prefix
hsa_prefix = self.spec["hsa-rocr-dev"].prefix hsa_prefix = self.spec["hsa-rocr-dev"].prefix
env.set("AOMP", "{0}".format(llvm_prefix)) env.set("AOMP", f"{llvm_prefix}")
env.set("HIP_DEVICE_LIB_PATH", "{0}/amdgcn/bitcode".format(devlibs_prefix)) env.set("HIP_DEVICE_LIB_PATH", f"{devlibs_prefix}/amdgcn/bitcode")
env.prepend_path("CPATH", "{0}/include".format(openmp_extras_prefix)) env.prepend_path("CPATH", f"{self.prefix}/include")
env.prepend_path("LIBRARY_PATH", "{0}/lib".format(openmp_extras_prefix)) env.prepend_path("LIBRARY_PATH", f"{self.prefix}/lib")
if self.spec.satisfies("@5.3.0:"): if self.spec.satisfies("@5.3.0:"):
env.prepend_path("LD_LIBRARY_PATH", "{0}/lib".format(openmp_extras_prefix)) env.prepend_path("LD_LIBRARY_PATH", f"{self.prefix}/lib")
env.prepend_path("LD_LIBRARY_PATH", "{0}/lib".format(hsa_prefix)) env.prepend_path("LD_LIBRARY_PATH", f"{hsa_prefix}/lib")
env.set("AOMP_GPU", "`{0}/bin/mygpu`".format(openmp_extras_prefix)) env.set("AOMP_GPU", f"`{self.prefix}/bin/mygpu`")
def setup_build_environment(self, env): def setup_build_environment(self, env):
openmp_extras_prefix = self.spec["rocm-openmp-extras"].prefix
llvm_prefix = self.spec["llvm-amdgpu"].prefix llvm_prefix = self.spec["llvm-amdgpu"].prefix
env.set("AOMP", "{0}".format(llvm_prefix)) env.set("AOMP", f"{llvm_prefix}")
env.set("FC", "{0}/bin/flang".format(openmp_extras_prefix)) env.set("FC", f"{self.prefix}/bin/flang")
if self.spec.satisfies("@6.1:"): if self.spec.satisfies("@6.1:"):
env.prepend_path("LD_LIBRARY_PATH", self.spec["hsa-rocr-dev"].prefix.lib) env.prepend_path("LD_LIBRARY_PATH", self.spec["hsa-rocr-dev"].prefix.lib)
gfx_list = "gfx700 gfx701 gfx801 gfx803 gfx900 gfx902 gfx906 gfx908" gfx_list = "gfx700 gfx701 gfx801 gfx803 gfx900 gfx902 gfx906 gfx908"
@ -492,12 +490,11 @@ def install(self, spec, prefix):
src = self.stage.source_path src = self.stage.source_path
gfx_list = os.environ["GFXLIST"] gfx_list = os.environ["GFXLIST"]
gfx_list = gfx_list.replace(" ", ";") gfx_list = gfx_list.replace(" ", ";")
openmp_extras_prefix = self.spec["rocm-openmp-extras"].prefix
devlibs_prefix = self.spec["llvm-amdgpu"].prefix devlibs_prefix = self.spec["llvm-amdgpu"].prefix
if self.spec.satisfies("@6.1:"): if self.spec.satisfies("@6.1:"):
devlibs_src = "{0}/rocm-openmp-extras/llvm-project/amd/device-libs".format(src) devlibs_src = f"{src}/rocm-openmp-extras/llvm-project/amd/device-libs"
else: else:
devlibs_src = "{0}/rocm-openmp-extras/rocm-device-libs".format(src) devlibs_src = f"{src}/rocm-openmp-extras/rocm-device-libs"
hsa_prefix = self.spec["hsa-rocr-dev"].prefix hsa_prefix = self.spec["hsa-rocr-dev"].prefix
if self.spec.satisfies("@:6.2"): if self.spec.satisfies("@:6.2"):
hsakmt_prefix = self.spec["hsakmt-roct"].prefix hsakmt_prefix = self.spec["hsakmt-roct"].prefix
@ -507,10 +504,10 @@ def install(self, spec, prefix):
comgr_prefix = self.spec["comgr"].prefix comgr_prefix = self.spec["comgr"].prefix
llvm_inc = "/rocm-openmp-extras/llvm-project/llvm/include" llvm_inc = "/rocm-openmp-extras/llvm-project/llvm/include"
llvm_prefix = self.spec["llvm-amdgpu"].prefix llvm_prefix = self.spec["llvm-amdgpu"].prefix
omp_bin_dir = "{0}/bin".format(openmp_extras_prefix) omp_bin_dir = f"{self.prefix}/bin"
omp_lib_dir = "{0}/lib".format(openmp_extras_prefix) omp_lib_dir = f"{self.prefix}/lib"
bin_dir = "{0}/bin".format(llvm_prefix) bin_dir = f"{llvm_prefix}/bin"
lib_dir = "{0}/lib".format(llvm_prefix) lib_dir = f"{llvm_prefix}/lib"
flang_warning = "-Wno-incompatible-pointer-types-discards-qualifiers" flang_warning = "-Wno-incompatible-pointer-types-discards-qualifiers"
libpgmath = "/rocm-openmp-extras/flang/runtime/libpgmath/lib/common" libpgmath = "/rocm-openmp-extras/flang/runtime/libpgmath/lib/common"
elfutils_inc = spec["elfutils"].prefix.include elfutils_inc = spec["elfutils"].prefix.include
@ -543,23 +540,21 @@ def install(self, spec, prefix):
os.path.join(omp_bin_dir, "flang-legacy"), os.path.join(bin_dir, "flang-legacy") os.path.join(omp_bin_dir, "flang-legacy"), os.path.join(bin_dir, "flang-legacy")
) )
os.symlink(os.path.join(omp_lib_dir, "libdevice"), os.path.join(lib_dir, "libdevice")) os.symlink(os.path.join(omp_lib_dir, "libdevice"), os.path.join(lib_dir, "libdevice"))
os.symlink( os.symlink(os.path.join(self.prefix, "lib-debug"), os.path.join(llvm_prefix, "lib-debug"))
os.path.join(openmp_extras_prefix, "lib-debug"), os.path.join(llvm_prefix, "lib-debug")
)
# Set cmake args # Set cmake args
components = dict() components = dict()
components["aomp-extras"] = [ components["aomp-extras"] = [
"../rocm-openmp-extras/aomp-extras", "../rocm-openmp-extras/aomp-extras",
"-DLLVM_DIR={0}".format(llvm_prefix), f"-DLLVM_DIR={llvm_prefix}",
"-DDEVICE_LIBS_DIR={0}/amdgcn/bitcode".format(devlibs_prefix), f"-DDEVICE_LIBS_DIR={devlibs_prefix}/amdgcn/bitcode",
"-DCMAKE_C_COMPILER={0}/clang".format(bin_dir), f"-DCMAKE_C_COMPILER={bin_dir}/clang",
"-DCMAKE_CXX_COMPILER={0}/clang++".format(bin_dir), f"-DCMAKE_CXX_COMPILER={bin_dir}/clang++",
"-DAOMP_STANDALONE_BUILD=0", "-DAOMP_STANDALONE_BUILD=0",
"-DDEVICELIBS_ROOT={0}".format(devlibs_src), f"-DDEVICELIBS_ROOT={devlibs_src}",
"-DNEW_BC_PATH=1", "-DNEW_BC_PATH=1",
"-DAOMP={0}".format(llvm_prefix), f"-DAOMP={llvm_prefix}",
] ]
# Shared cmake configuration for openmp, openmp-debug # Shared cmake configuration for openmp, openmp-debug
@ -569,39 +564,39 @@ def install(self, spec, prefix):
# Passing the elfutils include path via cmake options is a # Passing the elfutils include path via cmake options is a
# workaround until hsa-rocr-dev switches to elfutils. # workaround until hsa-rocr-dev switches to elfutils.
openmp_common_args = [ openmp_common_args = [
"-DROCM_DIR={0}".format(hsa_prefix), f"-DROCM_DIR={hsa_prefix}",
"-DDEVICE_LIBS_DIR={0}/amdgcn/bitcode".format(devlibs_prefix), f"-DDEVICE_LIBS_DIR={devlibs_prefix}/amdgcn/bitcode",
"-DAOMP_STANDALONE_BUILD=0", "-DAOMP_STANDALONE_BUILD=0",
"-DDEVICELIBS_ROOT={0}".format(devlibs_src), f"-DDEVICELIBS_ROOT={devlibs_src}",
"-DOPENMP_TEST_C_COMPILER={0}/clang".format(bin_dir), f"-DOPENMP_TEST_C_COMPILER={bin_dir}/clang",
"-DOPENMP_TEST_CXX_COMPILER={0}/clang++".format(bin_dir), f"-DOPENMP_TEST_CXX_COMPILER={bin_dir}/clang++",
"-DCMAKE_C_COMPILER={0}/clang".format(bin_dir), f"-DCMAKE_C_COMPILER={bin_dir}/clang",
"-DCMAKE_CXX_COMPILER={0}/clang++".format(bin_dir), f"-DCMAKE_CXX_COMPILER={bin_dir}/clang++",
"-DLIBOMPTARGET_AMDGCN_GFXLIST={0}".format(gfx_list), f"-DLIBOMPTARGET_AMDGCN_GFXLIST={gfx_list}",
"-DLIBOMP_COPY_EXPORTS=OFF", "-DLIBOMP_COPY_EXPORTS=OFF",
"-DHSA_LIB={0}/lib".format(hsa_prefix), f"-DHSA_LIB={hsa_prefix}/lib",
"-DCOMGR_INCLUDE={0}/include".format(comgr_prefix), f"-DCOMGR_INCLUDE={comgr_prefix}/include",
"-DCOMGR_LIB={0}/lib".format(comgr_prefix), f"-DCOMGR_LIB={comgr_prefix}/lib",
"-DOPENMP_ENABLE_LIBOMPTARGET=1", "-DOPENMP_ENABLE_LIBOMPTARGET=1",
"-DOPENMP_ENABLE_LIBOMPTARGET_HSA=1", "-DOPENMP_ENABLE_LIBOMPTARGET_HSA=1",
"-DLLVM_MAIN_INCLUDE_DIR={0}{1}".format(src, llvm_inc), f"-DLLVM_MAIN_INCLUDE_DIR={src}{llvm_inc}",
"-DLLVM_INSTALL_PREFIX={0}".format(llvm_prefix), f"-DLLVM_INSTALL_PREFIX={llvm_prefix}",
"-DCMAKE_C_FLAGS=-isystem{0} -I{1}".format(elfutils_inc, ffi_inc), f"-DCMAKE_C_FLAGS=-isystem{elfutils_inc} -I{ffi_inc}",
"-DCMAKE_CXX_FLAGS=-isystem{0} -I{1}".format(elfutils_inc, ffi_inc), f"-DCMAKE_CXX_FLAGS=-isystem{elfutils_inc} -I{ffi_inc}",
"-DNEW_BC_PATH=1", "-DNEW_BC_PATH=1",
"-DHSA_INCLUDE={0}/include/hsa".format(hsa_prefix), f"-DHSA_INCLUDE={hsa_prefix}/include/hsa",
"-DLIBOMPTARGET_ENABLE_DEBUG=ON", "-DLIBOMPTARGET_ENABLE_DEBUG=ON",
] ]
if self.spec.satisfies("@5.7:6.1"): if self.spec.satisfies("@5.7:6.1"):
openmp_common_args += [ openmp_common_args += [
"-DLIBDRM_LIB={0}/lib".format(libdrm_prefix), f"-DLIBDRM_LIB={libdrm_prefix}/lib",
"-DHSAKMT_INC_PATH={0}/include".format(hsakmt_prefix), f"-DHSAKMT_INC_PATH={hsakmt_prefix}/include",
"-DNUMACTL_DIR={0}".format(numactl_prefix), f"-DNUMACTL_DIR={numactl_prefix}",
] ]
if self.spec.satisfies("@:6.2"): if self.spec.satisfies("@:6.2"):
openmp_common_args += [ openmp_common_args += [
"-DHSAKMT_LIB={0}/lib".format(hsakmt_prefix), f"-DHSAKMT_LIB={hsakmt_prefix}/lib",
"-DHSAKMT_LIB64={0}/lib64".format(hsakmt_prefix), f"-DHSAKMT_LIB64={hsakmt_prefix}/lib64",
] ]
if self.spec.satisfies("+asan"): if self.spec.satisfies("+asan"):
openmp_common_args += [ openmp_common_args += [
@ -626,15 +621,15 @@ def install(self, spec, prefix):
# Shared cmake configuration for pgmath, flang, flang-runtime # Shared cmake configuration for pgmath, flang, flang-runtime
flang_common_args = [ flang_common_args = [
"-DLLVM_ENABLE_ASSERTIONS=ON", "-DLLVM_ENABLE_ASSERTIONS=ON",
"-DLLVM_CONFIG={0}/llvm-config".format(bin_dir), f"-DLLVM_CONFIG={bin_dir}/llvm-config",
"-DCMAKE_CXX_COMPILER={0}/clang++".format(bin_dir), f"-DCMAKE_CXX_COMPILER={bin_dir}/clang++",
"-DCMAKE_C_COMPILER={0}/clang".format(bin_dir), f"-DCMAKE_C_COMPILER={bin_dir}/clang",
"-DCMAKE_Fortran_COMPILER={0}/flang".format(bin_dir), f"-DCMAKE_Fortran_COMPILER={bin_dir}/flang",
"-DLLVM_TARGETS_TO_BUILD=AMDGPU;x86", "-DLLVM_TARGETS_TO_BUILD=AMDGPU;x86",
# Spack thinks some warnings from the flang build are errors. # Spack thinks some warnings from the flang build are errors.
# Disable those warnings in C and CXX flags. # Disable those warnings in C and CXX flags.
"-DCMAKE_CXX_FLAGS={0}".format(flang_warning) + " -I{0}{1}".format(src, libpgmath), f"-DCMAKE_CXX_FLAGS={flang_warning} -I{src}{libpgmath}",
"-DCMAKE_C_FLAGS={0}".format(flang_warning) + " -I{0}{1}".format(src, libpgmath), f"-DCMAKE_C_FLAGS={flang_warning} -I{src}{libpgmath}",
] ]
components["pgmath"] = ["../rocm-openmp-extras/flang/runtime/libpgmath"] components["pgmath"] = ["../rocm-openmp-extras/flang/runtime/libpgmath"]
@ -662,9 +657,9 @@ def install(self, spec, prefix):
] ]
components["flang-legacy"] = [ components["flang-legacy"] = [
"-DCMAKE_C_COMPILER={0}/clang".format(bin_dir), f"-DCMAKE_C_COMPILER={bin_dir}/clang",
"-DCMAKE_CXX_COMPILER={0}/clang++".format(bin_dir), f"-DCMAKE_CXX_COMPILER={bin_dir}/clang++",
"../rocm-openmp-extras/flang/flang-legacy/{0}".format(flang_legacy_version), f"../rocm-openmp-extras/flang/flang-legacy/{flang_legacy_version}",
] ]
flang_legacy_flags = [] flang_legacy_flags = []
@ -675,14 +670,10 @@ def install(self, spec, prefix):
): ):
flang_legacy_flags.append("-D_GLIBCXX_USE_CXX11_ABI=0") flang_legacy_flags.append("-D_GLIBCXX_USE_CXX11_ABI=0")
if self.spec.satisfies("@6.2:"): if self.spec.satisfies("@6.2:"):
flang_legacy_flags.append("-L{0}".format(ncurses_lib_dir)) flang_legacy_flags.append(f"-L{ncurses_lib_dir}")
flang_legacy_flags.append("-L{0}".format(zlib_lib_dir)) flang_legacy_flags.append(f"-L{zlib_lib_dir}")
components["flang-legacy-llvm"] += [ components["flang-legacy-llvm"] += [f"-DCMAKE_CXX_FLAGS={' '.join(flang_legacy_flags)}"]
"-DCMAKE_CXX_FLAGS={0}".format(" ".join(flang_legacy_flags)) components["flang-legacy"] += [f"-DCMAKE_CXX_FLAGS={' '.join(flang_legacy_flags)}"]
]
components["flang-legacy"] += [
"-DCMAKE_CXX_FLAGS={0}".format(" ".join(flang_legacy_flags))
]
components["flang"] = [ components["flang"] = [
"../rocm-openmp-extras/flang", "../rocm-openmp-extras/flang",
@ -696,7 +687,7 @@ def install(self, spec, prefix):
"../rocm-openmp-extras/flang", "../rocm-openmp-extras/flang",
"-DLLVM_INSTALL_RUNTIME=ON", "-DLLVM_INSTALL_RUNTIME=ON",
"-DFLANG_BUILD_RUNTIME=ON", "-DFLANG_BUILD_RUNTIME=ON",
"-DOPENMP_BUILD_DIR={0}/spack-build-openmp/runtime/src".format(src), f"-DOPENMP_BUILD_DIR={src}/spack-build-openmp/runtime/src",
] ]
components["flang-runtime"] += flang_common_args components["flang-runtime"] += flang_common_args
@ -715,7 +706,7 @@ def install(self, spec, prefix):
cmake_args = components[component] cmake_args = components[component]
cmake_args.extend(std_cmake_args) cmake_args.extend(std_cmake_args)
if component == "flang-legacy-llvm": if component == "flang-legacy-llvm":
with working_dir("spack-build-{0}/llvm-legacy".format(component), create=True): with working_dir(f"spack-build-{component}/llvm-legacy", create=True):
cmake_args.append("-DCMAKE_BUILD_TYPE=Release") cmake_args.append("-DCMAKE_BUILD_TYPE=Release")
cmake(*cmake_args) cmake(*cmake_args)
make() make()
@ -727,7 +718,7 @@ def install(self, spec, prefix):
make("install") make("install")
os.symlink(os.path.join(bin_dir, "clang"), os.path.join(omp_bin_dir, "clang")) os.symlink(os.path.join(bin_dir, "clang"), os.path.join(omp_bin_dir, "clang"))
else: else:
with working_dir("spack-build-{0}".format(component), create=True): with working_dir(f"spack-build-{component}", create=True):
# OpenMP build needs to be run twice(Release, Debug) # OpenMP build needs to be run twice(Release, Debug)
if component == "openmp-debug": if component == "openmp-debug":
cmake_args.append("-DCMAKE_BUILD_TYPE=Debug") cmake_args.append("-DCMAKE_BUILD_TYPE=Debug")

View File

@ -23,7 +23,7 @@ class Rrdtool(AutotoolsPackage):
depends_on("perl-extutils-makemaker") depends_on("perl-extutils-makemaker")
def configure_args(self): def configure_args(self):
return ["--with-systemdsystemunitdir=" + self.spec["rrdtool"].prefix.lib.systemd.system] return [f"--with-systemdsystemunitdir={self.prefix.lib.systemd.system}"]
def flag_handler(self, name, flags): def flag_handler(self, name, flags):
if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names: if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names:

View File

@ -49,5 +49,4 @@ def autoreconf(self, spec, prefix):
Executable("./autogen.sh")() Executable("./autogen.sh")()
def configure_args(self): def configure_args(self):
args = ["--with-systemdsystemunitdir=" + self.spec["rsyslog"].prefix.lib.systemd.system] return [f"--with-systemdsystemunitdir={self.prefix.lib.systemd.system}"]
return args

View File

@ -56,9 +56,9 @@ def setup_build_environment(self, env):
env.append_path("C_INCLUDE_PATH", self.spec["util-linux"].prefix.include.blkid) env.append_path("C_INCLUDE_PATH", self.spec["util-linux"].prefix.include.blkid)
def configure_args(self): def configure_args(self):
args = ["--with-systemd-unit-dir=" + self.spec["xfsprogs"].prefix.lib.systemd.system] args = [f"--with-systemd-unit-dir={self.prefix.lib.systemd.system}"]
if self.spec.satisfies("@6.5.0:"): if self.spec.satisfies("@6.5.0:"):
args.append("--with-udev-rule-dir=" + self.spec["xfsprogs"].prefix) args.append(f"--with-udev-rule-dir={self.prefix}")
return args return args
def install(self, spec, prefix): def install(self, spec, prefix):