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

[PATCH ab/simplify-perl-makefile] perl: treat PERLLIB_EXTRA as an extra path again (Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules)

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 2, 2018, 20:01 UTC
Message-ID
<20180102200140.GC131371@aiede.mtv.corp.google.com>
In-Reply-To
<20180102191720.GB131371@aiede.mtv.corp.google.com>
Subject: perl: treat PERLLIB_EXTRA as an extra path again

PERLLIB_EXTRA was introduced in v1.9-rc0~88^2 (2013-11-15) as a way for packagers to add additional directories such as the location of Subversion's perl bindings to Git's perl path. Since 20d2a30f (Makefile: replace perl/Makefile.PL with simple make rules, 2012-12-10) setting that variable breaks perl-based commands instead:

 $ PATH=$HOME/opt/git/bin:$PATH
 $ make install prefix=$HOME/opt/git PERLLIB_EXTRA=anextralibdir
[...]
 $ head -2 $HOME/opt/git/libexec/git-core/git-add--interactive
 #!/usr/bin/perl
 use lib (split(/:/, $ENV{GITPERLLIB} || ":helloiamanextrainstlibdir" || "/usr/local/google/home/jrn/opt/git/share/perl5"));
 $ git add -p
 Empty compile time value given to use lib at /home/jrn/opt/git/libexec/git-core/git-add--interactive line 2.

Removing the spurious ":" at the beginning of ":$PERLLIB_EXTRA" avoids the "Empty compile time value" error but with that tweak the problem still remains: PERLLIB_EXTRA ends up replacing instead of supplementing the perllibdir that would be passed to 'use lib' if PERLLIB_EXTRA were not set.

The intent was to simplify, as the commit message to 20d2a30f explains:

| The scripts themselves will 'use lib' the target directory, but if
| INSTLIBDIR is set it overrides it. It doesn't have to be this way,
| it could be set in addition to INSTLIBDIR, but my reading of
| [v1.9-rc0~88^2] is that this is the desired behavior.
Restore the previous code structure to make PERLLIB_EXTRA work again.

Reproducing this problem requires an invocation of "make install" instead of running bin-wrappers/git in place, since the latter sets the GITPERLLIB environment variable, avoiding trouble.

Reported-by: Jonathan Koren <jdkoren@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Jonathan Nieder wrote:
Show 21 quoted lines
> Hi,
> 
> Ævar Arnfjörð Bjarmason wrote:
> 
> > +++ b/Makefile
> [...]
> > -PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)
> > -$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE
> > +PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
> > +$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE
> >  	$(QUIET_GEN)$(RM) $@ $@+ && \
> > -	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
> >  	INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
> >  	INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
> >  	sed -e '1{' \
> >  	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
> >  	    -e '	h' \
> > -	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
> > +	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'" || "'"$(perllibdir_SQ)"'"));=' \
> 
> This appears to have broken a build with INSTLIBDIR set.
Here it is in patch form.
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 5c73cd208a..409e8f6ec9 100644
--- a/Makefile
+++ b/Makefile
@@ -1951,12 +1951,13 @@ $(SCRIPT_PERL_GEN):
 PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
 $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE
 	$(QUIET_GEN)$(RM) $@ $@+ && \
+	INSTLIBDIR='$(perllibdir_SQ)' && \
 	INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
 	INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
 	sed -e '1{' \
 	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
 	    -e '	h' \
-	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'" || "'"$(perllibdir_SQ)"'"));=' \
+	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
 	    -e '	H' \
 	    -e '	x' \
 	    -e '}' \
-- 
2.16.0.rc0.224.g99853183ba
Previous: Jonathan NiederNext: Ævar Arnfjörð Bjarmason
Message 34 of 35 in “Makefile: replace the overly complex perl build system with something simple”
  1. Makefile: replace the overly complex perl build system with something simpleÆvar Arnfjörð Bjarmason, Nov 29, 2017
  2. Makefile: replace perl/Makefile.PL with simple make rulesÆvar Arnfjörð Bjarmason, Nov 29, 2017
  3. Jonathan NiederNov 30, 2017
  4. Ævar Arnfjörð BjarmasonNov 30, 2017
  5. Jonathan NiederNov 30, 2017
  6. Eric WongNov 30, 2017
  7. Jeff KingNov 30, 2017
  8. Ævar Arnfjörð BjarmasonNov 30, 2017
  9. Alex VandiverDec 21, 2017
  10. Makefile: replace perl/Makefile.PL with simple make rulesÆvar Arnfjörð Bjarmason, Dec 3, 2017
  11. Junio C HamanoDec 4, 2017
  12. Ævar Arnfjörð BjarmasonDec 4, 2017
  13. Junio C HamanoDec 4, 2017
  14. Dan JacquesDec 4, 2017
  15. Makefile: replace perl/Makefile.PL with simple make rulesÆvar Arnfjörð Bjarmason, Dec 10, 2017
  16. Junio C HamanoDec 11, 2017
  17. Randall S. BeckerDec 12, 2017
  18. Ævar Arnfjörð BjarmasonDec 12, 2017
  19. Michael J GruberDec 15, 2017
  20. Todd ZullingerDec 15, 2017
  21. Ævar Arnfjörð BjarmasonDec 15, 2017
  22. Junio C HamanoDec 19, 2017
  23. Makefile: replace perl/Makefile.PL with simple make rulesÆvar Arnfjörð Bjarmason, Dec 19, 2017
  24. Todd ZullingerDec 20, 2017
  25. Makefile: replace perl/Makefile.PL with simple make rulesÆvar Arnfjörð Bjarmason, Dec 20, 2017
  26. Todd ZullingerDec 20, 2017
  27. Makefile: replace perl/Makefile.PL with simple make rulesÆvar Arnfjörð Bjarmason, Dec 20, 2017
  28. Todd ZullingerDec 20, 2017
  29. Alex RiesenDec 21, 2017
  30. Junio C HamanoDec 22, 2017
  31. Ævar Arnfjörð BjarmasonDec 27, 2017
  32. Junio C HamanoDec 28, 2017
  33. Jonathan NiederJan 2, 2018
  34. perl: treat PERLLIB_EXTRA as an extra path again (Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules)Jonathan Nieder, Jan 2, 2018
  35. Ævar Arnfjörð BjarmasonJan 2, 2018

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.