meson: allow unconstrained dependency version to be "unknown"

And allow for compound version constraints in the future.
This commit is contained in:
Oleg Oshmyan 2021-11-11 02:02:35 +02:00 committed by Ryan Lucia
parent 18503946d5
commit 1d01f8adc8
1 changed files with 9 additions and 10 deletions

View File

@ -182,29 +182,28 @@ deps += dependency('icu-i18n', version: '>=4.8.1.1')
dep_avail = []
foreach dep: [
# audio, in order of precedence
['libpulse', '', 'PulseAudio', []],
['alsa', '', 'ALSA', []],
['portaudio-2.0', '', 'PortAudio', []],
['libpulse', [], 'PulseAudio', []],
['alsa', [], 'ALSA', []],
['portaudio-2.0', [], 'PortAudio', []],
['openal', '>=0.0.8', 'OpenAL', []],
# video
['ffms2', '>=2.22', 'FFMS2', ['ffms2', 'ffms2_dep']],
# other
['fftw3', '', 'FFTW3', []],
['hunspell', '', 'Hunspell', ['hunspell', 'hunspell_dep']],
['uchardet', '', 'uchardet', ['uchardet', 'uchardet_dep']],
['fftw3', [], 'FFTW3', []],
['hunspell', [], 'Hunspell', ['hunspell', 'hunspell_dep']],
['uchardet', [], 'uchardet', ['uchardet', 'uchardet_dep']],
]
optname = dep[0].split('-')[0]
if not get_option(optname).disabled()
dep_version = dep[1] != '' ? dep[1] : '>=0'
# [provide] section is ignored if required is false;
# must provided define fallback explicitly
# (with meson 0.56 you can do allow_fallback: true):
#d = dependency(dep[0], version: dep_version,
#d = dependency(dep[0], version: dep[1],
# required: false, allow_fallback: true)
if dep[3].length() > 0
d = dependency(dep[0], version: dep_version, fallback: dep[3])
d = dependency(dep[0], version: dep[1], fallback: dep[3])
else
d = dependency(dep[0], version: dep_version, required: false)
d = dependency(dep[0], version: dep[1], required: false)
endif
if d.found()