clang: do xcode mockup iff requested by a package (#2544)

* clang: do xcode mockup iff requested by a package

* add a note

* add pkg to setup_custom_environment() and decide whether or not to use mockup XCode there based on the package
This commit is contained in:
Denis Davydov 2016-12-11 01:23:39 +01:00 committed by Todd Gamblin
parent b03881d1bb
commit 1570f90fde
5 changed files with 15 additions and 5 deletions

View File

@ -224,7 +224,7 @@ def set_compiler_environment_variables(pkg, env):
for mod in compiler.modules: for mod in compiler.modules:
load_module(mod) load_module(mod)
compiler.setup_custom_environment(env) compiler.setup_custom_environment(pkg, env)
return env return env

View File

@ -286,7 +286,7 @@ def _find_full_path(self, path):
""" """
return path return path
def setup_custom_environment(self, env): def setup_custom_environment(self, pkg, env):
"""Set any environment variables necessary to use the compiler.""" """Set any environment variables necessary to use the compiler."""
pass pass

View File

@ -148,7 +148,7 @@ def fc_version(cls, fc):
def f77_version(cls, f77): def f77_version(cls, f77):
return cls.fc_version(f77) return cls.fc_version(f77)
def setup_custom_environment(self, env): def setup_custom_environment(self, pkg, env):
"""Set the DEVELOPER_DIR environment for the Xcode toolchain. """Set the DEVELOPER_DIR environment for the Xcode toolchain.
On macOS, not all buildsystems support querying CC and CXX for the On macOS, not all buildsystems support querying CC and CXX for the
@ -160,9 +160,13 @@ def setup_custom_environment(self, env):
the 'DEVELOPER_DIR' environment variables to cause the xcrun and the 'DEVELOPER_DIR' environment variables to cause the xcrun and
related tools to use this Xcode.app. related tools to use this Xcode.app.
""" """
super(Clang, self).setup_custom_environment(env) super(Clang, self).setup_custom_environment(pkg, env)
if not self.is_apple: if not self.is_apple or not pkg.use_xcode:
# if we do it for all packages, we get into big troubles with MPI:
# filter_compilers(self) will use mockup XCode compilers on macOS
# with Clang. Those point to Spack's compiler wrappers and
# consequently render MPI non-functional outside of Spack.
return return
xcode_select = Executable('xcode-select') xcode_select = Executable('xcode-select')

View File

@ -487,6 +487,10 @@ class SomePackage(Package):
"""By default do not run tests within package's install()""" """By default do not run tests within package's install()"""
run_tests = False run_tests = False
# FIXME: this is a bad object-oriented design, should be moved to Clang.
"""By default do not setup mockup XCode on macOS with Clang"""
use_xcode = False
"""Most packages are NOT extendable. Set to True if you want extensions.""" """Most packages are NOT extendable. Set to True if you want extensions."""
extendable = False extendable = False

View File

@ -92,6 +92,8 @@ class Qt(Package):
# depends_on("flac", when='+multimedia') # depends_on("flac", when='+multimedia')
# depends_on("ogg", when='+multimedia') # depends_on("ogg", when='+multimedia')
use_xcode = True
def url_for_version(self, version): def url_for_version(self, version):
# URL keeps getting more complicated with every release # URL keeps getting more complicated with every release
url = self.list_url url = self.list_url