git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 03/12] meson.build: only set build variables for non-default values

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 19, 2025, 13:36 UTC
Message-ID
<Z9rIQlUtutWPiPgD@pks.im>
In-Reply-To
<5d0112ae-98b5-46f2-91ad-35ed11358c3e@ramsayjones.plus.com>
On Sat, Mar 15, 2025 at 02:46:59AM +0000, Ramsay Jones wrote:
Show 11 quoted lines
> 
> Some preprocessor -Defines have defaults sets in the source code when
> they have not been provided to the C compiler. In this case, there is
> no need to pass them on the command-line, unless the build requires a
> non-standard value.
> 
> The build variables for DEFAULT_EDITOR, DEFAULT_HELP_FORMAT along with
> DEFAULT_PAGER have appropriate defaults ('vi', 'man' and 'less') set in
> the code. Add the preprocessor -Defines to the 'libgit_c_args' only if
> the values set with the corresponding 'options' are different to these
> standard values.

Hm. Does this really change anything though? The behaviour before and after this patch are exactly the same as far as I understand, and by explicitly handling the defaults we basically have to hard-code more assumptions. So in the current form I don't see that this patch adds much.

What we _could_ be doing is to completely drop the default values in "meson_options.txt". In that case we could instead compare whether we saw the empty string, which allows us to stop encoding the default vaule both in "meson_options.txt" and in "editor.c".

Patrick
Previous: Ramsay JonesNext: Ramsay Jones
Message 2 of 4 in “meson.build: only set build variables for non-default values”
  1. 03/12 meson.build: only set build variables for non-default valuesRamsay Jones, Mar 15, 2025
  2. Patrick SteinhardtMar 19, 2025
  3. Ramsay JonesMar 20, 2025
  4. Patrick SteinhardtMar 20, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.