clingo-bootstrap: add a variant for static libstdc++ (#26421)

This commit is contained in:
Massimiliano Culpo 2021-10-02 14:53:24 +02:00 committed by GitHub
parent b3d3ce1c37
commit 0e469fc01e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,9 @@ class ClingoBootstrap(Clingo):
variant('build_type', default='Release', values=('Release',),
description='CMake build type')
variant('static_libstdcpp', default=False,
description='Require a static version of libstdc++')
# CMake at version 3.16.0 or higher has the possibility to force the
# Python interpreter, which is crucial to build against external Python
# in environment where more than one interpreter is in the same prefix
@ -56,14 +59,17 @@ def cmake_args(self):
return args
def setup_build_environment(self, env):
opts = None
if '%apple-clang platform=darwin' in self.spec:
opts = '-mmacosx-version-min=10.13'
elif '%gcc' in self.spec:
if '+static_libstdcpp' in self.spec:
# This is either linux or cray
opts = '-static-libstdc++ -static-libgcc -Wl,--exclude-libs,ALL'
else:
msg = 'unexpected compiler for spec "{0}"'.format(self.spec)
raise RuntimeError(msg)
if opts:
env.set('CXXFLAGS', opts)
env.set('LDFLAGS', opts)