meson dependency question
jim at chaseandscout.com
Sat Apr 9 00:30:00 UTC 2022
> Message: 2
> Date: Fri, 8 Apr 2022 09:59:17 +0530
> From: Nirbheek Chauhan <nirbheek.chauhan at gmail.com>
> To: Discussion of the development of and with GStreamer
> <gstreamer-devel at lists.freedesktop.org>
> Cc: jim <jim at chaseandscout.com>
> Subject: Re: meson dependency question
> <CADqQcK6bczT8eA9vz0rFSiOBkzA=JxizzjFEzhFM4GqahL6qsg at mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
> On Fri, Apr 8, 2022 at 7:15 AM jim via gstreamer-devel
> <gstreamer-devel at lists.freedesktop.org> wrote:
>> But I'd prefer to put that option into a file so that a developer doesn't have to know about it.
>> I thought I could edit './subprojects/gst-plugins-bad/sys/uvch264/meson.build' as follows:
>> glib_dep = dependency('glib-2.0', version : '>=2.70', required : get_option('uvch264'), fallback : 'glib')
> This won't work because meson will pick glib based on the requirement
> of the *first* dependency() call. It can't "backtrack" and
> re-interpret previously-interpreted meson.build files.
> So you need to add this inside the root meson.build file of the
> monorepo, before the gstreamer subprojects are invoked:
> dependency('glib-2.0', version: '>=2.70', fallback: 'glib')
Yes, this did the trick. Thanks! Makes sense somewhat, but it's unfortunate that a subproject can't override that. It seems logical (to me) that if one pulled in a new subproject that required a (newer) version of a package (that was already included by the main, or other siubproject), only the new subproject should need to control that. That way, if the new subproject got removed later, the dependency would go with it as well.
More information about the gstreamer-devel