git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] meson: allow customize perl installation path
@ 2025-04-24 15:16 Đoàn Trần Công Danh
  2025-04-25  6:25 ` Patrick Steinhardt
  2025-05-08  8:24 ` [PATCH v2] " Đoàn Trần Công Danh
  0 siblings, 2 replies; 4+ messages in thread
From: Đoàn Trần Công Danh @ 2025-04-24 15:16 UTC (permalink / raw)
  To: git; +Cc: Patrick Steinhardt, Đoàn Trần Công Danh

Some distros, notably Fedora, want to install non-core Perl libraries
into specific directory, namely /usr/share/perl5/vendor_perl.

The Makefile build system allows this by overriding perllibdir variable,
let's make meson works on par with our Makefile.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 meson.build                        | 9 +++++++--
 meson_options.txt                  | 5 +++++
 perl/FromCPAN/Mail/meson.build     | 2 +-
 perl/FromCPAN/meson.build          | 2 +-
 perl/Git/LoadCPAN/Mail/meson.build | 2 +-
 perl/Git/LoadCPAN/meson.build      | 2 +-
 perl/Git/SVN/Memoize/meson.build   | 2 +-
 perl/Git/SVN/meson.build           | 2 +-
 perl/Git/meson.build               | 2 +-
 perl/meson.build                   | 2 +-
 10 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/meson.build b/meson.build
index 223384b130b62..830deb9a069a6 100644
--- a/meson.build
+++ b/meson.build
@@ -1826,14 +1826,19 @@ if perl_features_enabled
     perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
   endif
 
+  perllibdir = get_option('perllibdir')
+  if perllibdir == ''
+    perllibdir = get_option('datadir') / 'perl5'
+  endif
+
   perl_header = configure_file(
     input: perl_header_template,
     output: 'GIT-PERL-HEADER',
     configuration: {
       'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
-      'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+      'PERLLIBDIR_REL': perllibdir,
       'LOCALEDIR_REL': get_option('datadir') / 'locale',
-      'INSTLIBDIR': get_option('datadir') / 'perl5',
+      'INSTLIBDIR': perllibdir,
       'PATHSEP': pathsep,
     },
   )
diff --git a/meson_options.txt b/meson_options.txt
index 78d172a74019a..43f3f2d234a8e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,8 @@
+# Configuration for Git installation
+
+option('perllibdir', type: 'string', value: '',
+  description: 'Directory to install perl lib to. Default to <datadir>/perl5')
+
 # Configuration for how Git behaves at runtime.
 option('default_pager', type: 'string', value: 'less',
   description: 'Fall-back pager.')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
index b4ff2fc0b24c9..467507c5e690e 100644
--- a/perl/FromCPAN/Mail/meson.build
+++ b/perl/FromCPAN/Mail/meson.build
@@ -3,6 +3,6 @@ test_dependencies += custom_target(
   output: 'Address.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail',
+  install_dir: perllibdir / 'FromCPAN/Mail',
   depends: [git_version_file],
 )
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
index 1f9ea6ce8e844..720c60283d89b 100644
--- a/perl/FromCPAN/meson.build
+++ b/perl/FromCPAN/meson.build
@@ -3,7 +3,7 @@ test_dependencies += custom_target(
   output: 'Error.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/FromCPAN',
+  install_dir: perllibdir / 'FromCPAN',
   depends: [git_version_file],
 )
 
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
index 89cde56be8491..05a5770560d3d 100644
--- a/perl/Git/LoadCPAN/Mail/meson.build
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -3,6 +3,6 @@ test_dependencies += custom_target(
   output: 'Address.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail',
+  install_dir: perllibdir / 'Git/LoadCPAN/Mail',
   depends: [git_version_file],
 )
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
index 1ee915c650517..b975d4972631d 100644
--- a/perl/Git/LoadCPAN/meson.build
+++ b/perl/Git/LoadCPAN/meson.build
@@ -3,7 +3,7 @@ test_dependencies += custom_target(
   output: 'Error.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN',
+  install_dir: perllibdir / 'Git/LoadCPAN',
   depends: [git_version_file],
 )
 
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
index 233ec670d7de9..4c589b30c387a 100644
--- a/perl/Git/SVN/Memoize/meson.build
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -3,6 +3,6 @@ test_dependencies += custom_target(
   output: 'YAML.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/Git/SVN',
+  install_dir: perllibdir / 'Git/SVN',
   depends: [git_version_file],
 )
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
index 44abaf42b7cea..8858985fe8660 100644
--- a/perl/Git/SVN/meson.build
+++ b/perl/Git/SVN/meson.build
@@ -13,7 +13,7 @@ foreach source : [
     output: source,
     command: generate_perl_command,
     install: true,
-    install_dir: get_option('datadir') / 'perl5/Git/SVN',
+    install_dir: perllibdir / 'Git/SVN',
     depends: [git_version_file],
   )
 endforeach
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
index b21fa5591e7e7..a61b7b1f4abf2 100644
--- a/perl/Git/meson.build
+++ b/perl/Git/meson.build
@@ -10,7 +10,7 @@ foreach source : [
     output: source,
     command: generate_perl_command,
     install: true,
-    install_dir: get_option('datadir') / 'perl5/Git',
+    install_dir: perllibdir / 'Git',
     depends: [git_version_file],
   )
 endforeach
diff --git a/perl/meson.build b/perl/meson.build
index 2d4ab1c4a986f..3c66b007eaad9 100644
--- a/perl/meson.build
+++ b/perl/meson.build
@@ -3,7 +3,7 @@ test_dependencies += custom_target(
   output: 'Git.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5',
+  install_dir: perllibdir,
   depends: [git_version_file],
 )
 
-- 
2.49.0.395.g12beb8f557ceb


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] meson: allow customize perl installation path
  2025-04-24 15:16 [PATCH] meson: allow customize perl installation path Đoàn Trần Công Danh
@ 2025-04-25  6:25 ` Patrick Steinhardt
  2025-05-08  8:24 ` [PATCH v2] " Đoàn Trần Công Danh
  1 sibling, 0 replies; 4+ messages in thread
From: Patrick Steinhardt @ 2025-04-25  6:25 UTC (permalink / raw)
  To: Đoàn Trần Công Danh; +Cc: git

On Thu, Apr 24, 2025 at 10:16:18PM +0700, Đoàn Trần Công Danh wrote:
> diff --git a/meson.build b/meson.build
> index 223384b130b62..830deb9a069a6 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1826,14 +1826,19 @@ if perl_features_enabled
>      perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
>    endif
>  
> +  perllibdir = get_option('perllibdir')
> +  if perllibdir == ''
> +    perllibdir = get_option('datadir') / 'perl5'
> +  endif

Makes sense. We try to do the "right thing" by default, but let the
users override the location.

>    perl_header = configure_file(
>      input: perl_header_template,
>      output: 'GIT-PERL-HEADER',
>      configuration: {
>        'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
> -      'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
> +      'PERLLIBDIR_REL': perllibdir,
>        'LOCALEDIR_REL': get_option('datadir') / 'locale',
> -      'INSTLIBDIR': get_option('datadir') / 'perl5',
> +      'INSTLIBDIR': perllibdir,
>        'PATHSEP': pathsep,
>      },
>    )
> diff --git a/meson_options.txt b/meson_options.txt
> index 78d172a74019a..43f3f2d234a8e 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -1,3 +1,8 @@
> +# Configuration for Git installation
> +

Pedantic nit: let's drop this empty newline, we don't have it for any of
the other sections, either.

> +option('perllibdir', type: 'string', value: '',
> +  description: 'Directory to install perl lib to. Default to <datadir>/perl5')

s/perl lib/the Perl library/
s/Default/Defaults/

The remainder of this patch looks good to me, thanks!

Patrick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] meson: allow customize perl installation path
  2025-04-24 15:16 [PATCH] meson: allow customize perl installation path Đoàn Trần Công Danh
  2025-04-25  6:25 ` Patrick Steinhardt
@ 2025-05-08  8:24 ` Đoàn Trần Công Danh
  2025-05-08 14:34   ` Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Đoàn Trần Công Danh @ 2025-05-08  8:24 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh, Patrick Steinhardt

Some distros, notably Fedora, want to install non-core Perl libraries
into specific directory, namely /usr/share/perl5/vendor_perl.

The Makefile build system allows this by overriding perllibdir variable,
let's make meson works on par with our Makefile.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 meson.build                        | 9 +++++++--
 meson_options.txt                  | 4 ++++
 perl/FromCPAN/Mail/meson.build     | 2 +-
 perl/FromCPAN/meson.build          | 2 +-
 perl/Git/LoadCPAN/Mail/meson.build | 2 +-
 perl/Git/LoadCPAN/meson.build      | 2 +-
 perl/Git/SVN/Memoize/meson.build   | 2 +-
 perl/Git/SVN/meson.build           | 2 +-
 perl/Git/meson.build               | 2 +-
 perl/meson.build                   | 2 +-
 10 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/meson.build b/meson.build
index efe2871c9dba1..5155aa726b20e 100644
--- a/meson.build
+++ b/meson.build
@@ -1825,14 +1825,19 @@ if perl_features_enabled
     perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
   endif
 
+  perllibdir = get_option('perllibdir')
+  if perllibdir == ''
+    perllibdir = get_option('datadir') / 'perl5'
+  endif
+
   perl_header = configure_file(
     input: perl_header_template,
     output: 'GIT-PERL-HEADER',
     configuration: {
       'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
-      'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+      'PERLLIBDIR_REL': perllibdir,
       'LOCALEDIR_REL': get_option('datadir') / 'locale',
-      'INSTLIBDIR': get_option('datadir') / 'perl5',
+      'INSTLIBDIR': perllibdir,
       'PATHSEP': pathsep,
     },
   )
diff --git a/meson_options.txt b/meson_options.txt
index 78d172a74019a..cc19918a7ccfa 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,7 @@
+# Configuration for Git installation
+option('perllibdir', type: 'string', value: '',
+  description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')
+
 # Configuration for how Git behaves at runtime.
 option('default_pager', type: 'string', value: 'less',
   description: 'Fall-back pager.')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
index b4ff2fc0b24c9..467507c5e690e 100644
--- a/perl/FromCPAN/Mail/meson.build
+++ b/perl/FromCPAN/Mail/meson.build
@@ -3,6 +3,6 @@ test_dependencies += custom_target(
   output: 'Address.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail',
+  install_dir: perllibdir / 'FromCPAN/Mail',
   depends: [git_version_file],
 )
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
index 1f9ea6ce8e844..720c60283d89b 100644
--- a/perl/FromCPAN/meson.build
+++ b/perl/FromCPAN/meson.build
@@ -3,7 +3,7 @@ test_dependencies += custom_target(
   output: 'Error.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/FromCPAN',
+  install_dir: perllibdir / 'FromCPAN',
   depends: [git_version_file],
 )
 
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
index 89cde56be8491..05a5770560d3d 100644
--- a/perl/Git/LoadCPAN/Mail/meson.build
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -3,6 +3,6 @@ test_dependencies += custom_target(
   output: 'Address.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail',
+  install_dir: perllibdir / 'Git/LoadCPAN/Mail',
   depends: [git_version_file],
 )
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
index 1ee915c650517..b975d4972631d 100644
--- a/perl/Git/LoadCPAN/meson.build
+++ b/perl/Git/LoadCPAN/meson.build
@@ -3,7 +3,7 @@ test_dependencies += custom_target(
   output: 'Error.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN',
+  install_dir: perllibdir / 'Git/LoadCPAN',
   depends: [git_version_file],
 )
 
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
index 233ec670d7de9..4c589b30c387a 100644
--- a/perl/Git/SVN/Memoize/meson.build
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -3,6 +3,6 @@ test_dependencies += custom_target(
   output: 'YAML.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5/Git/SVN',
+  install_dir: perllibdir / 'Git/SVN',
   depends: [git_version_file],
 )
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
index 44abaf42b7cea..8858985fe8660 100644
--- a/perl/Git/SVN/meson.build
+++ b/perl/Git/SVN/meson.build
@@ -13,7 +13,7 @@ foreach source : [
     output: source,
     command: generate_perl_command,
     install: true,
-    install_dir: get_option('datadir') / 'perl5/Git/SVN',
+    install_dir: perllibdir / 'Git/SVN',
     depends: [git_version_file],
   )
 endforeach
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
index b21fa5591e7e7..a61b7b1f4abf2 100644
--- a/perl/Git/meson.build
+++ b/perl/Git/meson.build
@@ -10,7 +10,7 @@ foreach source : [
     output: source,
     command: generate_perl_command,
     install: true,
-    install_dir: get_option('datadir') / 'perl5/Git',
+    install_dir: perllibdir / 'Git',
     depends: [git_version_file],
   )
 endforeach
diff --git a/perl/meson.build b/perl/meson.build
index 2d4ab1c4a986f..3c66b007eaad9 100644
--- a/perl/meson.build
+++ b/perl/meson.build
@@ -3,7 +3,7 @@ test_dependencies += custom_target(
   output: 'Git.pm',
   command: generate_perl_command,
   install: true,
-  install_dir: get_option('datadir') / 'perl5',
+  install_dir: perllibdir,
   depends: [git_version_file],
 )
 

Range-diff against v1:
1:  14e38695adbd6 ! 1:  a9d431944b6d9 meson: allow customize perl installation path
    @@ meson.build: if perl_features_enabled
      ## meson_options.txt ##
     @@
     +# Configuration for Git installation
    -+
     +option('perllibdir', type: 'string', value: '',
    -+  description: 'Directory to install perl lib to. Default to <datadir>/perl5')
    ++  description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')
     +
      # Configuration for how Git behaves at runtime.
      option('default_pager', type: 'string', value: 'less',

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] meson: allow customize perl installation path
  2025-05-08  8:24 ` [PATCH v2] " Đoàn Trần Công Danh
@ 2025-05-08 14:34   ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2025-05-08 14:34 UTC (permalink / raw)
  To: Đoàn Trần Công Danh; +Cc: git, Patrick Steinhardt

Đoàn Trần Công Danh <congdanhqx@gmail.com> writes:

> Some distros, notably Fedora, want to install non-core Perl libraries
> into specific directory, namely /usr/share/perl5/vendor_perl.
>
> The Makefile build system allows this by overriding perllibdir variable,
> let's make meson works on par with our Makefile.
>
> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
> ---

Will queue.  The incremental since the previous iteration looks
exactly as Patrick suggested, which looks good to me, too.

Thanks.

> Range-diff against v1:
> 1:  14e38695adbd6 ! 1:  a9d431944b6d9 meson: allow customize perl installation path
>     @@ meson.build: if perl_features_enabled
>       ## meson_options.txt ##
>      @@
>      +# Configuration for Git installation
>     -+
>      +option('perllibdir', type: 'string', value: '',
>     -+  description: 'Directory to install perl lib to. Default to <datadir>/perl5')
>     ++  description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')
>      +
>       # Configuration for how Git behaves at runtime.
>       option('default_pager', type: 'string', value: 'less',

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-08 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 15:16 [PATCH] meson: allow customize perl installation path Đoàn Trần Công Danh
2025-04-25  6:25 ` Patrick Steinhardt
2025-05-08  8:24 ` [PATCH v2] " Đoàn Trần Công Danh
2025-05-08 14:34   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).