Add shared/static variants to gmp and mpfr (#29836)

* Add shared/static variants to gmp and mpfr

* Update package.py

* Update package.py
This commit is contained in:
iarspider 2022-04-05 01:20:04 +02:00 committed by GitHub
parent b7eb4af98f
commit d64de54ebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -28,6 +28,11 @@ class Gmp(AutotoolsPackage, GNUMirrorPackage):
depends_on('libtool', type='build')
depends_on('m4', type='build')
variant('static', default=False, description='Build static library')
variant('shared', default=True, description='Build shared library')
conflicts('~shared', when='~static', msg='Please select at least one of +static or +shared')
# gmp's configure script seems to be broken; it sometimes misdetects
# shared library support. Regenerating it fixes the issue.
force_autoreconf = True
@ -43,4 +48,9 @@ def flag_handler(self, name, flags):
return (flags, None, None)
def configure_args(self):
return ['--enable-cxx']
args = ['--enable-cxx']
args.extend(self.enable_or_disable('static'))
args.extend(self.enable_or_disable('shared'))
if self.spec.satisfies('+static'):
args.append('--with-pic')
return args

View File

@ -34,6 +34,11 @@ class Mpfr(AutotoolsPackage, GNUMirrorPackage):
depends_on('autoconf-archive', when='@4.0.2:', type='build')
depends_on('texinfo', when='@4.1.0', type='build')
variant('static', default=False, description='Build static library')
variant('shared', default=True, description='Build shared library')
conflicts('~static', when='~shared', msg='Please select at least one of +static or +shared')
force_autoreconf = True
# Check the Bugs section of old release pages for patches.
@ -63,4 +68,8 @@ def configure_args(self):
args = [
'--with-gmp=' + self.spec['gmp'].prefix,
]
args.extend(self.enable_or_disable('static'))
args.extend(self.enable_or_disable('shared'))
if self.spec.satisfies('+static'):
args.append('--with-pic')
return args