gcc-runtime: fix case of only gfortran in macOS
This commit is contained in:
parent
ae1f39339b
commit
cc8447968e
@ -76,9 +76,8 @@ def install(self, spec, prefix):
|
|||||||
|
|
||||||
def _get_libraries_macho(self):
|
def _get_libraries_macho(self):
|
||||||
"""Same as _get_libraries_elf but for Mach-O binaries"""
|
"""Same as _get_libraries_elf but for Mach-O binaries"""
|
||||||
cc = Executable(self["gcc"].cc)
|
cc = self._get_compiler()
|
||||||
path_and_install_name = []
|
path_and_install_name = []
|
||||||
|
|
||||||
for name in self.LIBRARIES:
|
for name in self.LIBRARIES:
|
||||||
if name == "gcc_s":
|
if name == "gcc_s":
|
||||||
# On darwin, libgcc_s is versioned and can't be linked as -lgcc_s,
|
# On darwin, libgcc_s is versioned and can't be linked as -lgcc_s,
|
||||||
@ -116,6 +115,23 @@ def _get_libraries_macho(self):
|
|||||||
|
|
||||||
return path_and_install_name
|
return path_and_install_name
|
||||||
|
|
||||||
|
def _get_compiler(self):
|
||||||
|
gcc_pkg = self["gcc"]
|
||||||
|
exe_path = None
|
||||||
|
for attr_name in ("cc", "cxx", "fortran"):
|
||||||
|
try:
|
||||||
|
exe_path = getattr(gcc_pkg, attr_name)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if not exe_path:
|
||||||
|
continue
|
||||||
|
cc = Executable(exe_path)
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise InstallError(f"cannot find any compiler for {gcc_pkg.spec}")
|
||||||
|
return cc
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def libs(self):
|
def libs(self):
|
||||||
# Currently these libs are not linkable with -l, they all have a suffix.
|
# Currently these libs are not linkable with -l, they all have a suffix.
|
||||||
|
Loading…
Reference in New Issue
Block a user