git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Dan Jacques <dnj@google.com>
Cc: git@vger.kernel.org, gitster@pobox.com, Johannes.Schindelin@gmx.de
Subject: Re: [PATCH v4 2/4] Makefile: add support for "perllibdir"
Date: Wed, 29 Nov 2017 21:04:47 +0100	[thread overview]
Message-ID: <87lgiovokg.fsf@evledraar.booking.com> (raw)
In-Reply-To: <20171129155637.89075-3-dnj@google.com>


On Wed, Nov 29 2017, Dan Jacques jotted:

> Add the "perllibdir" Makefile variable, which allows the customization
> of the Perl library installation path.
>
> The Perl library installation path is currently left entirely to the
> Perl Makefile implementation, either MakeMaker (default) or a fixed path
> when NO_PERL_MAKEMAKER is enabled. This patch introduces "perllibdir", a
> Makefile variable that can override that Perl module installation path.
>
> As with some other Makefile variables, "perllibdir" may be either
> absolute or relative. In the latter case, it is treated as relative to
> "$(prefix)".
>
> Add some incidental documentation to perl/Makefile.
>
> Explicitly specifying an installation path is necessary for Perl runtime
> prefix support, as runtime prefix resolution code must know in advance
> where the Perl support modules are installed.
>
> Signed-off-by: Dan Jacques <dnj@google.com>
> ---
>  Makefile      | 18 +++++++++++++-----
>  perl/Makefile | 52 ++++++++++++++++++++++++++++++++++++++++++++++------
>  2 files changed, 59 insertions(+), 11 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index f7c4ac207..80904f8b0 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -462,6 +462,7 @@ ARFLAGS = rcs
>  #   mandir
>  #   infodir
>  #   htmldir
> +#   perllibdir
>  # This can help installing the suite in a relocatable way.
>
>  prefix = $(HOME)
> @@ -1721,6 +1722,7 @@ gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
>  template_dir_SQ = $(subst ','\'',$(template_dir))
>  htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
>  prefix_SQ = $(subst ','\'',$(prefix))
> +perllibdir_SQ = $(subst ','\'',$(perllibdir))
>  gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
>
>  SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
> @@ -1955,17 +1957,22 @@ $(SCRIPT_PERL_GEN): perl/perl.mak
>
>  perl/perl.mak: perl/PM.stamp
>
> -perl/PM.stamp: FORCE
> +perl/PM.stamp: GIT-PERL-DEFINES FORCE
>  	@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \
> +	cat GIT-PERL-DEFINES >>$@+ && \
>  	$(PERL_PATH) -V >>$@+ && \
>  	{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
>  	$(RM) $@+
>
> -perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL
> -	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
> -
>  PERL_HEADER_TEMPLATE = perl/header_fixed_prefix.pl.template
> -PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)
> +
> +PERL_DEFINES := $(PERL_PATH_SQ) $(PERLLIB_EXTRA_SQ)
> +PERL_DEFINES += $(NO_PERL_MAKEMAKER)
> +PERL_DEFINES += $(perllibdir)
> +
> +perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL
> +	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' \
> +	  prefix='$(prefix_SQ)' perllibdir='$(perllibdir_SQ)' $(@F)
>
>  $(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
>  	$(QUIET_GEN)$(RM) $@ $@+ && \
> @@ -1979,6 +1986,7 @@ $(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-PERL-HEADER GI
>  	chmod +x $@+ && \
>  	mv $@+ $@
>
> +PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
>  GIT-PERL-DEFINES: FORCE
>  	@FLAGS='$(PERL_DEFINES)'; \
>  	    if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
> diff --git a/perl/Makefile b/perl/Makefile
> index f657de20e..b2aeeb0d8 100644
> --- a/perl/Makefile
> +++ b/perl/Makefile
> @@ -1,6 +1,22 @@
>  #
>  # Makefile for perl support modules and routine
>  #
> +# This Makefile generates "perl.mak", which contains the actual build and
> +# installation directions.
> +#
> +# PERL_PATH must be defined to be the path of the Perl interpreter to use.
> +#
> +# prefix must be defined as the Git installation prefix.
> +#
> +# localedir must be defined as the path to the locale data.
> +#
> +# perllibdir may be optionally defined to override the default Perl module
> +# installation directory, which is relative to prefix. If perllibdir is not
> +# absolute, it will be treated as relative to prefix.
> +#
> +# NO_PERL_MAKEMAKER may be defined to use a built-in Makefile generation method
> +# instead of Perl MakeMaker.
> +
>  makfile:=perl.mak
>  modules =
>
> @@ -12,6 +28,16 @@ ifndef V
>  	QUIET = @
>  endif
>
> +# If a library directory is provided, and it is not an absolute path, resolve
> +# it relative to prefix.
> +ifneq ($(perllibdir),)
> +ifneq ($(filter /%,$(firstword $(perllibdir))),)
> +perllib_instdir = $(perllibdir)
> +else
> +perllib_instdir = $(prefix)/$(perllibdir)
> +endif
> +endif

Maybe I'm missing something, but isn't this "perllibdir can be relative"
aim orthagonal to what this patch series is about? I.e. we could just
avoid this work by saying you must say "prefix=/usr
perllibdir=/usr/perl" instead of "prefix=/usr perllibdir=perl" as this
allows.

I started going down this route with my own patch and just threw it
away.

>  all install instlibdir: $(makfile)
>  	$(QUIET)$(MAKE) -f $(makfile) $@
>
> @@ -25,7 +51,12 @@ clean:
>  $(makfile): PM.stamp
>
>  ifdef NO_PERL_MAKEMAKER
> -instdir_SQ = $(subst ','\'',$(prefix)/lib)
> +
> +ifeq ($(perllib_instdir),)
> +perllib_instdir = $(prefix)/lib
> +endif
> +
> +instdir_SQ = $(subst ','\'',$(perllib_instdir))
>
>  modules += Git
>  modules += Git/I18N
> @@ -42,7 +73,7 @@ modules += Git/SVN/Prompt
>  modules += Git/SVN/Ra
>  modules += Git/SVN/Utils
>
> -$(makfile): ../GIT-CFLAGS Makefile
> +$(makfile): ../GIT-CFLAGS ../GIT-PERL-DEFINES Makefile
>  	echo all: private-Error.pm Git.pm Git/I18N.pm > $@
>  	set -e; \
>  	for i in $(modules); \
> @@ -79,12 +110,21 @@ $(makfile): ../GIT-CFLAGS Makefile
>  	echo '	cp private-Error.pm "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
>  	echo instlibdir: >> $@
>  	echo '	echo $(instdir_SQ)' >> $@
> +
>  else
> -$(makfile): Makefile.PL ../GIT-CFLAGS
> -	$(PERL_PATH) $< PREFIX='$(prefix_SQ)' INSTALL_BASE='' --localedir='$(localedir_SQ)'
> +
> +# This may be empty if perllibdir was empty.
> +instdir_SQ = $(subst ','\'',$(perllib_instdir))
> +
> +$(makfile): Makefile.PL ../GIT-CFLAGS ../GIT-PERL-DEFINES
> +	$(PERL_PATH) $< \
> +	  PREFIX='$(prefix_SQ)' INSTALL_BASE='' \
> +	  LIB='$(instdir_SQ)' \
> +	  --localedir='$(localedir_SQ)'
> +
>  endif
>
>  # this is just added comfort for calling make directly in perl dir
>  # (even though GIT-CFLAGS aren't used yet. If ever)
> -../GIT-CFLAGS:
> -	$(MAKE) -C .. GIT-CFLAGS
> +../GIT-CFLAGS ../GIT-PERL-DEFINES:
> +	$(MAKE) -C .. $(@F)

  reply	other threads:[~2017-11-29 20:04 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29 15:56 [PATCH v4 0/4] RUNTIME_PREFIX relocatable Git Dan Jacques
2017-11-29 15:56 ` [PATCH v4 1/4] Makefile: generate Perl header from template file Dan Jacques
2017-12-01 16:59   ` Johannes Sixt
2017-12-01 17:13     ` Johannes Schindelin
2017-12-01 17:25       ` Johannes Sixt
2017-12-01 18:18         ` Dan Jacques
2017-12-01 18:52           ` Andreas Schwab
2017-12-05 20:54         ` Johannes Sixt
2017-12-05 21:17           ` Junio C Hamano
2017-12-05 21:26           ` Dan Jacques
2017-12-05 21:35             ` Junio C Hamano
2017-12-06 18:25               ` Johannes Sixt
2017-12-06 18:47                 ` Junio C Hamano
2017-12-06 18:56                   ` Daniel Jacques
2017-12-06 19:01                     ` Ævar Arnfjörð Bjarmason
2017-12-08 21:15                       ` Ævar Arnfjörð Bjarmason
2018-04-23 23:23                 ` [PATCH dj/runtime-prefix 0/2] Handle $IFS in $INSTLIBDIR Jonathan Nieder
2018-04-23 23:24                   ` [PATCH 1/2] Makefile: remove unused @@PERLLIBDIR@@ substitution variable Jonathan Nieder
2018-04-24  2:11                     ` Junio C Hamano
2018-04-23 23:25                   ` [PATCH 2/2] Makefile: quote $INSTLIBDIR when passing it to sed Jonathan Nieder
2018-04-24  0:53                     ` Junio C Hamano
2018-04-24  2:18                       ` [PATCH 2/2 v2] " Jonathan Nieder
2018-04-24  2:56                         ` Daniel Jacques
2017-12-03  5:26     ` [PATCH v4 1/4] Makefile: generate Perl header from template file Junio C Hamano
2017-12-03  9:26       ` Ævar Arnfjörð Bjarmason
2017-11-29 15:56 ` [PATCH v4 2/4] Makefile: add support for "perllibdir" Dan Jacques
2017-11-29 20:04   ` Ævar Arnfjörð Bjarmason [this message]
2017-11-29 15:56 ` [PATCH v4 3/4] Makefile: add Perl runtime prefix support Dan Jacques
2017-11-29 21:00   ` Ævar Arnfjörð Bjarmason
2017-12-02 15:47     ` [PATCH v4 3/4] RUNTIME_PREFIX relocatable Git Dan Jacques
2017-11-29 21:04   ` [PATCH v4 3/4] Makefile: add Perl runtime prefix support Ævar Arnfjörð Bjarmason
2017-11-29 15:56 ` [PATCH v4 4/4] exec_cmd: RUNTIME_PREFIX on some POSIX systems Dan Jacques
2017-11-29 21:12 ` [PATCH v4 0/4] RUNTIME_PREFIX relocatable Git Ævar Arnfjörð Bjarmason
2017-11-29 22:38   ` Dan Jacques

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=87lgiovokg.fsf@evledraar.booking.com \
    --to=avarab@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=dnj@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).