clingo: modify recipe for bootstrapping (#22354)
* clingo: modify recipe for bootstrapping Modifications: - clingo builds with shared Python only if ^python+shared - avoid building the clingo app for bootstrapping - don't link to libpython when bootstrapping * Remove option that breaks on linux * Give more hints for the current Python * Disable CLINGO_BUILD_PY_SHARED for bootstrapping * bootstrapping: try to detect the current python from std library This is much faster than calling external executables * Fix compatibility with Python 2.6 * Give hints on which compiler and OS to use when bootstrapping This change hints which compiler to use for bootstrapping clingo (either GCC or Apple Clang on MacOS). On Cray platforms it also hints to build for the frontend system, where software is meant to be installed. * Use spec_for_current_python to constrain module requirement
This commit is contained in:

committed by
GitHub

parent
35c3a25ca6
commit
d5fa509b07
@@ -9,6 +9,9 @@
|
||||
|
||||
class ClingoBootstrap(Clingo):
|
||||
"""Clingo with some options used for bootstrapping"""
|
||||
|
||||
maintainers = ['alalazo']
|
||||
|
||||
variant('build_type', default='Release', values=('Release',),
|
||||
description='CMake build type')
|
||||
|
||||
@@ -41,6 +44,18 @@ class ClingoBootstrap(Clingo):
|
||||
# Clingo needs the Python module to be usable by Spack
|
||||
conflicts('~python', msg='Python support is required to bootstrap Spack')
|
||||
|
||||
@property
|
||||
def cmake_py_shared(self):
|
||||
return self.define('CLINGO_BUILD_PY_SHARED', 'OFF')
|
||||
|
||||
def cmake_args(self):
|
||||
args = super(ClingoBootstrap, self).cmake_args()
|
||||
args.extend([
|
||||
# Avoid building the clingo executable
|
||||
self.define('CLINGO_BUILD_APPS', 'OFF'),
|
||||
])
|
||||
return args
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
if '%apple-clang platform=darwin' in self.spec:
|
||||
opts = '-mmacosx-version-min=10.13'
|
||||
|
@@ -21,7 +21,7 @@ class Clingo(CMakePackage):
|
||||
url = "https://github.com/potassco/clingo/archive/v5.2.2.tar.gz"
|
||||
git = 'https://github.com/potassco/clingo.git'
|
||||
|
||||
maintainers = ["tgamblin"]
|
||||
maintainers = ["tgamblin", "alalazo"]
|
||||
|
||||
version('master', branch='master', submodules=True, preferred=True)
|
||||
version('spack', commit='2a025667090d71b2c9dce60fe924feb6bde8f667', submodules=True)
|
||||
@@ -56,10 +56,17 @@ def cmake_python_hints(self):
|
||||
"""Return standard CMake defines to ensure that the
|
||||
current spec is the one found by CMake find_package(Python, ...)
|
||||
"""
|
||||
python_spec = self.spec['python']
|
||||
include_dir = python_spec.package.get_python_inc()
|
||||
return [
|
||||
'-DPython_EXECUTABLE={0}'.format(str(self.spec['python'].command))
|
||||
self.define('Python_EXECUTABLE', str(python_spec.command)),
|
||||
self.define('Python_INCLUDE_DIR', include_dir)
|
||||
]
|
||||
|
||||
@property
|
||||
def cmake_py_shared(self):
|
||||
return self.define('CLINGO_BUILD_PY_SHARED', 'ON')
|
||||
|
||||
def cmake_args(self):
|
||||
try:
|
||||
self.compiler.cxx14_flag
|
||||
@@ -69,10 +76,10 @@ def cmake_args(self):
|
||||
args = [
|
||||
'-DCLINGO_REQUIRE_PYTHON=ON',
|
||||
'-DCLINGO_BUILD_WITH_PYTHON=ON',
|
||||
'-DCLINGO_BUILD_PY_SHARED=ON',
|
||||
'-DPYCLINGO_USER_INSTALL=OFF',
|
||||
'-DPYCLINGO_USE_INSTALL_PREFIX=ON',
|
||||
'-DCLINGO_BUILD_WITH_LUA=OFF'
|
||||
'-DCLINGO_BUILD_WITH_LUA=OFF',
|
||||
self.cmake_py_shared
|
||||
]
|
||||
if self.spec['cmake'].satisfies('@3.16.0:'):
|
||||
args += self.cmake_python_hints
|
||||
|
Reference in New Issue
Block a user