summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-03-26 18:43:41 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2021-05-22 11:51:20 -0700
commit18880a668b9cbf74d892f7c3ddb2de70497b3e62 (patch)
treece909aaf5a4ee8561d75736d7f5a7e82dd6cc1b7 /var
parente7494b627b7bfc033a944a3d024280eed9ca6c3c (diff)
downloadspack-18880a668b9cbf74d892f7c3ddb2de70497b3e62.tar.gz
spack-18880a668b9cbf74d892f7c3ddb2de70497b3e62.tar.bz2
spack-18880a668b9cbf74d892f7c3ddb2de70497b3e62.tar.xz
spack-18880a668b9cbf74d892f7c3ddb2de70497b3e62.zip
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 (cherry picked from commit d5fa509b072f0e58f00eaf81c60f32958a9f1e1d)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/clingo-bootstrap/package.py15
-rw-r--r--var/spack/repos/builtin/packages/clingo/package.py15
2 files changed, 26 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/clingo-bootstrap/package.py b/var/spack/repos/builtin/packages/clingo-bootstrap/package.py
index 014ba12927..aeef40c4e1 100644
--- a/var/spack/repos/builtin/packages/clingo-bootstrap/package.py
+++ b/var/spack/repos/builtin/packages/clingo-bootstrap/package.py
@@ -9,6 +9,9 @@ import spack.compilers
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'
diff --git a/var/spack/repos/builtin/packages/clingo/package.py b/var/spack/repos/builtin/packages/clingo/package.py
index 7f43f4708b..84f3c37c27 100644
--- a/var/spack/repos/builtin/packages/clingo/package.py
+++ b/var/spack/repos/builtin/packages/clingo/package.py
@@ -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 @@ class Clingo(CMakePackage):
"""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 @@ class Clingo(CMakePackage):
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