Skip to content

Commit 7d549fe

Browse files
pks-tgitster
authored andcommitted
meson: skip gitweb build when Perl is disabled
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 <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 904339e commit 7d549fe

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

meson.build

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ endif
740740
# features. It is optional if you want to neither execute tests nor use any of
741741
# these optional features.
742742
perl_required = get_option('perl')
743-
if get_option('tests')
743+
if get_option('tests') or get_option('gitweb').enabled()
744744
perl_required = true
745745
endif
746746

@@ -1874,7 +1874,15 @@ if intl.found()
18741874
subdir('po')
18751875
endif
18761876
subdir('contrib')
1877-
subdir('gitweb')
1877+
1878+
# Gitweb requires Perl, so we disable the auto-feature if Perl was not found.
1879+
# We make sure further up that Perl is required in case the gitweb option is
1880+
# enabled.
1881+
gitweb_option = get_option('gitweb').disable_auto_if(not perl.found())
1882+
if gitweb_option.enabled()
1883+
subdir('gitweb')
1884+
endif
1885+
18781886
subdir('templates')
18791887

18801888
# Everything but the bin-wrappers need to come before this target such that we
@@ -1893,6 +1901,7 @@ summary({
18931901
'curl': curl.found(),
18941902
'expat': expat.found(),
18951903
'gettext': intl.found(),
1904+
'gitweb': gitweb_option.enabled(),
18961905
'https': https_backend,
18971906
'iconv': iconv.found(),
18981907
'pcre2': pcre2.found(),

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ option('expat', type: 'feature', value: 'enabled',
2323
description: 'Build helpers used to push to remotes with the HTTP transport.')
2424
option('gettext', type: 'feature', value: 'auto',
2525
description: 'Build translation files.')
26+
option('gitweb', type: 'feature', value: 'auto',
27+
description: 'Build Git web interface. Requires Perl.')
2628
option('iconv', type: 'feature', value: 'auto',
2729
description: 'Support reencoding strings with different encodings.')
2830
option('pcre2', type: 'feature', value: 'enabled',

0 commit comments

Comments
 (0)