{"action":"created","issue":{"url":"https://api.github.com/repos/mesonbuild/meson/issues/568","repository_url":"https://api.github.com/repos/mesonbuild/meson","labels_url":"https://api.github.com/repos/mesonbuild/meson/issues/568/labels{/name}","comments_url":"https://api.github.com/repos/mesonbuild/meson/issues/568/comments","events_url":"https://api.github.com/repos/mesonbuild/meson/issues/568/events","html_url":"https://github.com/mesonbuild/meson/issues/568","id":157348053,"number":568,"title":"Some dependencies are not checked correctly when version change","user":{"login":"arteymix","id":1318477,"avatar_url":"https://avatars.githubusercontent.com/u/1318477?v=3","gravatar_id":"","url":"https://api.github.com/users/arteymix","html_url":"https://github.com/arteymix","followers_url":"https://api.github.com/users/arteymix/followers","following_url":"https://api.github.com/users/arteymix/following{/other_user}","gists_url":"https://api.github.com/users/arteymix/gists{/gist_id}","starred_url":"https://api.github.com/users/arteymix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arteymix/subscriptions","organizations_url":"https://api.github.com/users/arteymix/orgs","repos_url":"https://api.github.com/users/arteymix/repos","events_url":"https://api.github.com/users/arteymix/events{/privacy}","received_events_url":"https://api.github.com/users/arteymix/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-05-28T17:10:23Z","updated_at":"2016-05-29T18:26:30Z","closed_at":"2016-05-29T00:17:35Z","body":"To enable some specific features, I check various version of the same library and issue preprocessor definitions. It seems like Meson only evaluate the first `dependency` and assume that all other are already satisfied.\r\n\r\nIn the following build definition, if the system satisfies `gio-2.0 (>=2.34)`, but not `gio-2.0 (>=2.44)`, the latter will be satisfied anyway, generating incorrect flags.\r\n\r\n```python\r\nvala_defines = []\r\n\r\n# provide 'GLib.ApplicationCommandLine.get_stdin'\r\nif dependency('gio-2.0', version: '>=2.34', required: false).found()\r\nvala_defines += '--define=GIO_2_34'\r\nendif\r\n\r\n# support parsing of CLI arguments\r\nif dependency('gio-2.0', version: '>=2.40', required: false).found()\r\nvala_defines += '--define=GIO_2_40'\r\nendif\r\n\r\n# provide 'OutputStream.write_all_async'\r\nif dependency('gio-2.0', version: '>=2.44', required: false).found()\r\nvala_defines += '--define=GIO_2_44'\r\nendif\r\n```\r\n\r\nHere's the Travis build that fail https://travis-ci.org/valum-framework/valum/builds/133612286\r\n\r\nIt corresponds to the following tree: https://github.com/valum-framework/valum/commit/c08cce5642bd7ce082ddd3a813238e248d4b0942"},"comment":{"url":"https://api.github.com/repos/mesonbuild/meson/issues/comments/222375153","html_url":"https://github.com/mesonbuild/meson/issues/568#issuecomment-222375153","issue_url":"https://api.github.com/repos/mesonbuild/meson/issues/568","id":222375153,"user":{"login":"arteymix","id":1318477,"avatar_url":"https://avatars.githubusercontent.com/u/1318477?v=3","gravatar_id":"","url":"https://api.github.com/users/arteymix","html_url":"https://github.com/arteymix","followers_url":"https://api.github.com/users/arteymix/followers","following_url":"https://api.github.com/users/arteymix/following{/other_user}","gists_url":"https://api.github.com/users/arteymix/gists{/gist_id}","starred_url":"https://api.github.com/users/arteymix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arteymix/subscriptions","organizations_url":"https://api.github.com/users/arteymix/orgs","repos_url":"https://api.github.com/users/arteymix/repos","events_url":"https://api.github.com/users/arteymix/events{/privacy}","received_events_url":"https://api.github.com/users/arteymix/received_events","type":"User","site_admin":false},"created_at":"2016-05-29T18:26:30Z","updated_at":"2016-05-29T18:26:30Z","body":"@nirbheek It would be essentially the same, but my example is broken and Meson does not seem to reevaluate `dependency` expressions when it's already satisfied.\r\n\r\nTo obtain the same behaviour, you have to repeat flags as follow:\r\n\r\n```\r\nvala_defines = []\r\n\r\n# provide 'OutputStream.write_all_async'\r\nif dependency('gio-2.0', version: '>=2.44', required: false).found()\r\n  vala_defines += ['--define=GIO_2_44', '--define=GIO_2_40', '--define=GIO_2_34']\r\n# support parsing of CLI arguments\r\nelif dependency('gio-2.0', version: '>=2.40', required: false).found()\r\n  vala_defines += ['--define=GIO_2_40', '--define=GIO_2_34']\r\n# provide 'GLib.ApplicationCommandLine.get_stdin'\r\nelif dependency('gio-2.0', version: '>=2.34', required: false).found()\r\n  vala_defines += ['--define=GIO_2_34']\r\nendif\r\n```"}}
{"actor":{"display_login":"arteymix"}}