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:
Massimiliano Culpo
2021-03-26 18:43:41 +01:00
committed by GitHub
parent 35c3a25ca6
commit d5fa509b07
4 changed files with 83 additions and 16 deletions

View File

@@ -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