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

Re: [PATCH] meson: skip gitweb build when Perl is disabled

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 20, 2024, 15:03 UTC
Message-ID
<xmqq4j2ygzwk.fsf@gitster.g>
In-Reply-To
<20241220-b4-pks-meson-fix-gitweb-wo-perl-v1-1-41039ad8d8d4@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 28 quoted lines
> It is possible to configure a Git build without Perl when disabling both
> our test suite and all Perl-based features. In Meson, this can be
> achieved with `meson setup -Dperl=disabled -Dtests=false`.
>
> It was reported by a user that this breaks the Meson build because
> gitweb gets built even if Perl was not discovered in such a build:
>
>     $ meson setup .. -Dtests=false -Dperl=disabled
>     ...
>     ../gitweb/meson.build:2:43: ERROR: Unable to get the path of a not-found external program
>
> Fix this issue by introducing a new feature-option that allows the user
> to configure whether or not to build Gitweb. The feature is set to
> 'auto' by default and will be disabled automatically in case Perl was
> not found on the system.
>
> Reported-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> Hi,
>
> I received an off-list mail from a user interested in the new Meson
> build system who has done a bit of testing of it on FreeBSD. They found
> an issue when configuring the build without Perl enabled, which can be
> achieved by both disabling tests and Perl-based features. This patch
> here fixes the issue.
>
> Thanks!
Thanks, Patrick and Daniel.
> -if get_option('tests')
> +if get_option('tests') or get_option('gitweb').enabled()
>    perl_required = true
>  endif

OK, so we use "perl_required" to keep track of the fact that something else wants Perl to be usable.

> +# Gitweb requires Perl, so we disable the auto-feature if Perl was not found.
> +# We make sure further up that Perl is required in case the gitweb option is
> +# enabled.
> +gitweb_option = get_option('gitweb').disable_auto_if(not perl.found())

Hopefully before we reach this point, we would have figured out if perl is avialable, to allow us do this.

There seem to be too many "perl" related variables, interaction among which smells way too complex for their worth. For example,

    perl = find_program('perl', ..., required: perl_required);
    perl_features_enabled = perl.found() and get_option('perl').allowed()

and only when the latter is true, we'd do further configuration to make perl usable. Does that mean the condition you wrote above to automatically disable gitweb somewhat incorrect? Even if we may have found perl, the builder may deliberately have disallowed use of it, in which case we just know perl is there without figuring out what other things (like where the localedir is) that are needed to use it correctly.

Show 5 quoted lines
> +if gitweb_option.enabled()
> +  subdir('gitweb')
> +endif
> +
>  subdir('templates')

OK, we used to do the subdir() thing unconditionally, but now, if we decide that we shouldn't or cannot do gitweb, we do not do that,which sounds good.

> +option('gitweb', type: 'feature', value: 'auto',
> +  description: 'Build Git web interface. Required Perl.')

I do not know the convention in the meson world, but to me, this would sound more natural with "Required" -> "Requires".

Show 7 quoted lines
>  option('iconv', type: 'feature', value: 'auto',
>    description: 'Support reencoding strings with different encodings.')
>  option('pcre2', type: 'feature', value: 'enabled',
>
> ---
> base-commit: d882f382b3d939d90cfa58d17b17802338f05d66
> change-id: 20241218-b4-pks-meson-fix-gitweb-wo-perl-93379dd0ceed
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 2 of 5 in “meson: skip gitweb build when Perl is disabled”
  1. meson: skip gitweb build when Perl is disabledPatrick Steinhardt, Dec 20, 2024
  2. Junio C HamanoDec 20, 2024
  3. Patrick SteinhardtDec 20, 2024
  4. Junio C HamanoDec 20, 2024
  5. meson: skip gitweb build when Perl is disabledPatrick Steinhardt, Dec 20, 2024

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.