git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
To: git@vger.kernel.org
Cc: "Patrick Steinhardt" <ps@pks.im>,
	"Đoàn Trần Công Danh" <congdanhqx@gmail.com>
Subject: [PATCH] meson: allow customize perl installation path
Date: Thu, 24 Apr 2025 22:16:18 +0700	[thread overview]
Message-ID: <80a2a6ce7c6b05323cf931cdc20d4decb6270002.1745507677.git.congdanhqx@gmail.com> (raw)

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


             reply	other threads:[~2025-04-24 15:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 15:16 Đoàn Trần Công Danh [this message]
2025-04-25  6:25 ` [PATCH] meson: allow customize perl installation path Patrick Steinhardt
2025-05-08  8:24 ` [PATCH v2] " Đoàn Trần Công Danh
2025-05-08 14:34   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80a2a6ce7c6b05323cf931cdc20d4decb6270002.1745507677.git.congdanhqx@gmail.com \
    --to=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).