Re: [RFC PATCH v2 24/24] Introduce support for the Meson build system
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 14, 2024, 05:20 UTC
- Message-ID
- <ZwyqEPEmZ4gXi02I@pks.im>
- In-Reply-To
- <e4c99594-08a1-4b5d-b862-bf51efae410e@gentoo.org>
On Sun, Oct 13, 2024 at 10:07:10PM -0400, Eli Schwartz wrote:
Show 19 quoted lines
> On 10/9/24 10:57 AM, Patrick Steinhardt wrote:
> > +script_environment = environment()
> > +foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
> > + program = find_program(tool)
> > + script_environment.prepend('PATH', fs.parent(program.full_path()))
> > +endforeach
> > +
> > +libgit_sources += custom_target(
> > + 'command-list.h',
> > + input: 'command-list.txt',
> > + output: 'command-list.h',
> > + command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
> > + env: script_environment,
> > +)
>
>
> Maybe I am missing something about the necessity of this setting up of
> PATH? Should these programs not already be on PATH -- how does meson
> find them?It is required when generating the project file in one environment so that it can be used in another one. E.g. when using MinGW64 to generate the Visual Studio solution, where the tools are not in PATH anymore.
Show 19 quoted lines
> > +zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
> > +if zlib.type_name() != 'internal' and not compiler.has_function('deflateBound',
> > + prefix: '#include <zlib.h>',
> > + dependencies: zlib,
> > +)
> > + libgit_c_args += '-DNO_DEFLATE_BOUND'
> > +endif
>
>
> Probably should have mentioned this earlier on, but.
>
> What about
>
> if zlib.version().version_compare('>=1.2.0')
> libgit_c_args += '-DNO_DEFLATE_BOUND'
> endif
>
>
> since that is when that function was added.Arguably we can also just declare a minimum required zlib version nowadays. v1.2.0 has been released in 2011, more than a decade ago. But in any case, your version is certainly cleaner, thanks!
Patrick