MesonPackage: make "default_library" a multi-valued variant (#23540)
Currently if one package does `depends_on('pkg default_library=shared')` and another does `depends_on('pkg default_library=both')`, you'd get a concretization error. With this PR one package can do `depends_on('pkg default_library=shared')` and another depends_on('default_library=static'), and it would concretize to `pkg default_library=shared,static` Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
parent
6d29f0d61f
commit
56e7e2a406
@ -55,9 +55,8 @@ class MesonPackage(PackageBase):
|
|||||||
variant('buildtype', default='debugoptimized',
|
variant('buildtype', default='debugoptimized',
|
||||||
description='Meson build type',
|
description='Meson build type',
|
||||||
values=('plain', 'debug', 'debugoptimized', 'release', 'minsize'))
|
values=('plain', 'debug', 'debugoptimized', 'release', 'minsize'))
|
||||||
variant('default_library', default='shared',
|
variant('default_library', default='shared', values=('shared', 'static'),
|
||||||
description=' Default library type',
|
multi=True, description='Build shared libs, static libs or both')
|
||||||
values=('shared', 'static', 'both'))
|
|
||||||
variant('strip', default=False, description='Strip targets on install')
|
variant('strip', default=False, description='Strip targets on install')
|
||||||
|
|
||||||
depends_on('meson', type='build')
|
depends_on('meson', type='build')
|
||||||
@ -102,9 +101,11 @@ def _std_args(pkg):
|
|||||||
|
|
||||||
strip = 'true' if '+strip' in pkg.spec else 'false'
|
strip = 'true' if '+strip' in pkg.spec else 'false'
|
||||||
|
|
||||||
try:
|
if 'libs=static,shared' in pkg.spec:
|
||||||
default_library = pkg.spec.variants['default_library'].value
|
default_library = 'both'
|
||||||
except KeyError:
|
elif 'libs=static' in pkg.spec:
|
||||||
|
default_library = 'static'
|
||||||
|
else:
|
||||||
default_library = 'shared'
|
default_library = 'shared'
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
|
@ -68,12 +68,10 @@ def meson(self, spec, prefix):
|
|||||||
"INIT_D_PATH={0}".format(self.prefix.etc),
|
"INIT_D_PATH={0}".format(self.prefix.etc),
|
||||||
]
|
]
|
||||||
|
|
||||||
if 'default_library=shared' in self.spec:
|
args.append('--enable-static' if 'libs=static' in self.spec
|
||||||
args.extend(['--enable-shared', '--disable-static'])
|
else '--disable-static')
|
||||||
elif 'default_library=static' in self.spec:
|
args.append('--enable-shared' if 'libs=shared' in self.spec
|
||||||
args.extend(['--disable-shared', '--enable-static'])
|
else '--disable-shared')
|
||||||
else:
|
|
||||||
args.extend(['--enable-shared', '--enable-static'])
|
|
||||||
|
|
||||||
configure(*args)
|
configure(*args)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user