{"thread":{"id":"47345","subject":"[RFC/PATCH] Makefile: replace the overly complex perl build system with something simple","startedAt":"2017-11-29T15:35:06Z","lastAt":"2018-01-02T20:39:41Z","messageCount":35,"participants":["Ævar Arnfjörð Bjarmason","Jonathan Nieder","Eric Wong","Jeff King","Junio C Hamano","Dan Jacques","Randall S. Becker","Michael J Gruber","Todd Zullinger","Alex Riesen","Alex Vandiver"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"333784","messageId":"20171129153436.24471-1-avarab@gmail.com","threadId":"47345","inReplyTo":null,"subject":"[RFC/PATCH] Makefile: replace the overly complex perl build system with something simple","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-11-29T15:34:36Z","receivedAt":"2017-11-29T15:35:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As the history of perl/Makefile.PL reveals the reason we have it in\nthe first place is because during its initial development the perl\nbindings would link to libgit, building such a module with any sanity\nrequires ExtUtils::MakeMaker and Devel::PPPort.\n\nHowever, since then this grew into a much simpler problem while\nkeeping all the complexity of the initial implementation. We just need\nto take the files in perl/**.pm, copy them to a build directory while\nsearch/replacing one string (@@LOCALEDIR@@), and have them available\nfor the likes of git-svn once Git is installed.\n\nThis patch is a WIP effort to do that. Trade-offs this makes & other\ncaveats:\n\n * This will not always install into perl's idea of its global\n   \"installsitelib\". This only potentially matters for packagers that\n   need to expose Git.pm for non-git use, and as explained in the\n   INSTALL file there's a trivial workaround.\n\n * The scripts themselves will 'use lib' the target directory, but if\n   INSTLIBDIR is set it overrides it. It doesn't have to be this way,\n   but my reading of 0386dd37b1 (\"Makefile: add PERLLIB_EXTRA variable\n   that adds to default perl path\", 2013-11-15) is that this does the\n   right thing, but I may be wrong.\n\n * We don't build the Git(3) Git::I18N(3) etc. man pages from the\n   embedded perldoc. I suspect nobody really cares, these are mostly\n   internal APIs, and if someone's developing against them they likely\n   know enough to issue a \"perldoc\" against the installed file to get\n   the same result.\n\n   But this is a change in how Git is installed now on e.g. CentOS &\n   Debian which carry these manpages. They could be added (via\n   pod2man) if anyone really cares.\n\n * Currently the Error.pm fallback doesn't work. This is a TODO item,\n   but I didn't have enough time to hack this up.\n\n   I think that whole thing should be changed, we're checking an\n   ancient Error.pm version that was released in 2006, we should just\n   stop that, then we check *at build time* whether the library is\n   there, instead we should call it/load it via e.g. Git::Error which\n   would be a small wrapper that would either load Error.pm from the\n   system, or use our copy in Git::Error_CPAN.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nSo *long* CC list but a lot of people have touched this stuff over the\nyears. This obviously conflicts with Dan Jacques's patches in a big\nway, but I think it's worth it to rebase them on top of this if\nthere's interest in this, and depending on what people think about the\ncaveats I've noted about this above.\n\n INSTALL               | 18 ++++++++++-\n Makefile              | 51 +++++++++++++----------------\n perl/.gitignore       |  9 +-----\n perl/Git/I18N.pm      |  2 +-\n perl/Makefile         | 90 ---------------------------------------------------\n perl/Makefile.PL      | 62 -----------------------------------\n t/perf/aggregate.perl |  2 +-\n t/test-lib.sh         |  2 +-\n wrap-for-bin.sh       |  2 +-\n 9 files changed, 45 insertions(+), 193 deletions(-)\n delete mode 100644 perl/Makefile\n delete mode 100644 perl/Makefile.PL\n\ndiff --git a/INSTALL b/INSTALL\nindex ffb071e9f0..e6266a9127 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -84,9 +84,25 @@ Issues of note:\n \n \tGIT_EXEC_PATH=`pwd`\n \tPATH=`pwd`:$PATH\n-\tGITPERLLIB=`pwd`/perl/blib/lib\n+\tGITPERLLIB=`pwd`/perl/build\n \texport GIT_EXEC_PATH PATH GITPERLLIB\n \n+ - By default (unless NO_PERL is provided) Git will ship various perl\n+   scripts & libraries it needs. However, for simplicity it doesn't\n+   use the ExtUtils::MakeMaker toolchain to decide where to place the\n+   perl libraries. Depending on the system this can result in the perl\n+   libraries not being where you'd like them if they're expected to be\n+   used by things other than Git itself.\n+\n+   Manually supplying a perllibdir prefix should fix this, if this is\n+   a problem you care about, e.g.:\n+\n+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wE 'my ($relsite) = $Config{installsitelib} =~ m[^\\Q$Config{siteprefixexp}\\E/(.+)]s; say $relsite')\n+\n+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,\n+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS\n+   etc.\n+\n  - Git is reasonably self-sufficient, but does depend on a few external\n    programs and libraries.  Git can be used without most of them by adding\n    the approriate \"NO_<LIBRARY>=YesPlease\" to the make command line or\ndiff --git a/Makefile b/Makefile\nindex e53750ca01..6d69a7486b 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -295,9 +295,6 @@ all::\n #\n # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).\n #\n-# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n-# MakeMaker (e.g. using ActiveState under Cygwin).\n-#\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n@@ -473,6 +470,7 @@ gitexecdir = libexec/git-core\n mergetoolsdir = $(gitexecdir)/mergetools\n sharedir = $(prefix)/share\n gitwebdir = $(sharedir)/gitweb\n+perllibdir = $(sharedir)/perl5\n localedir = $(sharedir)/locale\n template_dir = share/git-core/templates\n htmldir = $(prefix)/share/doc/git-doc\n@@ -486,7 +484,7 @@ mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))\n infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))\n htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))\n \n-export prefix bindir sharedir sysconfdir gitwebdir localedir\n+export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir\n \n CC = cc\n AR = ar\n@@ -1525,9 +1523,6 @@ ifdef SHA1_MAX_BLOCK_SIZE\n \tLIB_OBJS += compat/sha1-chunked.o\n \tBASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE=\"$(SHA1_MAX_BLOCK_SIZE)\"\n endif\n-ifdef NO_PERL_MAKEMAKER\n-\texport NO_PERL_MAKEMAKER\n-endif\n ifdef NO_HSTRERROR\n \tCOMPAT_CFLAGS += -DNO_HSTRERROR\n \tCOMPAT_OBJS += compat/hstrerror.o\n@@ -1716,6 +1711,7 @@ bindir_SQ = $(subst ','\\'',$(bindir))\n bindir_relative_SQ = $(subst ','\\'',$(bindir_relative))\n mandir_relative_SQ = $(subst ','\\'',$(mandir_relative))\n infodir_relative_SQ = $(subst ','\\'',$(infodir_relative))\n+perllibdir_SQ = $(subst ','\\'',$(perllibdir))\n localedir_SQ = $(subst ','\\'',$(localedir))\n gitexecdir_SQ = $(subst ','\\'',$(gitexecdir))\n template_dir_SQ = $(subst ','\\'',$(template_dir))\n@@ -1824,9 +1820,6 @@ all::\n ifndef NO_TCLTK\n \t$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all\n \t$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all\n-endif\n-ifndef NO_PERL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all\n endif\n \t$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'\n \n@@ -1907,7 +1900,8 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)\n \n SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\\\n \t$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\\\n-\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV)\n+\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\\\n+\t$(perllibdir_SQ)\n define cmd_munge_script\n $(RM) $@ $@+ && \\\n sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n@@ -1951,29 +1945,17 @@ git.res: git.rc GIT-VERSION-FILE\n $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS\n \n ifndef NO_PERL\n-$(SCRIPT_PERL_GEN): perl/perl.mak\n-\n-perl/perl.mak: perl/PM.stamp\n-\n-perl/PM.stamp: FORCE\n-\t@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \\\n-\t$(PERL_PATH) -V >>$@+ && \\\n-\t{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \\\n-\t$(RM) $@+\n-\n-perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)\n+$(SCRIPT_PERL_GEN):\n \n PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n-$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n+$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\n-\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n+\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$$perllibdir\"'\"));=' \\\n \t    -e '\tH' \\\n \t    -e '\tx' \\\n \t    -e '}' \\\n@@ -2291,6 +2273,17 @@ endif\n po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n \n+PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n+PMCFILES := $(patsubst perl/%.pm,perl/build/%.pmc,$(PMFILES))\n+\n+ifndef NO_PERL\n+all:: $(PMCFILES)\n+endif\n+\n+perl/build/%.pmc: perl/%.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n+\n FIND_SOURCE_FILES = ( \\\n \tgit ls-files \\\n \t\t'*.[hcS]' \\\n@@ -2550,7 +2543,9 @@ ifndef NO_GETTEXT\n \t(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)\n endif\n ifndef NO_PERL\n-\t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n+\t(cd perl/build && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n \t$(MAKE) -C gitweb install\n endif\n ifndef NO_TCLTK\n@@ -2697,7 +2692,7 @@ clean: profile-clean coverage-clean\n \t$(MAKE) -C Documentation/ clean\n ifndef NO_PERL\n \t$(MAKE) -C gitweb clean\n-\t$(MAKE) -C perl clean\n+\t$(RM) -r perl/build/\n endif\n \t$(MAKE) -C templates/ clean\n \t$(MAKE) -C t/ clean\ndiff --git a/perl/.gitignore b/perl/.gitignore\nindex 0f1fc27f86..84c048a73c 100644\n--- a/perl/.gitignore\n+++ b/perl/.gitignore\n@@ -1,8 +1 @@\n-perl.mak\n-perl.mak.old\n-MYMETA.json\n-MYMETA.yml\n-blib\n-blibdirs\n-pm_to_blib\n-PM.stamp\n+/build/\ndiff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm\nindex 836a5c2382..dba96fff0a 100644\n--- a/perl/Git/I18N.pm\n+++ b/perl/Git/I18N.pm\n@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;\n \n sub __bootstrap_locale_messages {\n \tour $TEXTDOMAIN = 'git';\n-\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';\n+\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';\n \n \trequire POSIX;\n \tPOSIX->import(qw(setlocale));\ndiff --git a/perl/Makefile b/perl/Makefile\ndeleted file mode 100644\nindex f657de20e3..0000000000\n--- a/perl/Makefile\n+++ /dev/null\n@@ -1,90 +0,0 @@\n-#\n-# Makefile for perl support modules and routine\n-#\n-makfile:=perl.mak\n-modules =\n-\n-PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n-prefix_SQ = $(subst ','\\'',$(prefix))\n-localedir_SQ = $(subst ','\\'',$(localedir))\n-\n-ifndef V\n-\tQUIET = @\n-endif\n-\n-all install instlibdir: $(makfile)\n-\t$(QUIET)$(MAKE) -f $(makfile) $@\n-\n-clean:\n-\t$(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0\n-\t$(RM) ppport.h\n-\t$(RM) $(makfile)\n-\t$(RM) $(makfile).old\n-\t$(RM) PM.stamp\n-\n-$(makfile): PM.stamp\n-\n-ifdef NO_PERL_MAKEMAKER\n-instdir_SQ = $(subst ','\\'',$(prefix)/lib)\n-\n-modules += Git\n-modules += Git/I18N\n-modules += Git/IndexInfo\n-modules += Git/Packet\n-modules += Git/SVN\n-modules += Git/SVN/Memoize/YAML\n-modules += Git/SVN/Fetcher\n-modules += Git/SVN/Editor\n-modules += Git/SVN/GlobSpec\n-modules += Git/SVN/Log\n-modules += Git/SVN/Migration\n-modules += Git/SVN/Prompt\n-modules += Git/SVN/Ra\n-modules += Git/SVN/Utils\n-\n-$(makfile): ../GIT-CFLAGS Makefile\n-\techo all: private-Error.pm Git.pm Git/I18N.pm > $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) blib/lib/'$$i'.pm' >> $@; \\\n-\t\techo '\tmkdir -p blib/lib'$$subdir >> $@; \\\n-\t\techo '\tcp '$$i'.pm blib/lib/'$$i'.pm' >> $@; \\\n-\tdone\n-\techo '\t$(RM) blib/lib/Error.pm' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm blib/lib/Error.pm' >> $@\n-\techo install: >> $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\t\techo '\tmkdir -p \"$$(DESTDIR)$(instdir_SQ)'$$subdir'\"' >> $@; \\\n-\t\techo '\tcp '$$i'.pm \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\tdone\n-\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\techo instlibdir: >> $@\n-\techo '\techo $(instdir_SQ)' >> $@\n-else\n-$(makfile): Makefile.PL ../GIT-CFLAGS\n-\t$(PERL_PATH) $< PREFIX='$(prefix_SQ)' INSTALL_BASE='' --localedir='$(localedir_SQ)'\n-endif\n-\n-# this is just added comfort for calling make directly in perl dir\n-# (even though GIT-CFLAGS aren't used yet. If ever)\n-../GIT-CFLAGS:\n-\t$(MAKE) -C .. GIT-CFLAGS\ndiff --git a/perl/Makefile.PL b/perl/Makefile.PL\ndeleted file mode 100644\nindex 3f29ba98a6..0000000000\n--- a/perl/Makefile.PL\n+++ /dev/null\n@@ -1,62 +0,0 @@\n-use strict;\n-use warnings;\n-use ExtUtils::MakeMaker;\n-use Getopt::Long;\n-use File::Find;\n-\n-# Don't forget to update the perl/Makefile, too.\n-# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease\n-\n-# Sanity: die at first unknown option\n-Getopt::Long::Configure qw/ pass_through /;\n-\n-my $localedir = '';\n-GetOptions(\"localedir=s\" => \\$localedir);\n-\n-sub MY::postamble {\n-\treturn <<'MAKE_FRAG';\n-instlibdir:\n-\t@echo '$(INSTALLSITELIB)'\n-\n-ifneq (,$(DESTDIR))\n-ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))\n-$(error ExtUtils::MakeMaker version \"$(MM_VERSION)\" is older than 6.11 and so \\\n-\tis likely incompatible with the DESTDIR mechanism.  Try setting \\\n-\tNO_PERL_MAKEMAKER=1 instead)\n-endif\n-endif\n-\n-MAKE_FRAG\n-}\n-\n-# Find all the .pm files in \"Git/\" and Git.pm\n-my %pm;\n-find sub {\n-\treturn unless /\\.pm$/;\n-\n-\t# sometimes File::Find prepends a ./  Strip it.\n-\tmy $pm_path = $File::Find::name;\n-\t$pm_path =~ s{^\\./}{};\n-\n-\t$pm{$pm_path} = '$(INST_LIBDIR)/'.$pm_path;\n-}, \"Git\", \"Git.pm\";\n-\n-\n-# We come with our own bundled Error.pm. It's not in the set of default\n-# Perl modules so install it if it's not available on the system yet.\n-if ( !eval { require Error } || $Error::VERSION < 0.15009) {\n-\t$pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';\n-}\n-\n-# redirect stdout, otherwise the message \"Writing perl.mak for Git\"\n-# disrupts the output for the target 'instlibdir'\n-open STDOUT, \">&STDERR\";\n-\n-WriteMakefile(\n-\tNAME            => 'Git',\n-\tVERSION_FROM    => 'Git.pm',\n-\tPM\t\t=> \\%pm,\n-\tPM_FILTER\t=> qq[\\$(PERL) -pe \"s<\\\\Q++LOCALEDIR++\\\\E><$localedir>\"],\n-\tMAKEFILE\t=> 'perl.mak',\n-\tINSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'\n-);\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex 1dbc85b214..0ef5cf1c60 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -1,6 +1,6 @@\n #!/usr/bin/perl\n \n-use lib '../../perl/blib/lib';\n+use lib '../../perl/build';\n use strict;\n use warnings;\n use Git;\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 116bd6a70c..69d81e1c97 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -919,7 +919,7 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/build\n export GITPERLLIB\n test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\ndiff --git a/wrap-for-bin.sh b/wrap-for-bin.sh\nindex 22b6e4948f..7a8429bcc9 100644\n--- a/wrap-for-bin.sh\n+++ b/wrap-for-bin.sh\n@@ -14,7 +14,7 @@ else\n \tGIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'\n \texport GIT_TEMPLATE_DIR\n fi\n-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n+GITPERLLIB='@@BUILD_DIR@@/perl/build'\"${GITPERLLIB:+:$GITPERLLIB}\"\n GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'\n PATH='@@BUILD_DIR@@/bin-wrappers:'\"$PATH\"\n \n-- \n2.15.0.403.gc27cc4dac6\n\n"},{"id":"333798","messageId":"20171129195430.10069-1-avarab@gmail.com","threadId":"47345","inReplyTo":"20171129153436.24471-1-avarab@gmail.com","subject":"[PATCH] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-11-29T19:54:30Z","receivedAt":"2017-11-29T19:54:50Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Replace the perl/Makefile.PL and the fallback perl/Makefile used under\nNO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\ninspired by how the i18n infrastructure's build process works[1].\n\nThe reason for having the Makefile.PL in the first place is that it\nwas initially[2] building a perl C binding to interface with libgit,\nthis functionality, that was removed[3] before Git.pm ever made it to\nthe master branch.\n\nWe've since since started maintaining a fallback perl/Makefile, as\nMakeMaker wouldn't work on some platforms[4]. That's just the tip of\nthe iceberg. We have the PM.stamp hack in the top-level Makefile[5] to\ndetect whether we need to regenerate the perl/perl.mak, which I fixed\njust recently to deal with issues like the perl version changing from\nunder us[6].\n\nThere is absolutely no reason for why this needs to be so complex\nanymore. All we're getting out of this elaborate Rube Goldberg machine\nwas copying perl/* to perl/blib/* as we do a string-replacement on\nthe *.pm files to hardcode @@LOCALEDIR@@ in the source.\n\nSo replace the whole thing with something that's pretty much a copy of\nhow we generate po/build/**.mo from po/*.po, just with a small sed(1)\ncommand instead of msgfmt. As that's being done rename the files\nfrom *.pm to *.pmc just to indicate that they're genreated (see\n\"perldoc -f require\").\n\nWhile I'm at it, change the fallback for Error.pm from being something\nwhere we'll ship our own Error.pm if one doesn't exist at build time\nto one where we just use a Git::Error wrapper that'll always prefer\nthe system-wide Error.pm, only falling back to our own copy if it\nreally doesn't exist at runtime. It's now shipped as\nGit::FromCPAN::Error, making it easy to add other modules to\nGit::FromCPAN::* in the future if that's needed.\n\nFunctional changes:\n\n * This will not always install into perl's idea of its global\n   \"installsitelib\". This only potentially matters for packagers that\n   need to expose Git.pm for non-git use, and as explained in the\n   INSTALL file there's a trivial workaround.\n\n * The scripts themselves will 'use lib' the target directory, but if\n   INSTLIBDIR is set it overrides it. It doesn't have to be this way,\n   it could be set in addition to INSTLIBDIR, but my reading of [7] is\n   that this is the desired behavior.\n\n * We don't build the Git(3) Git::I18N(3) etc. man pages from the\n   embedded perldoc. I suspect nobody really cares, these are mostly\n   internal APIs, and if someone's developing against them they likely\n   know enough to issue a \"perldoc\" against the installed file to get\n   the same result.\n\n   But this is a change in how Git is installed now on e.g. CentOS &\n   Debian which carry these manpages. They could be added (via\n   pod2man) if anyone really cares.\n\n   I doubt they will. The reason these were built in the first place\n   was as a side-effect of how ExtUtils::MakeMaker works.\n\n1. 5e9637c629 (\"i18n: add infrastructure for translating Git with\n   gettext\", 2011-11-18)\n\n2. b1edc53d06 (\"Introduce Git.pm (v4)\", 2006-06-24)\n\n3. 18b0fc1ce1 (\"Git.pm: Kill Git.xs for now\", 2006-09-23)\n\n4. f848718a69 (\"Make perl/ build procedure ActiveState friendly.\",\n   2006-12-04)\n\n5. ee9be06770 (\"perl: detect new files in MakeMaker builds\",\n   2012-07-27)\n\n6. c59c4939c2 (\"perl: regenerate perl.mak if perl -V changes\",\n   2017-03-29)\n\n7. 0386dd37b1 (\"Makefile: add PERLLIB_EXTRA variable that adds to\n   default perl path\", 2013-11-15)\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nHere's the non-RFC version. I think this is ready to be applied,\nfixing that issue with Error.pm was easier than I thought.\n\n INSTALL                                          | 17 ++++-\n Makefile                                         | 53 +++++++-------\n contrib/examples/git-difftool.perl               |  2 +-\n git-send-email.perl                              |  2 +-\n perl/.gitignore                                  |  9 +--\n perl/Git.pm                                      |  2 +-\n perl/Git/Error.pm                                | 47 +++++++++++++\n perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0\n perl/Git/I18N.pm                                 |  2 +-\n perl/Makefile                                    | 90 ------------------------\n perl/Makefile.PL                                 | 62 ----------------\n t/perf/aggregate.perl                            |  2 +-\n t/test-lib.sh                                    |  2 +-\n wrap-for-bin.sh                                  |  2 +-\n 14 files changed, 95 insertions(+), 197 deletions(-)\n create mode 100644 perl/Git/Error.pm\n rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)\n delete mode 100644 perl/Makefile\n delete mode 100644 perl/Makefile.PL\n\ndiff --git a/INSTALL b/INSTALL\nindex ffb071e9f0..822ed16095 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -84,9 +84,24 @@ Issues of note:\n \n \tGIT_EXEC_PATH=`pwd`\n \tPATH=`pwd`:$PATH\n-\tGITPERLLIB=`pwd`/perl/blib/lib\n+\tGITPERLLIB=`pwd`/perl/build\n \texport GIT_EXEC_PATH PATH GITPERLLIB\n \n+ - By default (unless NO_PERL is provided) Git will ship various perl\n+   scripts & libraries it needs. However, for simplicity it doesn't\n+   use the ExtUtils::MakeMaker toolchain to decide where to place the\n+   perl libraries. Depending on the system this can result in the perl\n+   libraries not being where you'd like them if they're expected to be\n+   used by things other than Git itself.\n+\n+   Manually supplying a perllibdir prefix should fix this, if this is\n+   a problem you care about, e.g.:\n+\n+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')\n+\n+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,\n+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.\n+\n  - Git is reasonably self-sufficient, but does depend on a few external\n    programs and libraries.  Git can be used without most of them by adding\n    the approriate \"NO_<LIBRARY>=YesPlease\" to the make command line or\ndiff --git a/Makefile b/Makefile\nindex e53750ca01..e3c382f120 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -295,9 +295,6 @@ all::\n #\n # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).\n #\n-# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n-# MakeMaker (e.g. using ActiveState under Cygwin).\n-#\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n@@ -473,6 +470,7 @@ gitexecdir = libexec/git-core\n mergetoolsdir = $(gitexecdir)/mergetools\n sharedir = $(prefix)/share\n gitwebdir = $(sharedir)/gitweb\n+perllibdir = $(sharedir)/perl5\n localedir = $(sharedir)/locale\n template_dir = share/git-core/templates\n htmldir = $(prefix)/share/doc/git-doc\n@@ -486,7 +484,7 @@ mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))\n infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))\n htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))\n \n-export prefix bindir sharedir sysconfdir gitwebdir localedir\n+export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir\n \n CC = cc\n AR = ar\n@@ -1525,9 +1523,6 @@ ifdef SHA1_MAX_BLOCK_SIZE\n \tLIB_OBJS += compat/sha1-chunked.o\n \tBASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE=\"$(SHA1_MAX_BLOCK_SIZE)\"\n endif\n-ifdef NO_PERL_MAKEMAKER\n-\texport NO_PERL_MAKEMAKER\n-endif\n ifdef NO_HSTRERROR\n \tCOMPAT_CFLAGS += -DNO_HSTRERROR\n \tCOMPAT_OBJS += compat/hstrerror.o\n@@ -1716,6 +1711,7 @@ bindir_SQ = $(subst ','\\'',$(bindir))\n bindir_relative_SQ = $(subst ','\\'',$(bindir_relative))\n mandir_relative_SQ = $(subst ','\\'',$(mandir_relative))\n infodir_relative_SQ = $(subst ','\\'',$(infodir_relative))\n+perllibdir_SQ = $(subst ','\\'',$(perllibdir))\n localedir_SQ = $(subst ','\\'',$(localedir))\n gitexecdir_SQ = $(subst ','\\'',$(gitexecdir))\n template_dir_SQ = $(subst ','\\'',$(template_dir))\n@@ -1824,9 +1820,6 @@ all::\n ifndef NO_TCLTK\n \t$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all\n \t$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all\n-endif\n-ifndef NO_PERL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all\n endif\n \t$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'\n \n@@ -1907,7 +1900,8 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)\n \n SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\\\n \t$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\\\n-\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV)\n+\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\\\n+\t$(perllibdir_SQ)\n define cmd_munge_script\n $(RM) $@ $@+ && \\\n sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n@@ -1951,29 +1945,17 @@ git.res: git.rc GIT-VERSION-FILE\n $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS\n \n ifndef NO_PERL\n-$(SCRIPT_PERL_GEN): perl/perl.mak\n-\n-perl/perl.mak: perl/PM.stamp\n-\n-perl/PM.stamp: FORCE\n-\t@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \\\n-\t$(PERL_PATH) -V >>$@+ && \\\n-\t{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \\\n-\t$(RM) $@+\n+$(SCRIPT_PERL_GEN):\n \n-perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)\n-\n-PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n-$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n+PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n+$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\n-\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n+\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n \t    -e '\tH' \\\n \t    -e '\tx' \\\n \t    -e '}' \\\n@@ -2291,6 +2273,17 @@ endif\n po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n \n+PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n+PMCFILES := $(patsubst perl/%.pm,perl/build/%.pmc,$(PMFILES))\n+\n+ifndef NO_PERL\n+all:: $(PMCFILES)\n+endif\n+\n+perl/build/%.pmc: perl/%.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n+\n FIND_SOURCE_FILES = ( \\\n \tgit ls-files \\\n \t\t'*.[hcS]' \\\n@@ -2550,7 +2543,9 @@ ifndef NO_GETTEXT\n \t(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)\n endif\n ifndef NO_PERL\n-\t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n+\t(cd perl/build && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n \t$(MAKE) -C gitweb install\n endif\n ifndef NO_TCLTK\n@@ -2697,7 +2692,7 @@ clean: profile-clean coverage-clean\n \t$(MAKE) -C Documentation/ clean\n ifndef NO_PERL\n \t$(MAKE) -C gitweb clean\n-\t$(MAKE) -C perl clean\n+\t$(RM) -r perl/build/\n endif\n \t$(MAKE) -C templates/ clean\n \t$(MAKE) -C t/ clean\ndiff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl\nindex df59bdfe97..fb0fd0b84b 100755\n--- a/contrib/examples/git-difftool.perl\n+++ b/contrib/examples/git-difftool.perl\n@@ -13,7 +13,7 @@\n use 5.008;\n use strict;\n use warnings;\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use File::Basename qw(dirname);\n use File::Copy;\n use File::Find;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 2208dcc213..88a0edcd7d 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -26,7 +26,7 @@ use Text::ParseWords;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n use File::Spec::Functions qw(catdir catfile);\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\ndiff --git a/perl/.gitignore b/perl/.gitignore\nindex 0f1fc27f86..84c048a73c 100644\n--- a/perl/.gitignore\n+++ b/perl/.gitignore\n@@ -1,8 +1 @@\n-perl.mak\n-perl.mak.old\n-MYMETA.json\n-MYMETA.yml\n-blib\n-blibdirs\n-pm_to_blib\n-PM.stamp\n+/build/\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex ffa09ace92..02a3871e94 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -101,7 +101,7 @@ increase notwithstanding).\n \n \n use Carp qw(carp croak); # but croak is bad - throw instead\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\ndiff --git a/perl/Git/Error.pm b/perl/Git/Error.pm\nnew file mode 100644\nindex 0000000000..a0cd3b8280\n--- /dev/null\n+++ b/perl/Git/Error.pm\n@@ -0,0 +1,47 @@\n+package Git::Error;\n+use 5.008;\n+use strict;\n+use warnings;\n+\n+=head1 NAME\n+\n+Git::Error - Wrapper for the L<Error> module, in case it's not installed\n+\n+=head1 DESCRIPTION\n+\n+Wraps the import function for the L<Error> module. The L<Git> module\n+must be imported first.\n+\n+This module is only intended to be used for code shipping in the\n+C<git.git> repository. Use it for anything else at your peril!\n+\n+=cut\n+\n+sub import {\n+    shift;\n+    my $caller = caller;\n+\n+    eval {\n+\trequire Error;\n+\t1;\n+    } or do {\n+\tmy $error = $@ || \"Zombie Error\";\n+\n+\tmy $Git_pm_path = $INC{\"Git.pm\"} || die \"BUG: Should have loaded the Git module first!\";\n+\n+\trequire File::Basename;\n+\tmy $Git_pm_root = File::Basename::dirname($Git_pm_path) || die \"BUG: Can't figure out dirname from '$Git_pm_path'!\";\n+\n+\trequire File::Spec;\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_pm_root, qw(Git FromCPAN));\n+\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n+\n+\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n+\trequire Error;\n+    };\n+\n+    local @_ = ($caller, @_);\n+    goto &Error::import;\n+}\n+\n+1;\ndiff --git a/perl/private-Error.pm b/perl/Git/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/private-Error.pm\nrename to perl/Git/FromCPAN/Error.pm\ndiff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm\nindex 836a5c2382..dba96fff0a 100644\n--- a/perl/Git/I18N.pm\n+++ b/perl/Git/I18N.pm\n@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;\n \n sub __bootstrap_locale_messages {\n \tour $TEXTDOMAIN = 'git';\n-\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';\n+\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';\n \n \trequire POSIX;\n \tPOSIX->import(qw(setlocale));\ndiff --git a/perl/Makefile b/perl/Makefile\ndeleted file mode 100644\nindex f657de20e3..0000000000\n--- a/perl/Makefile\n+++ /dev/null\n@@ -1,90 +0,0 @@\n-#\n-# Makefile for perl support modules and routine\n-#\n-makfile:=perl.mak\n-modules =\n-\n-PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n-prefix_SQ = $(subst ','\\'',$(prefix))\n-localedir_SQ = $(subst ','\\'',$(localedir))\n-\n-ifndef V\n-\tQUIET = @\n-endif\n-\n-all install instlibdir: $(makfile)\n-\t$(QUIET)$(MAKE) -f $(makfile) $@\n-\n-clean:\n-\t$(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0\n-\t$(RM) ppport.h\n-\t$(RM) $(makfile)\n-\t$(RM) $(makfile).old\n-\t$(RM) PM.stamp\n-\n-$(makfile): PM.stamp\n-\n-ifdef NO_PERL_MAKEMAKER\n-instdir_SQ = $(subst ','\\'',$(prefix)/lib)\n-\n-modules += Git\n-modules += Git/I18N\n-modules += Git/IndexInfo\n-modules += Git/Packet\n-modules += Git/SVN\n-modules += Git/SVN/Memoize/YAML\n-modules += Git/SVN/Fetcher\n-modules += Git/SVN/Editor\n-modules += Git/SVN/GlobSpec\n-modules += Git/SVN/Log\n-modules += Git/SVN/Migration\n-modules += Git/SVN/Prompt\n-modules += Git/SVN/Ra\n-modules += Git/SVN/Utils\n-\n-$(makfile): ../GIT-CFLAGS Makefile\n-\techo all: private-Error.pm Git.pm Git/I18N.pm > $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) blib/lib/'$$i'.pm' >> $@; \\\n-\t\techo '\tmkdir -p blib/lib'$$subdir >> $@; \\\n-\t\techo '\tcp '$$i'.pm blib/lib/'$$i'.pm' >> $@; \\\n-\tdone\n-\techo '\t$(RM) blib/lib/Error.pm' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm blib/lib/Error.pm' >> $@\n-\techo install: >> $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\t\techo '\tmkdir -p \"$$(DESTDIR)$(instdir_SQ)'$$subdir'\"' >> $@; \\\n-\t\techo '\tcp '$$i'.pm \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\tdone\n-\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\techo instlibdir: >> $@\n-\techo '\techo $(instdir_SQ)' >> $@\n-else\n-$(makfile): Makefile.PL ../GIT-CFLAGS\n-\t$(PERL_PATH) $< PREFIX='$(prefix_SQ)' INSTALL_BASE='' --localedir='$(localedir_SQ)'\n-endif\n-\n-# this is just added comfort for calling make directly in perl dir\n-# (even though GIT-CFLAGS aren't used yet. If ever)\n-../GIT-CFLAGS:\n-\t$(MAKE) -C .. GIT-CFLAGS\ndiff --git a/perl/Makefile.PL b/perl/Makefile.PL\ndeleted file mode 100644\nindex 3f29ba98a6..0000000000\n--- a/perl/Makefile.PL\n+++ /dev/null\n@@ -1,62 +0,0 @@\n-use strict;\n-use warnings;\n-use ExtUtils::MakeMaker;\n-use Getopt::Long;\n-use File::Find;\n-\n-# Don't forget to update the perl/Makefile, too.\n-# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease\n-\n-# Sanity: die at first unknown option\n-Getopt::Long::Configure qw/ pass_through /;\n-\n-my $localedir = '';\n-GetOptions(\"localedir=s\" => \\$localedir);\n-\n-sub MY::postamble {\n-\treturn <<'MAKE_FRAG';\n-instlibdir:\n-\t@echo '$(INSTALLSITELIB)'\n-\n-ifneq (,$(DESTDIR))\n-ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))\n-$(error ExtUtils::MakeMaker version \"$(MM_VERSION)\" is older than 6.11 and so \\\n-\tis likely incompatible with the DESTDIR mechanism.  Try setting \\\n-\tNO_PERL_MAKEMAKER=1 instead)\n-endif\n-endif\n-\n-MAKE_FRAG\n-}\n-\n-# Find all the .pm files in \"Git/\" and Git.pm\n-my %pm;\n-find sub {\n-\treturn unless /\\.pm$/;\n-\n-\t# sometimes File::Find prepends a ./  Strip it.\n-\tmy $pm_path = $File::Find::name;\n-\t$pm_path =~ s{^\\./}{};\n-\n-\t$pm{$pm_path} = '$(INST_LIBDIR)/'.$pm_path;\n-}, \"Git\", \"Git.pm\";\n-\n-\n-# We come with our own bundled Error.pm. It's not in the set of default\n-# Perl modules so install it if it's not available on the system yet.\n-if ( !eval { require Error } || $Error::VERSION < 0.15009) {\n-\t$pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';\n-}\n-\n-# redirect stdout, otherwise the message \"Writing perl.mak for Git\"\n-# disrupts the output for the target 'instlibdir'\n-open STDOUT, \">&STDERR\";\n-\n-WriteMakefile(\n-\tNAME            => 'Git',\n-\tVERSION_FROM    => 'Git.pm',\n-\tPM\t\t=> \\%pm,\n-\tPM_FILTER\t=> qq[\\$(PERL) -pe \"s<\\\\Q++LOCALEDIR++\\\\E><$localedir>\"],\n-\tMAKEFILE\t=> 'perl.mak',\n-\tINSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'\n-);\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex 1dbc85b214..0ef5cf1c60 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -1,6 +1,6 @@\n #!/usr/bin/perl\n \n-use lib '../../perl/blib/lib';\n+use lib '../../perl/build';\n use strict;\n use warnings;\n use Git;\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 116bd6a70c..69d81e1c97 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -919,7 +919,7 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/build\n export GITPERLLIB\n test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\ndiff --git a/wrap-for-bin.sh b/wrap-for-bin.sh\nindex 22b6e4948f..7a8429bcc9 100644\n--- a/wrap-for-bin.sh\n+++ b/wrap-for-bin.sh\n@@ -14,7 +14,7 @@ else\n \tGIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'\n \texport GIT_TEMPLATE_DIR\n fi\n-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n+GITPERLLIB='@@BUILD_DIR@@/perl/build'\"${GITPERLLIB:+:$GITPERLLIB}\"\n GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'\n PATH='@@BUILD_DIR@@/bin-wrappers:'\"$PATH\"\n \n-- \n2.15.0.403.gc27cc4dac6\n\n"},{"id":"333830","messageId":"20171130021137.GG15098@aiede.mtv.corp.google.com","threadId":"47345","inReplyTo":"20171129195430.10069-1-avarab@gmail.com","subject":"Re: [PATCH] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-11-30T02:11:37Z","receivedAt":"2017-11-30T02:11:46Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nÆvar Arnfjörð Bjarmason wrote:\n\n> Replace the perl/Makefile.PL and the fallback perl/Makefile used under\n> NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\n> inspired by how the i18n infrastructure's build process works[1].\n\nYay!  This looks exciting.\n\nOne quick comment:\n\n[...]\n>  * We don't build the Git(3) Git::I18N(3) etc. man pages from the\n>    embedded perldoc. I suspect nobody really cares, these are mostly\n>    internal APIs, and if someone's developing against them they likely\n>    know enough to issue a \"perldoc\" against the installed file to get\n>    the same result.\n>\n>    But this is a change in how Git is installed now on e.g. CentOS &\n>    Debian which carry these manpages. They could be added (via\n>    pod2man) if anyone really cares.\n>\n>    I doubt they will. The reason these were built in the first place\n>    was as a side-effect of how ExtUtils::MakeMaker works.\n\nDebian cares (see\nhttps://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html\nfor details).\n\nI'll try applying this patch and seeing what happens some time this\nweek.\n\nThanks,\nJonathan\n"},{"id":"333839","messageId":"87fu8wumy6.fsf@evledraar.booking.com","threadId":"47345","inReplyTo":"20171130021137.GG15098@aiede.mtv.corp.google.com","subject":"Re: [PATCH] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-11-30T09:37:21Z","receivedAt":"2017-11-30T09:38:02Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Nov 30 2017, Jonathan Nieder jotted:\n\n> Hi,\n>\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> Replace the perl/Makefile.PL and the fallback perl/Makefile used under\n>> NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\n>> inspired by how the i18n infrastructure's build process works[1].\n>\n> Yay!  This looks exciting.\n>\n> One quick comment:\n>\n> [...]\n>>  * We don't build the Git(3) Git::I18N(3) etc. man pages from the\n>>    embedded perldoc. I suspect nobody really cares, these are mostly\n>>    internal APIs, and if someone's developing against them they likely\n>>    know enough to issue a \"perldoc\" against the installed file to get\n>>    the same result.\n>>\n>>    But this is a change in how Git is installed now on e.g. CentOS &\n>>    Debian which carry these manpages. They could be added (via\n>>    pod2man) if anyone really cares.\n>>\n>>    I doubt they will. The reason these were built in the first place\n>>    was as a side-effect of how ExtUtils::MakeMaker works.\n>\n> Debian cares (see\n> https://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html\n> for details).\n>\n> I'll try applying this patch and seeing what happens some time this\n> week.\n\nIt just says you have to install the manpages in such-and-such a place,\nbut I don't have any. There, policy issue fixed :)\n\nMore seriously, it seems to me that the only reason we have these\nmanpages in the first place is because of emergent effects. *Maybe* I'm\nwrong about someone using Git.pm as an external API, is that the case?\n\nI was assuming this was more of a case where we were manifying the\nequivalent of Documentation/technical/api-*.txt and shipping them as\nuser docs just because that's what EU::MM will do by default, and nobody\nthought to stop it.\n\nBut sure, if we still want these I can just provide them, here's the\nrelevant generated perl.mak section:\n\n\tPOD2MAN_EXE = $(PERLRUN) \"-MExtUtils::Command::MM\" -e pod2man \"--\"\n\tPOD2MAN = $(POD2MAN_EXE)\n\tmanifypods : pure_all config  \\\n\t\tGit.pm \\\n\t\tGit/I18N.pm \\\n\t\tGit/SVN/Editor.pm \\\n\t\tGit/SVN/Fetcher.pm \\\n\t\tGit/SVN/Memoize/YAML.pm \\\n\t\tGit/SVN/Prompt.pm \\\n\t\tGit/SVN/Ra.pm \\\n\t\tGit/SVN/Utils.pm\n\t\t$(NOECHO) $(POD2MAN) --section=$(MAN3EXT) --perm_rw=$(PERM_RW) -u \\\n\t\t  Git.pm $(INST_MAN3DIR)/Git.$(MAN3EXT) \\\n\t\t  Git/I18N.pm $(INST_MAN3DIR)/Git::I18N.$(MAN3EXT) \\\n\t\t  Git/SVN/Editor.pm $(INST_MAN3DIR)/Git::SVN::Editor.$(MAN3EXT) \\\n\t\t  Git/SVN/Fetcher.pm $(INST_MAN3DIR)/Git::SVN::Fetcher.$(MAN3EXT) \\\n\t\t  Git/SVN/Memoize/YAML.pm $(INST_MAN3DIR)/Git::SVN::Memoize::YAML.$(MAN3EXT) \\\n\t\t  Git/SVN/Prompt.pm $(INST_MAN3DIR)/Git::SVN::Prompt.$(MAN3EXT) \\\n\t\t  Git/SVN/Ra.pm $(INST_MAN3DIR)/Git::SVN::Ra.$(MAN3EXT) \\\n\t\t  Git/SVN/Utils.pm $(INST_MAN3DIR)/Git::SVN::Utils.$(MAN3EXT)\n\nI.e. we'd just need to create the mandir, then call pod2man.\n\nHowever, even then we should consider what I've noted above and decide\nwhich modules we really want to be shipping docs for, e.g. Git::I18n is\nnever going to be used by anyone external, nor is the Git::SVN stuff.\n\nI think the only thing we're talking about shipping manpages for is\n*maybe* just Git.pm itself, no?\n\nI don't really care, so if others want to ship them all I'll just hack\nit up. This just seemed like a bug to fix while I was at it.\n"},{"id":"333870","messageId":"20171130205952.GB20640@aiede.mtv.corp.google.com","threadId":"47345","inReplyTo":"87fu8wumy6.fsf@evledraar.booking.com","subject":"Re: [PATCH] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-11-30T20:59:52Z","receivedAt":"2017-11-30T21:00:05Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n> On Thu, Nov 30 2017, Jonathan Nieder jotted:\n>> Ævar Arnfjörð Bjarmason wrote:\n\n>>>  * We don't build the Git(3) Git::I18N(3) etc. man pages from the\n>>>    embedded perldoc. I suspect nobody really cares, these are mostly\n>>>    internal APIs, and if someone's developing against them they likely\n>>>    know enough to issue a \"perldoc\" against the installed file to get\n>>>    the same result.\n[...]\n>> Debian cares (see\n>> https://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html\n>> for details).\n[...]\n> It just says you have to install the manpages in such-and-such a place,\n> but I don't have any. There, policy issue fixed :)\n>\n> More seriously, it seems to me that the only reason we have these\n> manpages in the first place is because of emergent effects. *Maybe* I'm\n> wrong about someone using Git.pm as an external API, is that the case?\n\nYeah, people really do use Git.pm as an external API.\n\nUnlike e.g. something on CPAN, its API stability guarantees are not\ngreat, so I am not saying I recommend it, but people have been using\nit that way.\n\nIf we want to prevent this, then we should not be installing it in the\npublic perl module path.  Or we should at least add a note to the\nmanpages we ship :) to recommend not using it.\n\nThanks,\nJonathan\n"},{"id":"333871","messageId":"20171130211652.GA26607@starla","threadId":"47345","inReplyTo":"20171130205952.GB20640@aiede.mtv.corp.google.com","subject":"Re: [PATCH] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Eric Wong","fromEmail":"e@80x24.org","sentAt":"2017-11-30T21:16:52Z","receivedAt":"2017-11-30T21:17:04Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Yeah, people really do use Git.pm as an external API.\n\nYikes :<\n\n> If we want to prevent this, then we should not be installing it in the\n> public perl module path.  Or we should at least add a note to the\n> manpages we ship :) to recommend not using it.\n\nI think a note in manpages is fine; maybe a load-time warning\nto non-git.git users.  We shouldn't be breaking other peoples'\ncode when they upgrade, though.\n"},{"id":"333872","messageId":"20171130213105.GA8861@sigill.intra.peff.net","threadId":"47345","inReplyTo":"20171129195430.10069-1-avarab@gmail.com","subject":"Re: [PATCH] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-11-30T21:31:05Z","receivedAt":"2017-11-30T21:31:23Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Nov 29, 2017 at 07:54:30PM +0000, Ævar Arnfjörð Bjarmason wrote:\n\n> Replace the perl/Makefile.PL and the fallback perl/Makefile used under\n> NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\n> inspired by how the i18n infrastructure's build process works[1].\n\nI'm very happy to see the recursive make invocation go away. The perl\nmakefile generation was one of the few places where parallel make could\nracily get confused (though I haven't seen that for a while, so maybe it\nwas fixed alongside some of the other .stamp work you did).\n\n> The reason for having the Makefile.PL in the first place is that it\n> was initially[2] building a perl C binding to interface with libgit,\n> this functionality, that was removed[3] before Git.pm ever made it to\n> the master branch.\n\nThanks for doing all this history digging. I agree that it doesn't seem\nlike there's really any reason to carry the complexity. Of your\nfunctional changes, the only one that gives me pause is:\n\n>  * This will not always install into perl's idea of its global\n>    \"installsitelib\". This only potentially matters for packagers that\n>    need to expose Git.pm for non-git use, and as explained in the\n>    INSTALL file there's a trivial workaround.\n\nThis could be a minor hiccup for people using Git.pm from other scripts.\nBut maybe only in funny setups? It seems like $prefix/share/perl5 would\nbe in most people's @INC unless they are doing something exotic.\n\n>  * We don't build the Git(3) Git::I18N(3) etc. man pages from the\n>    embedded perldoc. I suspect nobody really cares, these are mostly\n>    internal APIs, and if someone's developing against them they likely\n>    know enough to issue a \"perldoc\" against the installed file to get\n>    the same result.\n\nI don't have a real opinion on this, but it sounds from the rest of the\nthread like we should maybe build these to be on the safe side.\n\n> @@ -2291,6 +2273,17 @@ endif\n>  po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n>  \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n>  \n> +PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n\nYuck. :) I don't think there's a better wildcard solution within make,\nthough. And I'd rather see this than doing a $(shell) to \"find\" or\nsimilar.\n\nThe other option is to actually list the files, as we do for .o files.\nThat's a minor pain to update, but it would allow things like\ndifferentiating which ones get their documentation built.\n\n> +PMCFILES := $(patsubst perl/%.pm,perl/build/%.pmc,$(PMFILES))\n\nTIL about pmc files. It sounds like they've had a storied history, but\nshould be supported everywhere.\n\n> [...]\n\nThe rest of the patch all looked good to me. Thanks for working on this.\n\n-Peff\n"},{"id":"333874","messageId":"87bmjjv1pu.fsf@evledraar.booking.com","threadId":"47345","inReplyTo":"20171130213105.GA8861@sigill.intra.peff.net","subject":"Re: [PATCH] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-11-30T22:30:37Z","receivedAt":"2017-11-30T22:30:48Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Nov 30 2017, Jeff King jotted:\n\n> On Wed, Nov 29, 2017 at 07:54:30PM +0000, Ævar Arnfjörð Bjarmason wrote:\n>\n>> Replace the perl/Makefile.PL and the fallback perl/Makefile used under\n>> NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\n>> inspired by how the i18n infrastructure's build process works[1].\n>\n> I'm very happy to see the recursive make invocation go away. The perl\n> makefile generation was one of the few places where parallel make could\n> racily get confused (though I haven't seen that for a while, so maybe it\n> was fixed alongside some of the other .stamp work you did).\n>\n>> The reason for having the Makefile.PL in the first place is that it\n>> was initially[2] building a perl C binding to interface with libgit,\n>> this functionality, that was removed[3] before Git.pm ever made it to\n>> the master branch.\n>\n> Thanks for doing all this history digging. I agree that it doesn't seem\n> like there's really any reason to carry the complexity. Of your\n> functional changes, the only one that gives me pause is:\n>\n>>  * This will not always install into perl's idea of its global\n>>    \"installsitelib\". This only potentially matters for packagers that\n>>    need to expose Git.pm for non-git use, and as explained in the\n>>    INSTALL file there's a trivial workaround.\n>\n> This could be a minor hiccup for people using Git.pm from other scripts.\n> But maybe only in funny setups? It seems like $prefix/share/perl5 would\n> be in most people's @INC unless they are doing something exotic.\n\nI think so, but I'm not 100% sure. I'm hoping downstream maintainers\nwill catch this one if it's an issue, but in many cases it'll just work,\ne.g. I have /usr/share/perl5 in /usr/bin/perl's @INC on Debian even\nthough that's not the target install dir EU::MM would have picked.\n\nWhether there's perl configurations that don't have $prefix/share/perl5\nin @INC at all I don't know.\n\n>>  * We don't build the Git(3) Git::I18N(3) etc. man pages from the\n>>    embedded perldoc. I suspect nobody really cares, these are mostly\n>>    internal APIs, and if someone's developing against them they likely\n>>    know enough to issue a \"perldoc\" against the installed file to get\n>>    the same result.\n>\n> I don't have a real opinion on this, but it sounds from the rest of the\n> thread like we should maybe build these to be on the safe side.\n\nIndeed, we'll need to ship at least the Git.3pm manpage.\n\nI tried coming up with something that worked like the current\nMakefile.PL but couldn't figure out how I'd generate\na::file::like::this.3pm from a/file/like/this.pm\n\nSo I hacked up the following minimal patch to just build Git.3pm:\n\n\tdiff --git a/Makefile b/Makefile\n\tindex 48f1b868d1..ba6607b7e7 100644\n\t--- a/Makefile\n\t+++ b/Makefile\n\t@@ -1709,6 +1709,7 @@ ETC_GITATTRIBUTES_SQ = $(subst ','\\'',$(ETC_GITATTRIBUTES))\n\t DESTDIR_SQ = $(subst ','\\'',$(DESTDIR))\n\t bindir_SQ = $(subst ','\\'',$(bindir))\n\t bindir_relative_SQ = $(subst ','\\'',$(bindir_relative))\n\t+mandir_SQ = $(subst ','\\'',$(mandir))\n\t mandir_relative_SQ = $(subst ','\\'',$(mandir_relative))\n\t infodir_relative_SQ = $(subst ','\\'',$(infodir_relative))\n\t perllibdir_SQ = $(subst ','\\'',$(perllibdir))\n\t@@ -2284,6 +2285,10 @@ perl/build/lib/%.pmc: perl/%.pm\n\t \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n\t \tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n\n\t+perl/build/man/man3/Git.3pm: perl/Git.pm\n\t+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n\t+\tpod2man $< $@\n\t+\n\t FIND_SOURCE_FILES = ( \\\n\t \tgit ls-files \\\n\t \t\t'*.[hcS]' \\\n\t@@ -2595,12 +2600,17 @@ endif\n\t install-gitweb:\n\t \t$(MAKE) -C gitweb install\n\n\t-install-doc:\n\t+install-doc: install-man-perl\n\t \t$(MAKE) -C Documentation install\n\n\t-install-man:\n\t+install-man: install-man-perl\n\t \t$(MAKE) -C Documentation install-man\n\n\t+install-man-perl: perl/build/man/man3/Git.3pm\n\t+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'\n\t+\t(cd perl/build/man/man3 && $(TAR) cf - .) | \\\n\t+\t(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)\n\t+\n\t install-html:\n\t \t$(MAKE) -C Documentation install-html\n\nMaybe this approach is bad, I don't know. This might be a better fit for\nDocumentation/Makefile since it has some \"man\" logic already, but do we\nwant it to be depending on stuff in ../perl?\n\nOn my Debian install I have these from existing Git:\n\n    /usr/share/man/man3/Git.3pm.gz\n    /usr/share/man/man3/Git::I18N.3pm.gz\n    /usr/share/man/man3/private-Error.3pm.gz\n\nWe definitely don't want the 2nd two ones to have manpages, that was\nalways an accident. git-svn has a few more:\n\n    /usr/share/man/man3/Git::SVN::Editor.3pm.gz\n    /usr/share/man/man3/Git::SVN::Fetcher.3pm.gz\n    /usr/share/man/man3/Git::SVN::Memoize::YAML.3pm.gz\n    /usr/share/man/man3/Git::SVN::Prompt.3pm.gz\n    /usr/share/man/man3/Git::SVN::Ra.3pm.gz\n    /usr/share/man/man3/Git::SVN::Utils.3pm.gz\n\nBut those all say that they're internal API only. So maybe this hack of\nmine is fine. What do others think?\n\nIn any case, a solution that tries to build all the manpages with a glob\nis going to suck currently since some of them have POD, and others\ndon't, which gets us into the headache of trying to distinguish whether\nsomething has POD v.s. whether we just had pod2man fail.\n\nSo it seems better just to whitelist the man3 pages that get build,\nwhich to me seems like just one currently.\n\n\n\n>> @@ -2291,6 +2273,17 @@ endif\n>>  po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n>>  \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n>>\n>> +PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n>\n> Yuck. :) I don't think there's a better wildcard solution within make,\n> though. And I'd rather see this than doing a $(shell) to \"find\" or\n> similar.\n>\n> The other option is to actually list the files, as we do for .o files.\n> That's a minor pain to update, but it would allow things like\n> differentiating which ones get their documentation built.\n>\n>> +PMCFILES := $(patsubst perl/%.pm,perl/build/%.pmc,$(PMFILES))\n>\n> TIL about pmc files. It sounds like they've had a storied history, but\n> should be supported everywhere.\n>\n>> [...]\n>\n> The rest of the patch all looked good to me. Thanks for working on this.\n>\n> -Peff\n"},{"id":"333993","messageId":"20171203115941.16674-1-avarab@gmail.com","threadId":"47345","inReplyTo":"20171129195430.10069-1-avarab@gmail.com","subject":"[PATCH v2] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-12-03T11:59:41Z","receivedAt":"2017-12-03T12:06:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Replace the perl/Makefile.PL and the fallback perl/Makefile used under\nNO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\ninspired by how the i18n infrastructure's build process works[1].\n\nThe reason for having the Makefile.PL in the first place is that it\nwas initially[2] building a perl C binding to interface with libgit,\nthis functionality, that was removed[3] before Git.pm ever made it to\nthe master branch.\n\nWe've since since started maintaining a fallback perl/Makefile, as\nMakeMaker wouldn't work on some platforms[4]. That's just the tip of\nthe iceberg. We have the PM.stamp hack in the top-level Makefile[5] to\ndetect whether we need to regenerate the perl/perl.mak, which I fixed\njust recently to deal with issues like the perl version changing from\nunder us[6].\n\nThere is absolutely no reason for why this needs to be so complex\nanymore. All we're getting out of this elaborate Rube Goldberg machine\nwas copying perl/* to perl/blib/* as we do a string-replacement on\nthe *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as\npod2man-ing Git.pm & friends.\n\nSo replace the whole thing with something that's pretty much a copy of\nhow we generate po/build/**.mo from po/*.po, just with a small sed(1)\ncommand instead of msgfmt. As that's being done rename the files\nfrom *.pm to *.pmc just to indicate that they're genreated (see\n\"perldoc -f require\").\n\nWhile I'm at it, change the fallback for Error.pm from being something\nwhere we'll ship our own Error.pm if one doesn't exist at build time\nto one where we just use a Git::Error wrapper that'll always prefer\nthe system-wide Error.pm, only falling back to our own copy if it\nreally doesn't exist at runtime. It's now shipped as\nGit::FromCPAN::Error, making it easy to add other modules to\nGit::FromCPAN::* in the future if that's needed.\n\nFunctional changes:\n\n * This will not always install into perl's idea of its global\n   \"installsitelib\". This only potentially matters for packagers that\n   need to expose Git.pm for non-git use, and as explained in the\n   INSTALL file there's a trivial workaround.\n\n * The scripts themselves will 'use lib' the target directory, but if\n   INSTLIBDIR is set it overrides it. It doesn't have to be this way,\n   it could be set in addition to INSTLIBDIR, but my reading of [7] is\n   that this is the desired behavior.\n\n * We don't man pages for all of the perl modules as we used t, only\n   Git(3pm). As discussed on-list[8] that we were building installed\n   manpages for purely internal APIs like Git::I18N or\n   private-Error.pm was always a bug anyway, and all the Git::SVN::*\n   ones say they're internal APIs.\n\n   There are apparently external users of Git.pm, but I don't expect\n   there to be any of the others.\n\n   As a side-effect of these general changes the perl documentation\n   now only installed by install-{doc,man}, not a mere \"install\" as\n   before.\n\n1. 5e9637c629 (\"i18n: add infrastructure for translating Git with\n   gettext\", 2011-11-18)\n\n2. b1edc53d06 (\"Introduce Git.pm (v4)\", 2006-06-24)\n\n3. 18b0fc1ce1 (\"Git.pm: Kill Git.xs for now\", 2006-09-23)\n\n4. f848718a69 (\"Make perl/ build procedure ActiveState friendly.\",\n   2006-12-04)\n\n5. ee9be06770 (\"perl: detect new files in MakeMaker builds\",\n   2012-07-27)\n\n6. c59c4939c2 (\"perl: regenerate perl.mak if perl -V changes\",\n   2017-03-29)\n\n7. 0386dd37b1 (\"Makefile: add PERLLIB_EXTRA variable that adds to\n   default perl path\", 2013-11-15)\n\n8. 87bmjjv1pu.fsf@evledraar.booking.com (\"Re: [PATCH] Makefile:\n   replace perl/Makefile.PL with simple make rules\"\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nPer my reading of the list discussion this should be OK to apply. We\nnow build the manpage for Git.pm (but no other *.pm, as discussed).\n\nAside from the improved commit message & POD building I updated the\nINSTALL instructions & we now build stuff in perl/build/{lib,man}\ninstead of just PM stuff in perl/build/lib. tbdiff with v2 follows:\n\n    1: 6eae4593dc ! 1: 90ee965ea6 Makefile: replace perl/Makefile.PL with simple make rules\n        @@ -21,7 +21,8 @@\n             There is absolutely no reason for why this needs to be so complex\n             anymore. All we're getting out of this elaborate Rube Goldberg machine\n             was copying perl/* to perl/blib/* as we do a string-replacement on\n        -    the *.pm files to hardcode @@LOCALEDIR@@ in the source.\n        +    the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as\n        +    pod2man-ing Git.pm & friends.\n             \n             So replace the whole thing with something that's pretty much a copy of\n             how we generate po/build/**.mo from po/*.po, just with a small sed(1)\n        @@ -49,18 +50,18 @@\n                it could be set in addition to INSTLIBDIR, but my reading of [7] is\n                that this is the desired behavior.\n             \n        -     * We don't build the Git(3) Git::I18N(3) etc. man pages from the\n        -       embedded perldoc. I suspect nobody really cares, these are mostly\n        -       internal APIs, and if someone's developing against them they likely\n        -       know enough to issue a \"perldoc\" against the installed file to get\n        -       the same result.\n        -    \n        -       But this is a change in how Git is installed now on e.g. CentOS &\n        -       Debian which carry these manpages. They could be added (via\n        -       pod2man) if anyone really cares.\n        -    \n        -       I doubt they will. The reason these were built in the first place\n        -       was as a side-effect of how ExtUtils::MakeMaker works.\n        +     * We don't man pages for all of the perl modules as we used t, only\n        +       Git(3pm). As discussed on-list[8] that we were building installed\n        +       manpages for purely internal APIs like Git::I18N or\n        +       private-Error.pm was always a bug anyway, and all the Git::SVN::*\n        +       ones say they're internal APIs.\n        +    \n        +       There are apparently external users of Git.pm, but I don't expect\n        +       there to be any of the others.\n        +    \n        +       As a side-effect of these general changes the perl documentation\n        +       now only installed by install-{doc,man}, not a mere \"install\" as\n        +       before.\n             \n             1. 5e9637c629 (\"i18n: add infrastructure for translating Git with\n                gettext\", 2011-11-18)\n        @@ -80,6 +81,9 @@\n             \n             7. 0386dd37b1 (\"Makefile: add PERLLIB_EXTRA variable that adds to\n                default perl path\", 2013-11-15)\n        +    \n        +    8. 87bmjjv1pu.fsf@evledraar.booking.com (\"Re: [PATCH] Makefile:\n        +       replace perl/Makefile.PL with simple make rules\"\n             \n             Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n         \n        @@ -91,7 +95,7 @@\n          \tGIT_EXEC_PATH=`pwd`\n          \tPATH=`pwd`:$PATH\n         -\tGITPERLLIB=`pwd`/perl/blib/lib\n        -+\tGITPERLLIB=`pwd`/perl/build\n        ++\tGITPERLLIB=`pwd`/perl/build/lib\n          \texport GIT_EXEC_PATH PATH GITPERLLIB\n          \n         + - By default (unless NO_PERL is provided) Git will ship various perl\n        @@ -154,7 +158,10 @@\n          \tCOMPAT_CFLAGS += -DNO_HSTRERROR\n          \tCOMPAT_OBJS += compat/hstrerror.o\n         @@\n        + DESTDIR_SQ = $(subst ','\\'',$(DESTDIR))\n        + bindir_SQ = $(subst ','\\'',$(bindir))\n          bindir_relative_SQ = $(subst ','\\'',$(bindir_relative))\n        ++mandir_SQ = $(subst ','\\'',$(mandir))\n          mandir_relative_SQ = $(subst ','\\'',$(mandir_relative))\n          infodir_relative_SQ = $(subst ','\\'',$(infodir_relative))\n         +perllibdir_SQ = $(subst ','\\'',$(perllibdir))\n        @@ -194,11 +201,11 @@\n         -\t$(PERL_PATH) -V >>$@+ && \\\n         -\t{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \\\n         -\t$(RM) $@+\n        -+$(SCRIPT_PERL_GEN):\n        - \n        +-\n         -perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL\n         -\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)\n        --\n        ++$(SCRIPT_PERL_GEN):\n        + \n         -PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n         -$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n         +PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n        @@ -220,15 +227,19 @@\n          \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n          \n         +PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n        -+PMCFILES := $(patsubst perl/%.pm,perl/build/%.pmc,$(PMFILES))\n        ++PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))\n         +\n         +ifndef NO_PERL\n         +all:: $(PMCFILES)\n         +endif\n         +\n        -+perl/build/%.pmc: perl/%.pm\n        ++perl/build/lib/%.pmc: perl/%.pm\n         +\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n         +\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n        ++\n        ++perl/build/man/man3/Git.3pm: perl/Git.pm\n        ++\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n        ++\tpod2man $< $@\n         +\n          FIND_SOURCE_FILES = ( \\\n          \tgit ls-files \\\n        @@ -239,11 +250,31 @@\n          ifndef NO_PERL\n         -\t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n         +\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n        -+\t(cd perl/build && $(TAR) cf - .) | \\\n        ++\t(cd perl/build/lib && $(TAR) cf - .) | \\\n         +\t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n          \t$(MAKE) -C gitweb install\n          endif\n          ifndef NO_TCLTK\n        +@@\n        + install-gitweb:\n        + \t$(MAKE) -C gitweb install\n        + \n        +-install-doc:\n        ++install-doc: install-man-perl\n        + \t$(MAKE) -C Documentation install\n        + \n        +-install-man:\n        ++install-man: install-man-perl\n        + \t$(MAKE) -C Documentation install-man\n        + \n        ++install-man-perl: perl/build/man/man3/Git.3pm\n        ++\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'\n        ++\t(cd perl/build/man/man3 && $(TAR) cf - .) | \\\n        ++\t(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)\n        ++\n        + install-html:\n        + \t$(MAKE) -C Documentation install-html\n        + \n         @@\n          \t$(MAKE) -C Documentation/ clean\n          ifndef NO_PERL\n        @@ -549,7 +580,7 @@\n          #!/usr/bin/perl\n          \n         -use lib '../../perl/blib/lib';\n        -+use lib '../../perl/build';\n        ++use lib '../../perl/build/lib';\n          use strict;\n          use warnings;\n          use Git;\n        @@ -562,7 +593,7 @@\n          fi\n          \n         -GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n        -+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/build\n        ++GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/build/lib\n          export GITPERLLIB\n          test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n          \terror \"You haven't built things yet, have you?\"\n        @@ -575,7 +606,7 @@\n          \texport GIT_TEMPLATE_DIR\n          fi\n         -GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n        -+GITPERLLIB='@@BUILD_DIR@@/perl/build'\"${GITPERLLIB:+:$GITPERLLIB}\"\n        ++GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n          GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'\n          PATH='@@BUILD_DIR@@/bin-wrappers:'\"$PATH\"\n          \n\n INSTALL                                          | 17 ++++-\n Makefile                                         | 67 ++++++++++--------\n contrib/examples/git-difftool.perl               |  2 +-\n git-send-email.perl                              |  2 +-\n perl/.gitignore                                  |  9 +--\n perl/Git.pm                                      |  2 +-\n perl/Git/Error.pm                                | 47 +++++++++++++\n perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0\n perl/Git/I18N.pm                                 |  2 +-\n perl/Makefile                                    | 90 ------------------------\n perl/Makefile.PL                                 | 62 ----------------\n t/perf/aggregate.perl                            |  2 +-\n t/test-lib.sh                                    |  2 +-\n wrap-for-bin.sh                                  |  2 +-\n 14 files changed, 107 insertions(+), 199 deletions(-)\n create mode 100644 perl/Git/Error.pm\n rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)\n delete mode 100644 perl/Makefile\n delete mode 100644 perl/Makefile.PL\n\ndiff --git a/INSTALL b/INSTALL\nindex ffb071e9f0..808e07b659 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -84,9 +84,24 @@ Issues of note:\n \n \tGIT_EXEC_PATH=`pwd`\n \tPATH=`pwd`:$PATH\n-\tGITPERLLIB=`pwd`/perl/blib/lib\n+\tGITPERLLIB=`pwd`/perl/build/lib\n \texport GIT_EXEC_PATH PATH GITPERLLIB\n \n+ - By default (unless NO_PERL is provided) Git will ship various perl\n+   scripts & libraries it needs. However, for simplicity it doesn't\n+   use the ExtUtils::MakeMaker toolchain to decide where to place the\n+   perl libraries. Depending on the system this can result in the perl\n+   libraries not being where you'd like them if they're expected to be\n+   used by things other than Git itself.\n+\n+   Manually supplying a perllibdir prefix should fix this, if this is\n+   a problem you care about, e.g.:\n+\n+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')\n+\n+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,\n+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.\n+\n  - Git is reasonably self-sufficient, but does depend on a few external\n    programs and libraries.  Git can be used without most of them by adding\n    the approriate \"NO_<LIBRARY>=YesPlease\" to the make command line or\ndiff --git a/Makefile b/Makefile\nindex e53750ca01..ba6607b7e7 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -295,9 +295,6 @@ all::\n #\n # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).\n #\n-# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n-# MakeMaker (e.g. using ActiveState under Cygwin).\n-#\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n@@ -473,6 +470,7 @@ gitexecdir = libexec/git-core\n mergetoolsdir = $(gitexecdir)/mergetools\n sharedir = $(prefix)/share\n gitwebdir = $(sharedir)/gitweb\n+perllibdir = $(sharedir)/perl5\n localedir = $(sharedir)/locale\n template_dir = share/git-core/templates\n htmldir = $(prefix)/share/doc/git-doc\n@@ -486,7 +484,7 @@ mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))\n infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))\n htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))\n \n-export prefix bindir sharedir sysconfdir gitwebdir localedir\n+export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir\n \n CC = cc\n AR = ar\n@@ -1525,9 +1523,6 @@ ifdef SHA1_MAX_BLOCK_SIZE\n \tLIB_OBJS += compat/sha1-chunked.o\n \tBASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE=\"$(SHA1_MAX_BLOCK_SIZE)\"\n endif\n-ifdef NO_PERL_MAKEMAKER\n-\texport NO_PERL_MAKEMAKER\n-endif\n ifdef NO_HSTRERROR\n \tCOMPAT_CFLAGS += -DNO_HSTRERROR\n \tCOMPAT_OBJS += compat/hstrerror.o\n@@ -1714,8 +1709,10 @@ ETC_GITATTRIBUTES_SQ = $(subst ','\\'',$(ETC_GITATTRIBUTES))\n DESTDIR_SQ = $(subst ','\\'',$(DESTDIR))\n bindir_SQ = $(subst ','\\'',$(bindir))\n bindir_relative_SQ = $(subst ','\\'',$(bindir_relative))\n+mandir_SQ = $(subst ','\\'',$(mandir))\n mandir_relative_SQ = $(subst ','\\'',$(mandir_relative))\n infodir_relative_SQ = $(subst ','\\'',$(infodir_relative))\n+perllibdir_SQ = $(subst ','\\'',$(perllibdir))\n localedir_SQ = $(subst ','\\'',$(localedir))\n gitexecdir_SQ = $(subst ','\\'',$(gitexecdir))\n template_dir_SQ = $(subst ','\\'',$(template_dir))\n@@ -1824,9 +1821,6 @@ all::\n ifndef NO_TCLTK\n \t$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all\n \t$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all\n-endif\n-ifndef NO_PERL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all\n endif\n \t$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'\n \n@@ -1907,7 +1901,8 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)\n \n SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\\\n \t$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\\\n-\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV)\n+\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\\\n+\t$(perllibdir_SQ)\n define cmd_munge_script\n $(RM) $@ $@+ && \\\n sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n@@ -1951,29 +1946,17 @@ git.res: git.rc GIT-VERSION-FILE\n $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS\n \n ifndef NO_PERL\n-$(SCRIPT_PERL_GEN): perl/perl.mak\n-\n-perl/perl.mak: perl/PM.stamp\n-\n-perl/PM.stamp: FORCE\n-\t@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \\\n-\t$(PERL_PATH) -V >>$@+ && \\\n-\t{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \\\n-\t$(RM) $@+\n-\n-perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)\n+$(SCRIPT_PERL_GEN):\n \n-PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n-$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n+PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n+$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\n-\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n+\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n \t    -e '\tH' \\\n \t    -e '\tx' \\\n \t    -e '}' \\\n@@ -2291,6 +2274,21 @@ endif\n po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n \n+PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n+PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))\n+\n+ifndef NO_PERL\n+all:: $(PMCFILES)\n+endif\n+\n+perl/build/lib/%.pmc: perl/%.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n+\n+perl/build/man/man3/Git.3pm: perl/Git.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tpod2man $< $@\n+\n FIND_SOURCE_FILES = ( \\\n \tgit ls-files \\\n \t\t'*.[hcS]' \\\n@@ -2550,7 +2548,9 @@ ifndef NO_GETTEXT\n \t(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)\n endif\n ifndef NO_PERL\n-\t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n+\t(cd perl/build/lib && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n \t$(MAKE) -C gitweb install\n endif\n ifndef NO_TCLTK\n@@ -2600,12 +2600,17 @@ endif\n install-gitweb:\n \t$(MAKE) -C gitweb install\n \n-install-doc:\n+install-doc: install-man-perl\n \t$(MAKE) -C Documentation install\n \n-install-man:\n+install-man: install-man-perl\n \t$(MAKE) -C Documentation install-man\n \n+install-man-perl: perl/build/man/man3/Git.3pm\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'\n+\t(cd perl/build/man/man3 && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)\n+\n install-html:\n \t$(MAKE) -C Documentation install-html\n \n@@ -2697,7 +2702,7 @@ clean: profile-clean coverage-clean\n \t$(MAKE) -C Documentation/ clean\n ifndef NO_PERL\n \t$(MAKE) -C gitweb clean\n-\t$(MAKE) -C perl clean\n+\t$(RM) -r perl/build/\n endif\n \t$(MAKE) -C templates/ clean\n \t$(MAKE) -C t/ clean\ndiff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl\nindex df59bdfe97..fb0fd0b84b 100755\n--- a/contrib/examples/git-difftool.perl\n+++ b/contrib/examples/git-difftool.perl\n@@ -13,7 +13,7 @@\n use 5.008;\n use strict;\n use warnings;\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use File::Basename qw(dirname);\n use File::Copy;\n use File::Find;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 2208dcc213..88a0edcd7d 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -26,7 +26,7 @@ use Text::ParseWords;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n use File::Spec::Functions qw(catdir catfile);\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\ndiff --git a/perl/.gitignore b/perl/.gitignore\nindex 0f1fc27f86..84c048a73c 100644\n--- a/perl/.gitignore\n+++ b/perl/.gitignore\n@@ -1,8 +1 @@\n-perl.mak\n-perl.mak.old\n-MYMETA.json\n-MYMETA.yml\n-blib\n-blibdirs\n-pm_to_blib\n-PM.stamp\n+/build/\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex ffa09ace92..02a3871e94 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -101,7 +101,7 @@ increase notwithstanding).\n \n \n use Carp qw(carp croak); # but croak is bad - throw instead\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\ndiff --git a/perl/Git/Error.pm b/perl/Git/Error.pm\nnew file mode 100644\nindex 0000000000..a0cd3b8280\n--- /dev/null\n+++ b/perl/Git/Error.pm\n@@ -0,0 +1,47 @@\n+package Git::Error;\n+use 5.008;\n+use strict;\n+use warnings;\n+\n+=head1 NAME\n+\n+Git::Error - Wrapper for the L<Error> module, in case it's not installed\n+\n+=head1 DESCRIPTION\n+\n+Wraps the import function for the L<Error> module. The L<Git> module\n+must be imported first.\n+\n+This module is only intended to be used for code shipping in the\n+C<git.git> repository. Use it for anything else at your peril!\n+\n+=cut\n+\n+sub import {\n+    shift;\n+    my $caller = caller;\n+\n+    eval {\n+\trequire Error;\n+\t1;\n+    } or do {\n+\tmy $error = $@ || \"Zombie Error\";\n+\n+\tmy $Git_pm_path = $INC{\"Git.pm\"} || die \"BUG: Should have loaded the Git module first!\";\n+\n+\trequire File::Basename;\n+\tmy $Git_pm_root = File::Basename::dirname($Git_pm_path) || die \"BUG: Can't figure out dirname from '$Git_pm_path'!\";\n+\n+\trequire File::Spec;\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_pm_root, qw(Git FromCPAN));\n+\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n+\n+\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n+\trequire Error;\n+    };\n+\n+    local @_ = ($caller, @_);\n+    goto &Error::import;\n+}\n+\n+1;\ndiff --git a/perl/private-Error.pm b/perl/Git/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/private-Error.pm\nrename to perl/Git/FromCPAN/Error.pm\ndiff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm\nindex 836a5c2382..dba96fff0a 100644\n--- a/perl/Git/I18N.pm\n+++ b/perl/Git/I18N.pm\n@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;\n \n sub __bootstrap_locale_messages {\n \tour $TEXTDOMAIN = 'git';\n-\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';\n+\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';\n \n \trequire POSIX;\n \tPOSIX->import(qw(setlocale));\ndiff --git a/perl/Makefile b/perl/Makefile\ndeleted file mode 100644\nindex f657de20e3..0000000000\n--- a/perl/Makefile\n+++ /dev/null\n@@ -1,90 +0,0 @@\n-#\n-# Makefile for perl support modules and routine\n-#\n-makfile:=perl.mak\n-modules =\n-\n-PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n-prefix_SQ = $(subst ','\\'',$(prefix))\n-localedir_SQ = $(subst ','\\'',$(localedir))\n-\n-ifndef V\n-\tQUIET = @\n-endif\n-\n-all install instlibdir: $(makfile)\n-\t$(QUIET)$(MAKE) -f $(makfile) $@\n-\n-clean:\n-\t$(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0\n-\t$(RM) ppport.h\n-\t$(RM) $(makfile)\n-\t$(RM) $(makfile).old\n-\t$(RM) PM.stamp\n-\n-$(makfile): PM.stamp\n-\n-ifdef NO_PERL_MAKEMAKER\n-instdir_SQ = $(subst ','\\'',$(prefix)/lib)\n-\n-modules += Git\n-modules += Git/I18N\n-modules += Git/IndexInfo\n-modules += Git/Packet\n-modules += Git/SVN\n-modules += Git/SVN/Memoize/YAML\n-modules += Git/SVN/Fetcher\n-modules += Git/SVN/Editor\n-modules += Git/SVN/GlobSpec\n-modules += Git/SVN/Log\n-modules += Git/SVN/Migration\n-modules += Git/SVN/Prompt\n-modules += Git/SVN/Ra\n-modules += Git/SVN/Utils\n-\n-$(makfile): ../GIT-CFLAGS Makefile\n-\techo all: private-Error.pm Git.pm Git/I18N.pm > $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) blib/lib/'$$i'.pm' >> $@; \\\n-\t\techo '\tmkdir -p blib/lib'$$subdir >> $@; \\\n-\t\techo '\tcp '$$i'.pm blib/lib/'$$i'.pm' >> $@; \\\n-\tdone\n-\techo '\t$(RM) blib/lib/Error.pm' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm blib/lib/Error.pm' >> $@\n-\techo install: >> $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\t\techo '\tmkdir -p \"$$(DESTDIR)$(instdir_SQ)'$$subdir'\"' >> $@; \\\n-\t\techo '\tcp '$$i'.pm \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\tdone\n-\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\techo instlibdir: >> $@\n-\techo '\techo $(instdir_SQ)' >> $@\n-else\n-$(makfile): Makefile.PL ../GIT-CFLAGS\n-\t$(PERL_PATH) $< PREFIX='$(prefix_SQ)' INSTALL_BASE='' --localedir='$(localedir_SQ)'\n-endif\n-\n-# this is just added comfort for calling make directly in perl dir\n-# (even though GIT-CFLAGS aren't used yet. If ever)\n-../GIT-CFLAGS:\n-\t$(MAKE) -C .. GIT-CFLAGS\ndiff --git a/perl/Makefile.PL b/perl/Makefile.PL\ndeleted file mode 100644\nindex 3f29ba98a6..0000000000\n--- a/perl/Makefile.PL\n+++ /dev/null\n@@ -1,62 +0,0 @@\n-use strict;\n-use warnings;\n-use ExtUtils::MakeMaker;\n-use Getopt::Long;\n-use File::Find;\n-\n-# Don't forget to update the perl/Makefile, too.\n-# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease\n-\n-# Sanity: die at first unknown option\n-Getopt::Long::Configure qw/ pass_through /;\n-\n-my $localedir = '';\n-GetOptions(\"localedir=s\" => \\$localedir);\n-\n-sub MY::postamble {\n-\treturn <<'MAKE_FRAG';\n-instlibdir:\n-\t@echo '$(INSTALLSITELIB)'\n-\n-ifneq (,$(DESTDIR))\n-ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))\n-$(error ExtUtils::MakeMaker version \"$(MM_VERSION)\" is older than 6.11 and so \\\n-\tis likely incompatible with the DESTDIR mechanism.  Try setting \\\n-\tNO_PERL_MAKEMAKER=1 instead)\n-endif\n-endif\n-\n-MAKE_FRAG\n-}\n-\n-# Find all the .pm files in \"Git/\" and Git.pm\n-my %pm;\n-find sub {\n-\treturn unless /\\.pm$/;\n-\n-\t# sometimes File::Find prepends a ./  Strip it.\n-\tmy $pm_path = $File::Find::name;\n-\t$pm_path =~ s{^\\./}{};\n-\n-\t$pm{$pm_path} = '$(INST_LIBDIR)/'.$pm_path;\n-}, \"Git\", \"Git.pm\";\n-\n-\n-# We come with our own bundled Error.pm. It's not in the set of default\n-# Perl modules so install it if it's not available on the system yet.\n-if ( !eval { require Error } || $Error::VERSION < 0.15009) {\n-\t$pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';\n-}\n-\n-# redirect stdout, otherwise the message \"Writing perl.mak for Git\"\n-# disrupts the output for the target 'instlibdir'\n-open STDOUT, \">&STDERR\";\n-\n-WriteMakefile(\n-\tNAME            => 'Git',\n-\tVERSION_FROM    => 'Git.pm',\n-\tPM\t\t=> \\%pm,\n-\tPM_FILTER\t=> qq[\\$(PERL) -pe \"s<\\\\Q++LOCALEDIR++\\\\E><$localedir>\"],\n-\tMAKEFILE\t=> 'perl.mak',\n-\tINSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'\n-);\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex 1dbc85b214..923044df6a 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -1,6 +1,6 @@\n #!/usr/bin/perl\n \n-use lib '../../perl/blib/lib';\n+use lib '../../perl/build/lib';\n use strict;\n use warnings;\n use Git;\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 116bd6a70c..85a0fabb47 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -919,7 +919,7 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/build/lib\n export GITPERLLIB\n test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\ndiff --git a/wrap-for-bin.sh b/wrap-for-bin.sh\nindex 22b6e4948f..5842408817 100644\n--- a/wrap-for-bin.sh\n+++ b/wrap-for-bin.sh\n@@ -14,7 +14,7 @@ else\n \tGIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'\n \texport GIT_TEMPLATE_DIR\n fi\n-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'\n PATH='@@BUILD_DIR@@/bin-wrappers:'\"$PATH\"\n \n-- \n2.15.0.403.gc27cc4dac6\n\n"},{"id":"334061","messageId":"xmqqzi6ympi9.fsf@gitster.mtv.corp.google.com","threadId":"47345","inReplyTo":"20171203115941.16674-1-avarab@gmail.com","subject":"Re: [PATCH v2] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-04T16:22:54Z","receivedAt":"2017-12-04T16:23:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I did this immediately after applying; please double check.\n\nThanks.\n\n1: da337670f5 ! 1: aeae85bdd0 Makefile: replace perl/Makefile.PL with simple make rules\n    @@ -27,7 +27,7 @@\n         So replace the whole thing with something that's pretty much a copy of\n         how we generate po/build/**.mo from po/*.po, just with a small sed(1)\n         command instead of msgfmt. As that's being done rename the files\n    -    from *.pm to *.pmc just to indicate that they're genreated (see\n    +    from *.pm to *.pmc just to indicate that they're generated (see\n         \"perldoc -f require\").\n\n         While I'm at it, change the fallback for Error.pm from being something\n    @@ -50,9 +50,9 @@\n            it could be set in addition to INSTLIBDIR, but my reading of [7] is\n            that this is the desired behavior.\n\n    -     * We don't man pages for all of the perl modules as we used t, only\n    -       Git(3pm). As discussed on-list[8] that we were building installed\n    -       manpages for purely internal APIs like Git::I18N or\n    +     * We don't build man pages for all of the perl modules as we used to,\n    +       only Git(3pm). As discussed on-list[8] that we were building\n    +       installed manpages for purely internal APIs like Git::I18N or\n            private-Error.pm was always a bug anyway, and all the Git::SVN::*\n            ones say they're internal APIs.\n\n:\n"},{"id":"334075","messageId":"CACBZZX6mEzrTdD=B7gAeLSufPR-ZEj8wO8kXsJmrJFtSbT35yQ@mail.gmail.com","threadId":"47345","inReplyTo":"xmqqzi6ympi9.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-12-04T18:08:04Z","receivedAt":"2017-12-04T18:08:31Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Mon, Dec 4, 2017 at 5:22 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> I did this immediately after applying; please double check.\n>\n> Thanks.\n\nThanks. Looks good to me. I'll incorporate that info future\nsubmissions if there's more stuff to fix, but for now if you could\nqueue it like that that would be great.\n\n> 1: da337670f5 ! 1: aeae85bdd0 Makefile: replace perl/Makefile.PL with simple make rules\n>     @@ -27,7 +27,7 @@\n>          So replace the whole thing with something that's pretty much a copy of\n>          how we generate po/build/**.mo from po/*.po, just with a small sed(1)\n>          command instead of msgfmt. As that's being done rename the files\n>     -    from *.pm to *.pmc just to indicate that they're genreated (see\n>     +    from *.pm to *.pmc just to indicate that they're generated (see\n>          \"perldoc -f require\").\n>\n>          While I'm at it, change the fallback for Error.pm from being something\n>     @@ -50,9 +50,9 @@\n>             it could be set in addition to INSTLIBDIR, but my reading of [7] is\n>             that this is the desired behavior.\n>\n>     -     * We don't man pages for all of the perl modules as we used t, only\n>     -       Git(3pm). As discussed on-list[8] that we were building installed\n>     -       manpages for purely internal APIs like Git::I18N or\n>     +     * We don't build man pages for all of the perl modules as we used to,\n>     +       only Git(3pm). As discussed on-list[8] that we were building\n>     +       installed manpages for purely internal APIs like Git::I18N or\n>             private-Error.pm was always a bug anyway, and all the Git::SVN::*\n>             ones say they're internal APIs.\n>\n> :\n"},{"id":"334081","messageId":"xmqq4lp6mg96.fsf@gitster.mtv.corp.google.com","threadId":"47345","inReplyTo":"CACBZZX6mEzrTdD=B7gAeLSufPR-ZEj8wO8kXsJmrJFtSbT35yQ@mail.gmail.com","subject":"Re: [PATCH v2] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-04T19:42:45Z","receivedAt":"2017-12-04T19:42:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> On Mon, Dec 4, 2017 at 5:22 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> I did this immediately after applying; please double check.\n>>\n>> Thanks.\n>\n> Thanks. Looks good to me. I'll incorporate that info future\n> submissions if there's more stuff to fix, but for now if you could\n> queue it like that that would be great.\n\nWell the thing is that I cannot queue this and Dan's at the same\ntime, while both of these topics are expected to be in flux.  For\ntoday's pushout, I tentatively kicked out Dan's relative path series\nand queued this one to see how well it works with the rest of the\nsystem, after giving this patch another round of reading.\n\nIt seemed that Dan was happy with (an earlier draft of?) this\nbuild procedure simplification patch, so hopefully we can solidify\nthis one reasonably quickly and ask the relative path series to be\nrebuilt on top of it?\n\nThanks.\n"},{"id":"334083","messageId":"20171204195121.6647-1-dnj@google.com","threadId":"47345","inReplyTo":"xmqq4lp6mg96.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Dan Jacques","fromEmail":"dnj@google.com","sentAt":"2017-12-04T19:51:21Z","receivedAt":"2017-12-04T19:51:30Z","isPatch":true,"sender":{"key":"dnj@google.com","avatar":"https://avatars.githubusercontent.com/u/9965104?v=4"},"body":"Junio C Hamano writes:\n\n> Well the thing is that I cannot queue this and Dan's at the same\n> time, while both of these topics are expected to be in flux.  For\n> today's pushout, I tentatively kicked out Dan's relative path series\n> and queued this one to see how well it works with the rest of the\n> system, after giving this patch another round of reading.\n>\n> It seemed that Dan was happy with (an earlier draft of?) this\n> build procedure simplification patch, so hopefully we can solidify\n> this one reasonably quickly and ask the relative path series to be\n> rebuilt on top of it?\n\nSounds good to me! I'm in no rush, and if this is moving forward I'm more\nthan happy to wait for it to land and rebase on top.\n\nI didn't want to weigh in too heavily on the actual details of this patch\nsince I think the majority stakeholders are the folks who maintain the Perl\nsubsystem and those who build distribution packages. My work on Perl only\ntouches installation as a means to an end, and avarab@'s work does simplify\nthis for me.\n\nCheers, and thanks!\n-Dan\n"},{"id":"334574","messageId":"20171210211333.9820-1-avarab@gmail.com","threadId":"47345","inReplyTo":"20171129195430.10069-1-avarab@gmail.com","subject":"[PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-12-10T21:13:33Z","receivedAt":"2017-12-10T21:13:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Replace the perl/Makefile.PL and the fallback perl/Makefile used under\nNO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\ninspired by how the i18n infrastructure's build process works[1].\n\nThe reason for having the Makefile.PL in the first place is that it\nwas initially[2] building a perl C binding to interface with libgit,\nthis functionality, that was removed[3] before Git.pm ever made it to\nthe master branch.\n\nWe've since since started maintaining a fallback perl/Makefile, as\nMakeMaker wouldn't work on some platforms[4]. That's just the tip of\nthe iceberg. We have the PM.stamp hack in the top-level Makefile[5] to\ndetect whether we need to regenerate the perl/perl.mak, which I fixed\njust recently to deal with issues like the perl version changing from\nunder us[6].\n\nThere is absolutely no reason for why this needs to be so complex\nanymore. All we're getting out of this elaborate Rube Goldberg machine\nwas copying perl/* to perl/blib/* as we do a string-replacement on\nthe *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as\npod2man-ing Git.pm & friends.\n\nSo replace the whole thing with something that's pretty much a copy of\nhow we generate po/build/**.mo from po/*.po, just with a small sed(1)\ncommand instead of msgfmt. As that's being done rename the files\nfrom *.pm to *.pmc just to indicate that they're generated (see\n\"perldoc -f require\").\n\nWhile I'm at it, change the fallback for Error.pm from being something\nwhere we'll ship our own Error.pm if one doesn't exist at build time\nto one where we just use a Git::Error wrapper that'll always prefer\nthe system-wide Error.pm, only falling back to our own copy if it\nreally doesn't exist at runtime. It's now shipped as\nGit::FromCPAN::Error, making it easy to add other modules to\nGit::FromCPAN::* in the future if that's needed.\n\nFunctional changes:\n\n * This will not always install into perl's idea of its global\n   \"installsitelib\". This only potentially matters for packagers that\n   need to expose Git.pm for non-git use, and as explained in the\n   INSTALL file there's a trivial workaround.\n\n * The scripts themselves will 'use lib' the target directory, but if\n   INSTLIBDIR is set it overrides it. It doesn't have to be this way,\n   it could be set in addition to INSTLIBDIR, but my reading of [7] is\n   that this is the desired behavior.\n\n * We don't build man pages for all of the perl modules as we used to,\n   only Git(3pm). As discussed on-list[8] that we were building\n   installed manpages for purely internal APIs like Git::I18N or\n   private-Error.pm was always a bug anyway, and all the Git::SVN::*\n   ones say they're internal APIs.\n\n   There are apparently external users of Git.pm, but I don't expect\n   there to be any of the others.\n\n   As a side-effect of these general changes the perl documentation\n   now only installed by install-{doc,man}, not a mere \"install\" as\n   before.\n\n1. 5e9637c629 (\"i18n: add infrastructure for translating Git with\n   gettext\", 2011-11-18)\n\n2. b1edc53d06 (\"Introduce Git.pm (v4)\", 2006-06-24)\n\n3. 18b0fc1ce1 (\"Git.pm: Kill Git.xs for now\", 2006-09-23)\n\n4. f848718a69 (\"Make perl/ build procedure ActiveState friendly.\",\n   2006-12-04)\n\n5. ee9be06770 (\"perl: detect new files in MakeMaker builds\",\n   2012-07-27)\n\n6. c59c4939c2 (\"perl: regenerate perl.mak if perl -V changes\",\n   2017-03-29)\n\n7. 0386dd37b1 (\"Makefile: add PERLLIB_EXTRA variable that adds to\n   default perl path\", 2013-11-15)\n\n8. 87bmjjv1pu.fsf@evledraar.booking.com (\"Re: [PATCH] Makefile:\n   replace perl/Makefile.PL with simple make rules\"\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nThis fixes the test failure we had on 32 bit Linux due to v2. That\nerror had nothing to do with 32 bit per-se, it was just a logic error\nin the fallback logic if the system didn't have an Error.pm, and\nevidently the 32 bit environment doesn't have that installed.\n\nThis also incorporates Junio's typo/grammar fixes of my commit\nmessage, tbdiff with v2:\n\n    @@ -27,7 +27,7 @@\n         So replace the whole thing with something that's pretty much a copy of\n         how we generate po/build/**.mo from po/*.po, just with a small sed(1)\n         command instead of msgfmt. As that's being done rename the files\n    -    from *.pm to *.pmc just to indicate that they're genreated (see\n    +    from *.pm to *.pmc just to indicate that they're generated (see\n         \"perldoc -f require\").\n         \n         While I'm at it, change the fallback for Error.pm from being something\n    @@ -50,9 +50,9 @@\n            it could be set in addition to INSTLIBDIR, but my reading of [7] is\n            that this is the desired behavior.\n         \n    -     * We don't man pages for all of the perl modules as we used t, only\n    -       Git(3pm). As discussed on-list[8] that we were building installed\n    -       manpages for purely internal APIs like Git::I18N or\n    +     * We don't build man pages for all of the perl modules as we used to,\n    +       only Git(3pm). As discussed on-list[8] that we were building\n    +       installed manpages for purely internal APIs like Git::I18N or\n            private-Error.pm was always a bug anyway, and all the Git::SVN::*\n            ones say they're internal APIs.\n         \n    @@ -354,8 +354,7 @@\n     +\n     +=head1 DESCRIPTION\n     +\n    -+Wraps the import function for the L<Error> module. The L<Git> module\n    -+must be imported first.\n    ++Wraps the import function for the L<Error> module.\n     +\n     +This module is only intended to be used for code shipping in the\n     +C<git.git> repository. Use it for anything else at your peril!\n    @@ -372,13 +371,13 @@\n     +    } or do {\n     +  my $error = $@ || \"Zombie Error\";\n     +\n    -+  my $Git_pm_path = $INC{\"Git.pm\"} || die \"BUG: Should have loaded the Git module first!\";\n    ++  my $Git_Error_pm_path = $INC{\"Git/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n     +\n     +  require File::Basename;\n    -+  my $Git_pm_root = File::Basename::dirname($Git_pm_path) || die \"BUG: Can't figure out dirname from '$Git_pm_path'!\";\n    ++  my $Git_Error_pm_root = File::Basename::dirname($Git_Error_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_Error_pm_path'!\";\n     +\n     +  require File::Spec;\n    -+  my $Git_pm_FromCPAN_root = File::Spec->catdir($Git_pm_root, qw(Git FromCPAN));\n    ++  my $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');\n     +  die \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n     +\n     +  local @INC = ($Git_pm_FromCPAN_root, @INC);\n\nSo the issue is that we had some things (like git-send-email) which\nwould load Git::Error without first loading Git.pm.\n\nThere's no actual reason for why we can't just find the path relative\nto Git::Error.pm instead of Git.pm.\n\nI don't know what I was thinking when I wrote this, but this logic\nshould be fully robust, and I've confirmed that all tests pass\nwith/without an Error.pm installed globally.\n\n INSTALL                                          | 17 ++++-\n Makefile                                         | 67 ++++++++++--------\n contrib/examples/git-difftool.perl               |  2 +-\n git-send-email.perl                              |  2 +-\n perl/.gitignore                                  |  9 +--\n perl/Git.pm                                      |  2 +-\n perl/Git/Error.pm                                | 46 ++++++++++++\n perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0\n perl/Git/I18N.pm                                 |  2 +-\n perl/Makefile                                    | 90 ------------------------\n perl/Makefile.PL                                 | 62 ----------------\n t/perf/aggregate.perl                            |  2 +-\n t/test-lib.sh                                    |  2 +-\n wrap-for-bin.sh                                  |  2 +-\n 14 files changed, 106 insertions(+), 199 deletions(-)\n create mode 100644 perl/Git/Error.pm\n rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)\n delete mode 100644 perl/Makefile\n delete mode 100644 perl/Makefile.PL\n\ndiff --git a/INSTALL b/INSTALL\nindex ffb071e9f0..808e07b659 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -84,9 +84,24 @@ Issues of note:\n \n \tGIT_EXEC_PATH=`pwd`\n \tPATH=`pwd`:$PATH\n-\tGITPERLLIB=`pwd`/perl/blib/lib\n+\tGITPERLLIB=`pwd`/perl/build/lib\n \texport GIT_EXEC_PATH PATH GITPERLLIB\n \n+ - By default (unless NO_PERL is provided) Git will ship various perl\n+   scripts & libraries it needs. However, for simplicity it doesn't\n+   use the ExtUtils::MakeMaker toolchain to decide where to place the\n+   perl libraries. Depending on the system this can result in the perl\n+   libraries not being where you'd like them if they're expected to be\n+   used by things other than Git itself.\n+\n+   Manually supplying a perllibdir prefix should fix this, if this is\n+   a problem you care about, e.g.:\n+\n+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')\n+\n+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,\n+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.\n+\n  - Git is reasonably self-sufficient, but does depend on a few external\n    programs and libraries.  Git can be used without most of them by adding\n    the approriate \"NO_<LIBRARY>=YesPlease\" to the make command line or\ndiff --git a/Makefile b/Makefile\nindex fef9c8d272..5c0490d757 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -295,9 +295,6 @@ all::\n #\n # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).\n #\n-# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n-# MakeMaker (e.g. using ActiveState under Cygwin).\n-#\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n@@ -473,6 +470,7 @@ gitexecdir = libexec/git-core\n mergetoolsdir = $(gitexecdir)/mergetools\n sharedir = $(prefix)/share\n gitwebdir = $(sharedir)/gitweb\n+perllibdir = $(sharedir)/perl5\n localedir = $(sharedir)/locale\n template_dir = share/git-core/templates\n htmldir = $(prefix)/share/doc/git-doc\n@@ -486,7 +484,7 @@ mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))\n infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))\n htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))\n \n-export prefix bindir sharedir sysconfdir gitwebdir localedir\n+export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir\n \n CC = cc\n AR = ar\n@@ -1526,9 +1524,6 @@ ifdef SHA1_MAX_BLOCK_SIZE\n \tLIB_OBJS += compat/sha1-chunked.o\n \tBASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE=\"$(SHA1_MAX_BLOCK_SIZE)\"\n endif\n-ifdef NO_PERL_MAKEMAKER\n-\texport NO_PERL_MAKEMAKER\n-endif\n ifdef NO_HSTRERROR\n \tCOMPAT_CFLAGS += -DNO_HSTRERROR\n \tCOMPAT_OBJS += compat/hstrerror.o\n@@ -1715,8 +1710,10 @@ ETC_GITATTRIBUTES_SQ = $(subst ','\\'',$(ETC_GITATTRIBUTES))\n DESTDIR_SQ = $(subst ','\\'',$(DESTDIR))\n bindir_SQ = $(subst ','\\'',$(bindir))\n bindir_relative_SQ = $(subst ','\\'',$(bindir_relative))\n+mandir_SQ = $(subst ','\\'',$(mandir))\n mandir_relative_SQ = $(subst ','\\'',$(mandir_relative))\n infodir_relative_SQ = $(subst ','\\'',$(infodir_relative))\n+perllibdir_SQ = $(subst ','\\'',$(perllibdir))\n localedir_SQ = $(subst ','\\'',$(localedir))\n gitexecdir_SQ = $(subst ','\\'',$(gitexecdir))\n template_dir_SQ = $(subst ','\\'',$(template_dir))\n@@ -1825,9 +1822,6 @@ all::\n ifndef NO_TCLTK\n \t$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all\n \t$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all\n-endif\n-ifndef NO_PERL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all\n endif\n \t$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'\n \n@@ -1908,7 +1902,8 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)\n \n SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\\\n \t$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\\\n-\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV)\n+\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\\\n+\t$(perllibdir_SQ)\n define cmd_munge_script\n $(RM) $@ $@+ && \\\n sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n@@ -1952,29 +1947,17 @@ git.res: git.rc GIT-VERSION-FILE\n $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS\n \n ifndef NO_PERL\n-$(SCRIPT_PERL_GEN): perl/perl.mak\n-\n-perl/perl.mak: perl/PM.stamp\n-\n-perl/PM.stamp: FORCE\n-\t@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \\\n-\t$(PERL_PATH) -V >>$@+ && \\\n-\t{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \\\n-\t$(RM) $@+\n-\n-perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)\n+$(SCRIPT_PERL_GEN):\n \n-PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n-$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n+PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n+$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\n-\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n+\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n \t    -e '\tH' \\\n \t    -e '\tx' \\\n \t    -e '}' \\\n@@ -2292,6 +2275,21 @@ endif\n po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n \n+PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n+PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))\n+\n+ifndef NO_PERL\n+all:: $(PMCFILES)\n+endif\n+\n+perl/build/lib/%.pmc: perl/%.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n+\n+perl/build/man/man3/Git.3pm: perl/Git.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tpod2man $< $@\n+\n FIND_SOURCE_FILES = ( \\\n \tgit ls-files \\\n \t\t'*.[hcS]' \\\n@@ -2551,7 +2549,9 @@ ifndef NO_GETTEXT\n \t(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)\n endif\n ifndef NO_PERL\n-\t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n+\t(cd perl/build/lib && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n \t$(MAKE) -C gitweb install\n endif\n ifndef NO_TCLTK\n@@ -2601,12 +2601,17 @@ endif\n install-gitweb:\n \t$(MAKE) -C gitweb install\n \n-install-doc:\n+install-doc: install-man-perl\n \t$(MAKE) -C Documentation install\n \n-install-man:\n+install-man: install-man-perl\n \t$(MAKE) -C Documentation install-man\n \n+install-man-perl: perl/build/man/man3/Git.3pm\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'\n+\t(cd perl/build/man/man3 && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)\n+\n install-html:\n \t$(MAKE) -C Documentation install-html\n \n@@ -2698,7 +2703,7 @@ clean: profile-clean coverage-clean\n \t$(MAKE) -C Documentation/ clean\n ifndef NO_PERL\n \t$(MAKE) -C gitweb clean\n-\t$(MAKE) -C perl clean\n+\t$(RM) -r perl/build/\n endif\n \t$(MAKE) -C templates/ clean\n \t$(MAKE) -C t/ clean\ndiff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl\nindex df59bdfe97..fb0fd0b84b 100755\n--- a/contrib/examples/git-difftool.perl\n+++ b/contrib/examples/git-difftool.perl\n@@ -13,7 +13,7 @@\n use 5.008;\n use strict;\n use warnings;\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use File::Basename qw(dirname);\n use File::Copy;\n use File::Find;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 2208dcc213..88a0edcd7d 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -26,7 +26,7 @@ use Text::ParseWords;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n use File::Spec::Functions qw(catdir catfile);\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\ndiff --git a/perl/.gitignore b/perl/.gitignore\nindex 0f1fc27f86..84c048a73c 100644\n--- a/perl/.gitignore\n+++ b/perl/.gitignore\n@@ -1,8 +1 @@\n-perl.mak\n-perl.mak.old\n-MYMETA.json\n-MYMETA.yml\n-blib\n-blibdirs\n-pm_to_blib\n-PM.stamp\n+/build/\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex ffa09ace92..02a3871e94 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -101,7 +101,7 @@ increase notwithstanding).\n \n \n use Carp qw(carp croak); # but croak is bad - throw instead\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\ndiff --git a/perl/Git/Error.pm b/perl/Git/Error.pm\nnew file mode 100644\nindex 0000000000..5874672150\n--- /dev/null\n+++ b/perl/Git/Error.pm\n@@ -0,0 +1,46 @@\n+package Git::Error;\n+use 5.008;\n+use strict;\n+use warnings;\n+\n+=head1 NAME\n+\n+Git::Error - Wrapper for the L<Error> module, in case it's not installed\n+\n+=head1 DESCRIPTION\n+\n+Wraps the import function for the L<Error> module.\n+\n+This module is only intended to be used for code shipping in the\n+C<git.git> repository. Use it for anything else at your peril!\n+\n+=cut\n+\n+sub import {\n+    shift;\n+    my $caller = caller;\n+\n+    eval {\n+\trequire Error;\n+\t1;\n+    } or do {\n+\tmy $error = $@ || \"Zombie Error\";\n+\n+\tmy $Git_Error_pm_path = $INC{\"Git/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\n+\trequire File::Basename;\n+\tmy $Git_Error_pm_root = File::Basename::dirname($Git_Error_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_Error_pm_path'!\";\n+\n+\trequire File::Spec;\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');\n+\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n+\n+\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n+\trequire Error;\n+    };\n+\n+    local @_ = ($caller, @_);\n+    goto &Error::import;\n+}\n+\n+1;\ndiff --git a/perl/private-Error.pm b/perl/Git/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/private-Error.pm\nrename to perl/Git/FromCPAN/Error.pm\ndiff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm\nindex 836a5c2382..dba96fff0a 100644\n--- a/perl/Git/I18N.pm\n+++ b/perl/Git/I18N.pm\n@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;\n \n sub __bootstrap_locale_messages {\n \tour $TEXTDOMAIN = 'git';\n-\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';\n+\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';\n \n \trequire POSIX;\n \tPOSIX->import(qw(setlocale));\ndiff --git a/perl/Makefile b/perl/Makefile\ndeleted file mode 100644\nindex f657de20e3..0000000000\n--- a/perl/Makefile\n+++ /dev/null\n@@ -1,90 +0,0 @@\n-#\n-# Makefile for perl support modules and routine\n-#\n-makfile:=perl.mak\n-modules =\n-\n-PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n-prefix_SQ = $(subst ','\\'',$(prefix))\n-localedir_SQ = $(subst ','\\'',$(localedir))\n-\n-ifndef V\n-\tQUIET = @\n-endif\n-\n-all install instlibdir: $(makfile)\n-\t$(QUIET)$(MAKE) -f $(makfile) $@\n-\n-clean:\n-\t$(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0\n-\t$(RM) ppport.h\n-\t$(RM) $(makfile)\n-\t$(RM) $(makfile).old\n-\t$(RM) PM.stamp\n-\n-$(makfile): PM.stamp\n-\n-ifdef NO_PERL_MAKEMAKER\n-instdir_SQ = $(subst ','\\'',$(prefix)/lib)\n-\n-modules += Git\n-modules += Git/I18N\n-modules += Git/IndexInfo\n-modules += Git/Packet\n-modules += Git/SVN\n-modules += Git/SVN/Memoize/YAML\n-modules += Git/SVN/Fetcher\n-modules += Git/SVN/Editor\n-modules += Git/SVN/GlobSpec\n-modules += Git/SVN/Log\n-modules += Git/SVN/Migration\n-modules += Git/SVN/Prompt\n-modules += Git/SVN/Ra\n-modules += Git/SVN/Utils\n-\n-$(makfile): ../GIT-CFLAGS Makefile\n-\techo all: private-Error.pm Git.pm Git/I18N.pm > $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) blib/lib/'$$i'.pm' >> $@; \\\n-\t\techo '\tmkdir -p blib/lib'$$subdir >> $@; \\\n-\t\techo '\tcp '$$i'.pm blib/lib/'$$i'.pm' >> $@; \\\n-\tdone\n-\techo '\t$(RM) blib/lib/Error.pm' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm blib/lib/Error.pm' >> $@\n-\techo install: >> $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\t\techo '\tmkdir -p \"$$(DESTDIR)$(instdir_SQ)'$$subdir'\"' >> $@; \\\n-\t\techo '\tcp '$$i'.pm \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\tdone\n-\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\techo instlibdir: >> $@\n-\techo '\techo $(instdir_SQ)' >> $@\n-else\n-$(makfile): Makefile.PL ../GIT-CFLAGS\n-\t$(PERL_PATH) $< PREFIX='$(prefix_SQ)' INSTALL_BASE='' --localedir='$(localedir_SQ)'\n-endif\n-\n-# this is just added comfort for calling make directly in perl dir\n-# (even though GIT-CFLAGS aren't used yet. If ever)\n-../GIT-CFLAGS:\n-\t$(MAKE) -C .. GIT-CFLAGS\ndiff --git a/perl/Makefile.PL b/perl/Makefile.PL\ndeleted file mode 100644\nindex 3f29ba98a6..0000000000\n--- a/perl/Makefile.PL\n+++ /dev/null\n@@ -1,62 +0,0 @@\n-use strict;\n-use warnings;\n-use ExtUtils::MakeMaker;\n-use Getopt::Long;\n-use File::Find;\n-\n-# Don't forget to update the perl/Makefile, too.\n-# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease\n-\n-# Sanity: die at first unknown option\n-Getopt::Long::Configure qw/ pass_through /;\n-\n-my $localedir = '';\n-GetOptions(\"localedir=s\" => \\$localedir);\n-\n-sub MY::postamble {\n-\treturn <<'MAKE_FRAG';\n-instlibdir:\n-\t@echo '$(INSTALLSITELIB)'\n-\n-ifneq (,$(DESTDIR))\n-ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))\n-$(error ExtUtils::MakeMaker version \"$(MM_VERSION)\" is older than 6.11 and so \\\n-\tis likely incompatible with the DESTDIR mechanism.  Try setting \\\n-\tNO_PERL_MAKEMAKER=1 instead)\n-endif\n-endif\n-\n-MAKE_FRAG\n-}\n-\n-# Find all the .pm files in \"Git/\" and Git.pm\n-my %pm;\n-find sub {\n-\treturn unless /\\.pm$/;\n-\n-\t# sometimes File::Find prepends a ./  Strip it.\n-\tmy $pm_path = $File::Find::name;\n-\t$pm_path =~ s{^\\./}{};\n-\n-\t$pm{$pm_path} = '$(INST_LIBDIR)/'.$pm_path;\n-}, \"Git\", \"Git.pm\";\n-\n-\n-# We come with our own bundled Error.pm. It's not in the set of default\n-# Perl modules so install it if it's not available on the system yet.\n-if ( !eval { require Error } || $Error::VERSION < 0.15009) {\n-\t$pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';\n-}\n-\n-# redirect stdout, otherwise the message \"Writing perl.mak for Git\"\n-# disrupts the output for the target 'instlibdir'\n-open STDOUT, \">&STDERR\";\n-\n-WriteMakefile(\n-\tNAME            => 'Git',\n-\tVERSION_FROM    => 'Git.pm',\n-\tPM\t\t=> \\%pm,\n-\tPM_FILTER\t=> qq[\\$(PERL) -pe \"s<\\\\Q++LOCALEDIR++\\\\E><$localedir>\"],\n-\tMAKEFILE\t=> 'perl.mak',\n-\tINSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'\n-);\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex e401208488..3096f4ec77 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -1,6 +1,6 @@\n #!/usr/bin/perl\n \n-use lib '../../perl/blib/lib';\n+use lib '../../perl/build/lib';\n use strict;\n use warnings;\n use Git;\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 116bd6a70c..85a0fabb47 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -919,7 +919,7 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/build/lib\n export GITPERLLIB\n test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\ndiff --git a/wrap-for-bin.sh b/wrap-for-bin.sh\nindex 22b6e4948f..5842408817 100644\n--- a/wrap-for-bin.sh\n+++ b/wrap-for-bin.sh\n@@ -14,7 +14,7 @@ else\n \tGIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'\n \texport GIT_TEMPLATE_DIR\n fi\n-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'\n PATH='@@BUILD_DIR@@/bin-wrappers:'\"$PATH\"\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"334642","messageId":"xmqqefo04zdr.fsf@gitster.mtv.corp.google.com","threadId":"47345","inReplyTo":"20171210211333.9820-1-avarab@gmail.com","subject":"Re: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-11T23:29:36Z","receivedAt":"2017-12-11T23:29:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> I don't know what I was thinking when I wrote this, but this logic\n> should be fully robust, and I've confirmed that all tests pass\n> with/without an Error.pm installed globally.\n\nThanks.  Will queue and drop the revert from 'pu'.\n\n\n"},{"id":"334717","messageId":"003f01d37390$ed0e0440$c72a0cc0$@nexbridge.com","threadId":"47345","inReplyTo":"20171210211333.9820-1-avarab@gmail.com","subject":"RE: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2017-12-12T21:33:54Z","receivedAt":"2017-12-12T21:34:47Z","isPatch":true,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"-----Original Message-----\nOn December 10, 2017 4:14 PM, Ævar Arnfjörð Bjarmason wrote:\nSubject: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules\n\n>Replace the perl/Makefile.PL and the fallback perl/Makefile used under NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily inspired by how the i18n infrastructure's build process works[1].\n>The reason for having the Makefile.PL in the first place is that it was initially[2] building a perl C binding to interface with libgit, this functionality, that was removed[3] before Git.pm ever made it to the master branch.\n<big snip>\n\nI would like to request that the we be careful that the git builds do not introduce arbitrary dependencies to CPAN. Some platforms (I can think of one off the top, being NonStop) does not provide for arbitrary additions to the supplied perl implementation as of yet. The assumption about being able to add CPAN modules may apply on some platforms but is not a general capability. I am humbly requesting that caution be used when adding dependencies. Being non-$DAYJOB responsible for the git port for NonStop, this scares me a bit, but I and my group can help validate the available modules used for builds.\n\nNote: we do not yet have CPAN's SCM so can't and don't use perl for access to git anyway - much that I've tried to change that.\n\nPlease keep build dependencies to a minimum.\n\nThanks for my and my whole team.\n\nRandall\n\n-- Brief whoami: NonStop&UNIX developer since approximately UNIX(421664400)/NonStop(211288444200000000) \n-- In my real life, I talk too much.\n\n\n\n"},{"id":"334721","messageId":"87a7ynd1ml.fsf@evledraar.gmail.com","threadId":"47345","inReplyTo":"003f01d37390$ed0e0440$c72a0cc0$@nexbridge.com","subject":"Re: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-12-12T22:26:10Z","receivedAt":"2017-12-12T22:26:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Dec 12 2017, Randall S. Becker jotted:\n\n> -----Original Message-----\n> On December 10, 2017 4:14 PM, Ævar Arnfjörð Bjarmason wrote:\n> Subject: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules\n>\n>>Replace the perl/Makefile.PL and the fallback perl/Makefile used under NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily inspired by how the i18n infrastructure's build process works[1].\n>>The reason for having the Makefile.PL in the first place is that it was initially[2] building a perl C binding to interface with libgit, this functionality, that was removed[3] before Git.pm ever made it to the master branch.\n> <big snip>\n>\n> I would like to request that the we be careful that the git builds do not introduce arbitrary dependencies to CPAN. Some platforms (I can think of one off the top, being NonStop) does not provide for arbitrary additions to the supplied perl implementation as of yet. The assumption about being able to add CPAN modules may apply on some platforms but is not a general capability. I am humbly requesting that caution be used when adding dependencies. Being non-$DAYJOB responsible for the git port for NonStop, this scares me a bit, but I and my group can help validate the available modules used for builds.\n>\n> Note: we do not yet have CPAN's SCM so can't and don't use perl for access to git anyway - much that I've tried to change that.\n>\n> Please keep build dependencies to a minimum.\n>\n> Thanks for my and my whole team.\n\nI think you should be happy with this patch then, and it doesn't add any\nmore CPAN dependency than before, and sets up a framework (as discussed\nin [1]) where we can use more CPAN modules while not requiring packagers\nsuch as yourself to package CPAN modules.\n\nHowever, it doesn't sound believable to me that even on NonStop you\ncan't install any CPAN modules whatsoever.\n\nThat would also mean that this patch doesn't work for you, because it\nmeans that you either don't have anything resembling a hierarchical\nfilesystem on which git can be installed in the first place (in which\ncase it wouldn't work), or perl doesn't have an @INC to search through\nperl libs on on NonStop. What does:\n\n    perl -V\n\nReturn for you on that system?\n\nIf this patch works, and if at the bottom of `perl -V` you see some\ndirectories which you could write a package to drop some static *.pm\nfiles, then you can grab a *.tar.gz from CPAN such as the one for\nError.pm[2] and arrange for the *.pm files contained within its lib/\ndirectory to be dropped into one of those @INC directories.\n\nIt may be that some aspect of the CPAN toolchain is broken for you, or\neven ExtUtils::MakeMaker, but you typically don't need that to package\nnon-XS perl modules, certainly not any of the ones we've discussed\npossibly bundling up in git.git on-list recently. As a (very occasional)\ncontributor to perl.git I'd be interested to know if that's what you\nmean is broken, and if so see if it could be fixed for you.\n\n1. <CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com>\n   -- https://public-inbox.org/git/CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com/\n\n2. https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Error-0.17025.tar.gz\n"},{"id":"334873","messageId":"b8b4534f-1eda-ee52-faed-ec5188c2ad35@grubix.eu","threadId":"47345","inReplyTo":"87a7ynd1ml.fsf@evledraar.gmail.com","subject":"Re: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Michael J Gruber","fromEmail":"git@grubix.eu","sentAt":"2017-12-15T10:35:34Z","receivedAt":"2017-12-15T10:36:45Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Ævar Arnfjörð Bjarmason venit, vidit, dixit 12.12.2017 23:26:\n> \n> On Tue, Dec 12 2017, Randall S. Becker jotted:\n> \n>> -----Original Message-----\n>> On December 10, 2017 4:14 PM, Ævar Arnfjörð Bjarmason wrote:\n>> Subject: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules\n>>\n>>> Replace the perl/Makefile.PL and the fallback perl/Makefile used under NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily inspired by how the i18n infrastructure's build process works[1].\n>>> The reason for having the Makefile.PL in the first place is that it was initially[2] building a perl C binding to interface with libgit, this functionality, that was removed[3] before Git.pm ever made it to the master branch.\n>> <big snip>\n>>\n>> I would like to request that the we be careful that the git builds do not introduce arbitrary dependencies to CPAN. Some platforms (I can think of one off the top, being NonStop) does not provide for arbitrary additions to the supplied perl implementation as of yet. The assumption about being able to add CPAN modules may apply on some platforms but is not a general capability. I am humbly requesting that caution be used when adding dependencies. Being non-$DAYJOB responsible for the git port for NonStop, this scares me a bit, but I and my group can help validate the available modules used for builds.\n>>\n>> Note: we do not yet have CPAN's SCM so can't and don't use perl for access to git anyway - much that I've tried to change that.\n>>\n>> Please keep build dependencies to a minimum.\n>>\n>> Thanks for my and my whole team.\n> \n> I think you should be happy with this patch then, and it doesn't add any\n> more CPAN dependency than before, and sets up a framework (as discussed\n> in [1]) where we can use more CPAN modules while not requiring packagers\n> such as yourself to package CPAN modules.\n> \n> However, it doesn't sound believable to me that even on NonStop you\n> can't install any CPAN modules whatsoever.\n> \n> That would also mean that this patch doesn't work for you, because it\n> means that you either don't have anything resembling a hierarchical\n> filesystem on which git can be installed in the first place (in which\n> case it wouldn't work), or perl doesn't have an @INC to search through\n> perl libs on on NonStop. What does:\n> \n>     perl -V\n> \n> Return for you on that system?\n> \n> If this patch works, and if at the bottom of `perl -V` you see some\n> directories which you could write a package to drop some static *.pm\n> files, then you can grab a *.tar.gz from CPAN such as the one for\n> Error.pm[2] and arrange for the *.pm files contained within its lib/\n> directory to be dropped into one of those @INC directories.\n> \n> It may be that some aspect of the CPAN toolchain is broken for you, or\n> even ExtUtils::MakeMaker, but you typically don't need that to package\n> non-XS perl modules, certainly not any of the ones we've discussed\n> possibly bundling up in git.git on-list recently. As a (very occasional)\n> contributor to perl.git I'd be interested to know if that's what you\n> mean is broken, and if so see if it could be fixed for you.\n> \n> 1. <CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com>\n>    -- https://public-inbox.org/git/CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com/\n> \n> 2. https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Error-0.17025.tar.gz\n> \n\nThis patch (currently in origin/next) makes a ton of tests from our test\nsuite fail for me on pretty standard systems (Fedora 27, CentOS 7.4.1708).\n\nIs there anything I'm supposed to do differently now to make our test\nsuite run? If yes then a clear and short hint in the patch description\nwould me more than approriate.\n\nMichael\n\nTest Summary Report\n-------------------\nt0090-cache-tree.sh                              (Wstat: 256 Tests: 21\nFailed: 1)\n  Failed test:  10\n  Non-zero exit status: 1\nt2016-checkout-patch.sh                          (Wstat: 256 Tests: 14\nFailed: 12)\n  Failed tests:  2-13\n  Non-zero exit status: 1\nt3701-add-interactive.sh                         (Wstat: 256 Tests: 44\nFailed: 25)\n  Failed tests:  2, 4-5, 7, 9-10, 13, 16, 18, 21-25, 29\n                31, 33, 35, 37, 39-44\n  Non-zero exit status: 1\nt3904-stash-patch.sh                             (Wstat: 256 Tests: 8\nFailed: 4)\n  Failed tests:  3-6\n  Non-zero exit status: 1\nt7105-reset-patch.sh                             (Wstat: 256 Tests: 8\nFailed: 6)\n  Failed tests:  2-7\n  Non-zero exit status: 1\nt7106-reset-unborn-branch.sh                     (Wstat: 256 Tests: 7\nFailed: 1)\n  Failed test:  5\n  Non-zero exit status: 1\nt7501-commit.sh                                  (Wstat: 256 Tests: 66\nFailed: 2)\n  Failed tests:  7, 39\n  Non-zero exit status: 1\nt7514-commit-patch.sh                            (Wstat: 256 Tests: 3\nFailed: 2)\n  Failed tests:  2-3\n  Non-zero exit status: 1\nt9001-send-email.sh                              (Wstat: 256 Tests: 151\nFailed: 111)\n  Failed tests:  4-7, 9-10, 12-13, 15, 17, 19-26, 29-31\n                33-39, 41-43, 45, 47, 49, 51, 53, 55, 57\n                59, 61-68, 71-94, 97, 99-101, 104, 106-108\n                110, 112, 114, 117, 119-133, 135-145, 150-151\n  Non-zero exit status: 1\n\n"},{"id":"334882","messageId":"20171215150910.GI3693@zaya.teonanacatl.net","threadId":"47345","inReplyTo":"b8b4534f-1eda-ee52-faed-ec5188c2ad35@grubix.eu","subject":"Re: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2017-12-15T15:09:10Z","receivedAt":"2017-12-15T15:09:20Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Hi Michael,\n\nMichael J Gruber wrote:\n> This patch (currently in origin/next) makes a ton of tests from our test\n> suite fail for me on pretty standard systems (Fedora 27, CentOS 7.4.1708).\n> \n> Is there anything I'm supposed to do differently now to make our test\n> suite run? If yes then a clear and short hint in the patch description\n> would me more than approriate.\n\nInteresting.  I'll have to try building next.  I was going\nto wait until the first 2.16.0 rc for a full test.\n\nI did apply this patch on top of 2.15.1 on 12/10 and built\nan rpm locally for fedora (only f26 though).  I didn't see\nany test failures, which is why I thought I'd wait for\n2.16.0-rc0 to test further.\n\nFWIW, the minor spec file changes I made (against fedora's\ngit package master branch) are here:\n\n    https://src.fedoraproject.org/fork/tmz/rpms/git/branch/perl-makefile\n\nThe only change in the patch since I tested it is: \n\n+-modules += Git/Packet\n\nin perl/Makefile.\n\nI don't think any of these changes to the rpm spec file or\nthe Git/Packet addition in modules look like they'd affect\nthe test suite, but it's early here and I could be wrong.\n\nI'll try to test a build of next soon to see if I get\nsimilar failures on Fedora/CentOS.\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nAfter one look at this planet any visitor from outer space would say\n\"I want to see the manager.\"\n    -- William S. Burroughs\n\n"},{"id":"334894","messageId":"CACBZZX4ZqVm2HnAbKjdZV=95gq4s7b=gycH3x-sd+zJiWEgDfg@mail.gmail.com","threadId":"47345","inReplyTo":"b8b4534f-1eda-ee52-faed-ec5188c2ad35@grubix.eu","subject":"Re: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-12-15T17:31:51Z","receivedAt":"2017-12-15T17:32:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Fri, Dec 15, 2017 at 11:35 AM, Michael J Gruber <git@grubix.eu> wrote:\n> Ævar Arnfjörð Bjarmason venit, vidit, dixit 12.12.2017 23:26:\n>>\n>> On Tue, Dec 12 2017, Randall S. Becker jotted:\n>>\n>>> -----Original Message-----\n>>> On December 10, 2017 4:14 PM, Ævar Arnfjörð Bjarmason wrote:\n>>> Subject: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules\n>>>\n>>>> Replace the perl/Makefile.PL and the fallback perl/Makefile used under NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily inspired by how the i18n infrastructure's build process works[1].\n>>>> The reason for having the Makefile.PL in the first place is that it was initially[2] building a perl C binding to interface with libgit, this functionality, that was removed[3] before Git.pm ever made it to the master branch.\n>>> <big snip>\n>>>\n>>> I would like to request that the we be careful that the git builds do not introduce arbitrary dependencies to CPAN. Some platforms (I can think of one off the top, being NonStop) does not provide for arbitrary additions to the supplied perl implementation as of yet. The assumption about being able to add CPAN modules may apply on some platforms but is not a general capability. I am humbly requesting that caution be used when adding dependencies. Being non-$DAYJOB responsible for the git port for NonStop, this scares me a bit, but I and my group can help validate the available modules used for builds.\n>>>\n>>> Note: we do not yet have CPAN's SCM so can't and don't use perl for access to git anyway - much that I've tried to change that.\n>>>\n>>> Please keep build dependencies to a minimum.\n>>>\n>>> Thanks for my and my whole team.\n>>\n>> I think you should be happy with this patch then, and it doesn't add any\n>> more CPAN dependency than before, and sets up a framework (as discussed\n>> in [1]) where we can use more CPAN modules while not requiring packagers\n>> such as yourself to package CPAN modules.\n>>\n>> However, it doesn't sound believable to me that even on NonStop you\n>> can't install any CPAN modules whatsoever.\n>>\n>> That would also mean that this patch doesn't work for you, because it\n>> means that you either don't have anything resembling a hierarchical\n>> filesystem on which git can be installed in the first place (in which\n>> case it wouldn't work), or perl doesn't have an @INC to search through\n>> perl libs on on NonStop. What does:\n>>\n>>     perl -V\n>>\n>> Return for you on that system?\n>>\n>> If this patch works, and if at the bottom of `perl -V` you see some\n>> directories which you could write a package to drop some static *.pm\n>> files, then you can grab a *.tar.gz from CPAN such as the one for\n>> Error.pm[2] and arrange for the *.pm files contained within its lib/\n>> directory to be dropped into one of those @INC directories.\n>>\n>> It may be that some aspect of the CPAN toolchain is broken for you, or\n>> even ExtUtils::MakeMaker, but you typically don't need that to package\n>> non-XS perl modules, certainly not any of the ones we've discussed\n>> possibly bundling up in git.git on-list recently. As a (very occasional)\n>> contributor to perl.git I'd be interested to know if that's what you\n>> mean is broken, and if so see if it could be fixed for you.\n>>\n>> 1. <CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com>\n>>    -- https://public-inbox.org/git/CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com/\n>>\n>> 2. https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Error-0.17025.tar.gz\n>>\n>\n> This patch (currently in origin/next) makes a ton of tests from our test\n> suite fail for me on pretty standard systems (Fedora 27, CentOS 7.4.1708).\n>\n> Is there anything I'm supposed to do differently now to make our test\n> suite run? If yes then a clear and short hint in the patch description\n> would me more than approriate.\n\nThis is a bug in my patch, I can reproduce it on CO7. Will figure out\nwhat's going on there...\n"},{"id":"335021","messageId":"xmqqy3lyww6r.fsf@gitster.mtv.corp.google.com","threadId":"47345","inReplyTo":"CACBZZX4ZqVm2HnAbKjdZV=95gq4s7b=gycH3x-sd+zJiWEgDfg@mail.gmail.com","subject":"Re: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-19T15:53:48Z","receivedAt":"2017-12-19T15:53:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n>> Is there anything I'm supposed to do differently now to make our test\n>> suite run? If yes then a clear and short hint in the patch description\n>> would me more than approriate.\n>\n> This is a bug in my patch, I can reproduce it on CO7. Will figure out\n> what's going on there...\n\nThanks.\n"},{"id":"335060","messageId":"20171219235759.27570-1-avarab@gmail.com","threadId":"47345","inReplyTo":"xmqqy3lyww6r.fsf@gitster.mtv.corp.google.com","subject":"[PATCH v4] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-12-19T23:57:59Z","receivedAt":"2017-12-19T23:58:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Replace the perl/Makefile.PL and the fallback perl/Makefile used under\nNO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\ninspired by how the i18n infrastructure's build process works[1].\n\nThe reason for having the Makefile.PL in the first place is that it\nwas initially[2] building a perl C binding to interface with libgit,\nthis functionality, that was removed[3] before Git.pm ever made it to\nthe master branch.\n\nWe've since since started maintaining a fallback perl/Makefile, as\nMakeMaker wouldn't work on some platforms[4]. That's just the tip of\nthe iceberg. We have the PM.stamp hack in the top-level Makefile[5] to\ndetect whether we need to regenerate the perl/perl.mak, which I fixed\njust recently to deal with issues like the perl version changing from\nunder us[6].\n\nThere is absolutely no reason for why this needs to be so complex\nanymore. All we're getting out of this elaborate Rube Goldberg machine\nwas copying perl/* to perl/blib/* as we do a string-replacement on\nthe *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as\npod2man-ing Git.pm & friends.\n\nSo replace the whole thing with something that's pretty much a copy of\nhow we generate po/build/**.mo from po/*.po, just with a small sed(1)\ncommand instead of msgfmt. As that's being done rename the files\nfrom *.pm to *.pmc just to indicate that they're generated (see\n\"perldoc -f require\").\n\nWhile I'm at it, change the fallback for Error.pm from being something\nwhere we'll ship our own Error.pm if one doesn't exist at build time\nto one where we just use a Git::Error wrapper that'll always prefer\nthe system-wide Error.pm, only falling back to our own copy if it\nreally doesn't exist at runtime. It's now shipped as\nGit::FromCPAN::Error, making it easy to add other modules to\nGit::FromCPAN::* in the future if that's needed.\n\nFunctional changes:\n\n * This will not always install into perl's idea of its global\n   \"installsitelib\". This only potentially matters for packagers that\n   need to expose Git.pm for non-git use, and as explained in the\n   INSTALL file there's a trivial workaround.\n\n * The scripts themselves will 'use lib' the target directory, but if\n   INSTLIBDIR is set it overrides it. It doesn't have to be this way,\n   it could be set in addition to INSTLIBDIR, but my reading of [7] is\n   that this is the desired behavior.\n\n * We don't build man pages for all of the perl modules as we used to,\n   only Git(3pm). As discussed on-list[8] that we were building\n   installed manpages for purely internal APIs like Git::I18N or\n   private-Error.pm was always a bug anyway, and all the Git::SVN::*\n   ones say they're internal APIs.\n\n   There are apparently external users of Git.pm, but I don't expect\n   there to be any of the others.\n\n   As a side-effect of these general changes the perl documentation\n   now only installed by install-{doc,man}, not a mere \"install\" as\n   before.\n\n1. 5e9637c629 (\"i18n: add infrastructure for translating Git with\n   gettext\", 2011-11-18)\n\n2. b1edc53d06 (\"Introduce Git.pm (v4)\", 2006-06-24)\n\n3. 18b0fc1ce1 (\"Git.pm: Kill Git.xs for now\", 2006-09-23)\n\n4. f848718a69 (\"Make perl/ build procedure ActiveState friendly.\",\n   2006-12-04)\n\n5. ee9be06770 (\"perl: detect new files in MakeMaker builds\",\n   2012-07-27)\n\n6. c59c4939c2 (\"perl: regenerate perl.mak if perl -V changes\",\n   2017-03-29)\n\n7. 0386dd37b1 (\"Makefile: add PERLLIB_EXTRA variable that adds to\n   default perl path\", 2013-11-15)\n\n8. 87bmjjv1pu.fsf@evledraar.booking.com (\"Re: [PATCH] Makefile:\n   replace perl/Makefile.PL with simple make rules\"\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nHere's a hopefully final version. The only difference with v3 is:\n\n    -    local @_ = ($caller, @_);\n    +    unshift @_, $caller;\n\nAs it turns out localizing @_ isn't something that worked properly\nuntil\nhttps://github.com/Perl/perl5/commit/049bd5ffd62b73325d4b2e75e59ba04b3569137d\n\nThat commit isn't part of the 5.16.3 version that ships with CentOS 7,\nwhich explains why Michael J Gruber had issues with it. I've tested\nthis on CentOS 7 myself, it passes all tests now.\n\n INSTALL                                          | 17 ++++-\n Makefile                                         | 67 ++++++++++--------\n contrib/examples/git-difftool.perl               |  2 +-\n git-send-email.perl                              |  2 +-\n perl/.gitignore                                  |  9 +--\n perl/Git.pm                                      |  2 +-\n perl/Git/Error.pm                                | 46 ++++++++++++\n perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0\n perl/Git/I18N.pm                                 |  2 +-\n perl/Makefile                                    | 90 ------------------------\n perl/Makefile.PL                                 | 62 ----------------\n t/perf/aggregate.perl                            |  2 +-\n t/test-lib.sh                                    |  2 +-\n wrap-for-bin.sh                                  |  2 +-\n 14 files changed, 106 insertions(+), 199 deletions(-)\n create mode 100644 perl/Git/Error.pm\n rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)\n delete mode 100644 perl/Makefile\n delete mode 100644 perl/Makefile.PL\n\ndiff --git a/INSTALL b/INSTALL\nindex ffb071e9f0..808e07b659 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -84,9 +84,24 @@ Issues of note:\n \n \tGIT_EXEC_PATH=`pwd`\n \tPATH=`pwd`:$PATH\n-\tGITPERLLIB=`pwd`/perl/blib/lib\n+\tGITPERLLIB=`pwd`/perl/build/lib\n \texport GIT_EXEC_PATH PATH GITPERLLIB\n \n+ - By default (unless NO_PERL is provided) Git will ship various perl\n+   scripts & libraries it needs. However, for simplicity it doesn't\n+   use the ExtUtils::MakeMaker toolchain to decide where to place the\n+   perl libraries. Depending on the system this can result in the perl\n+   libraries not being where you'd like them if they're expected to be\n+   used by things other than Git itself.\n+\n+   Manually supplying a perllibdir prefix should fix this, if this is\n+   a problem you care about, e.g.:\n+\n+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')\n+\n+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,\n+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.\n+\n  - Git is reasonably self-sufficient, but does depend on a few external\n    programs and libraries.  Git can be used without most of them by adding\n    the approriate \"NO_<LIBRARY>=YesPlease\" to the make command line or\ndiff --git a/Makefile b/Makefile\nindex 9dc5a588e2..92fe9b5d5f 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -295,9 +295,6 @@ all::\n #\n # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).\n #\n-# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n-# MakeMaker (e.g. using ActiveState under Cygwin).\n-#\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n@@ -473,6 +470,7 @@ gitexecdir = libexec/git-core\n mergetoolsdir = $(gitexecdir)/mergetools\n sharedir = $(prefix)/share\n gitwebdir = $(sharedir)/gitweb\n+perllibdir = $(sharedir)/perl5\n localedir = $(sharedir)/locale\n template_dir = share/git-core/templates\n htmldir = $(prefix)/share/doc/git-doc\n@@ -486,7 +484,7 @@ mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))\n infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))\n htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))\n \n-export prefix bindir sharedir sysconfdir gitwebdir localedir\n+export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir\n \n CC = cc\n AR = ar\n@@ -1527,9 +1525,6 @@ ifdef SHA1_MAX_BLOCK_SIZE\n \tLIB_OBJS += compat/sha1-chunked.o\n \tBASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE=\"$(SHA1_MAX_BLOCK_SIZE)\"\n endif\n-ifdef NO_PERL_MAKEMAKER\n-\texport NO_PERL_MAKEMAKER\n-endif\n ifdef NO_HSTRERROR\n \tCOMPAT_CFLAGS += -DNO_HSTRERROR\n \tCOMPAT_OBJS += compat/hstrerror.o\n@@ -1716,8 +1711,10 @@ ETC_GITATTRIBUTES_SQ = $(subst ','\\'',$(ETC_GITATTRIBUTES))\n DESTDIR_SQ = $(subst ','\\'',$(DESTDIR))\n bindir_SQ = $(subst ','\\'',$(bindir))\n bindir_relative_SQ = $(subst ','\\'',$(bindir_relative))\n+mandir_SQ = $(subst ','\\'',$(mandir))\n mandir_relative_SQ = $(subst ','\\'',$(mandir_relative))\n infodir_relative_SQ = $(subst ','\\'',$(infodir_relative))\n+perllibdir_SQ = $(subst ','\\'',$(perllibdir))\n localedir_SQ = $(subst ','\\'',$(localedir))\n gitexecdir_SQ = $(subst ','\\'',$(gitexecdir))\n template_dir_SQ = $(subst ','\\'',$(template_dir))\n@@ -1826,9 +1823,6 @@ all::\n ifndef NO_TCLTK\n \t$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all\n \t$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all\n-endif\n-ifndef NO_PERL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all\n endif\n \t$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'\n \n@@ -1909,7 +1903,8 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)\n \n SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\\\n \t$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\\\n-\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV)\n+\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\\\n+\t$(perllibdir_SQ)\n define cmd_munge_script\n $(RM) $@ $@+ && \\\n sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n@@ -1953,29 +1948,17 @@ git.res: git.rc GIT-VERSION-FILE\n $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS\n \n ifndef NO_PERL\n-$(SCRIPT_PERL_GEN): perl/perl.mak\n-\n-perl/perl.mak: perl/PM.stamp\n-\n-perl/PM.stamp: FORCE\n-\t@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \\\n-\t$(PERL_PATH) -V >>$@+ && \\\n-\t{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \\\n-\t$(RM) $@+\n-\n-perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)\n+$(SCRIPT_PERL_GEN):\n \n-PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n-$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n+PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n+$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\n-\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n+\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n \t    -e '\tH' \\\n \t    -e '\tx' \\\n \t    -e '}' \\\n@@ -2293,6 +2276,21 @@ endif\n po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n \n+PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n+PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))\n+\n+ifndef NO_PERL\n+all:: $(PMCFILES)\n+endif\n+\n+perl/build/lib/%.pmc: perl/%.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n+\n+perl/build/man/man3/Git.3pm: perl/Git.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tpod2man $< $@\n+\n FIND_SOURCE_FILES = ( \\\n \tgit ls-files \\\n \t\t'*.[hcS]' \\\n@@ -2552,7 +2550,9 @@ ifndef NO_GETTEXT\n \t(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)\n endif\n ifndef NO_PERL\n-\t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n+\t(cd perl/build/lib && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n \t$(MAKE) -C gitweb install\n endif\n ifndef NO_TCLTK\n@@ -2602,12 +2602,17 @@ endif\n install-gitweb:\n \t$(MAKE) -C gitweb install\n \n-install-doc:\n+install-doc: install-man-perl\n \t$(MAKE) -C Documentation install\n \n-install-man:\n+install-man: install-man-perl\n \t$(MAKE) -C Documentation install-man\n \n+install-man-perl: perl/build/man/man3/Git.3pm\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'\n+\t(cd perl/build/man/man3 && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)\n+\n install-html:\n \t$(MAKE) -C Documentation install-html\n \n@@ -2699,7 +2704,7 @@ clean: profile-clean coverage-clean\n \t$(MAKE) -C Documentation/ clean\n ifndef NO_PERL\n \t$(MAKE) -C gitweb clean\n-\t$(MAKE) -C perl clean\n+\t$(RM) -r perl/build/\n endif\n \t$(MAKE) -C templates/ clean\n \t$(MAKE) -C t/ clean\ndiff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl\nindex df59bdfe97..fb0fd0b84b 100755\n--- a/contrib/examples/git-difftool.perl\n+++ b/contrib/examples/git-difftool.perl\n@@ -13,7 +13,7 @@\n use 5.008;\n use strict;\n use warnings;\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use File::Basename qw(dirname);\n use File::Copy;\n use File::Find;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex edcc6d3469..63ca2ddfb7 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -26,7 +26,7 @@ use Text::ParseWords;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n use File::Spec::Functions qw(catdir catfile);\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\ndiff --git a/perl/.gitignore b/perl/.gitignore\nindex 0f1fc27f86..84c048a73c 100644\n--- a/perl/.gitignore\n+++ b/perl/.gitignore\n@@ -1,8 +1 @@\n-perl.mak\n-perl.mak.old\n-MYMETA.json\n-MYMETA.yml\n-blib\n-blibdirs\n-pm_to_blib\n-PM.stamp\n+/build/\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex ffa09ace92..02a3871e94 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -101,7 +101,7 @@ increase notwithstanding).\n \n \n use Carp qw(carp croak); # but croak is bad - throw instead\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\ndiff --git a/perl/Git/Error.pm b/perl/Git/Error.pm\nnew file mode 100644\nindex 0000000000..09bbc97390\n--- /dev/null\n+++ b/perl/Git/Error.pm\n@@ -0,0 +1,46 @@\n+package Git::Error;\n+use 5.008;\n+use strict;\n+use warnings;\n+\n+=head1 NAME\n+\n+Git::Error - Wrapper for the L<Error> module, in case it's not installed\n+\n+=head1 DESCRIPTION\n+\n+Wraps the import function for the L<Error> module.\n+\n+This module is only intended to be used for code shipping in the\n+C<git.git> repository. Use it for anything else at your peril!\n+\n+=cut\n+\n+sub import {\n+    shift;\n+    my $caller = caller;\n+\n+    eval {\n+\trequire Error;\n+\t1;\n+    } or do {\n+\tmy $error = $@ || \"Zombie Error\";\n+\n+\tmy $Git_Error_pm_path = $INC{\"Git/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\n+\trequire File::Basename;\n+\tmy $Git_Error_pm_root = File::Basename::dirname($Git_Error_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_Error_pm_path'!\";\n+\n+\trequire File::Spec;\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');\n+\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n+\n+\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n+\trequire Error;\n+    };\n+\n+    unshift @_, $caller;\n+    goto &Error::import;\n+}\n+\n+1;\ndiff --git a/perl/private-Error.pm b/perl/Git/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/private-Error.pm\nrename to perl/Git/FromCPAN/Error.pm\ndiff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm\nindex 836a5c2382..dba96fff0a 100644\n--- a/perl/Git/I18N.pm\n+++ b/perl/Git/I18N.pm\n@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;\n \n sub __bootstrap_locale_messages {\n \tour $TEXTDOMAIN = 'git';\n-\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';\n+\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';\n \n \trequire POSIX;\n \tPOSIX->import(qw(setlocale));\ndiff --git a/perl/Makefile b/perl/Makefile\ndeleted file mode 100644\nindex f657de20e3..0000000000\n--- a/perl/Makefile\n+++ /dev/null\n@@ -1,90 +0,0 @@\n-#\n-# Makefile for perl support modules and routine\n-#\n-makfile:=perl.mak\n-modules =\n-\n-PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n-prefix_SQ = $(subst ','\\'',$(prefix))\n-localedir_SQ = $(subst ','\\'',$(localedir))\n-\n-ifndef V\n-\tQUIET = @\n-endif\n-\n-all install instlibdir: $(makfile)\n-\t$(QUIET)$(MAKE) -f $(makfile) $@\n-\n-clean:\n-\t$(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0\n-\t$(RM) ppport.h\n-\t$(RM) $(makfile)\n-\t$(RM) $(makfile).old\n-\t$(RM) PM.stamp\n-\n-$(makfile): PM.stamp\n-\n-ifdef NO_PERL_MAKEMAKER\n-instdir_SQ = $(subst ','\\'',$(prefix)/lib)\n-\n-modules += Git\n-modules += Git/I18N\n-modules += Git/IndexInfo\n-modules += Git/Packet\n-modules += Git/SVN\n-modules += Git/SVN/Memoize/YAML\n-modules += Git/SVN/Fetcher\n-modules += Git/SVN/Editor\n-modules += Git/SVN/GlobSpec\n-modules += Git/SVN/Log\n-modules += Git/SVN/Migration\n-modules += Git/SVN/Prompt\n-modules += Git/SVN/Ra\n-modules += Git/SVN/Utils\n-\n-$(makfile): ../GIT-CFLAGS Makefile\n-\techo all: private-Error.pm Git.pm Git/I18N.pm > $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) blib/lib/'$$i'.pm' >> $@; \\\n-\t\techo '\tmkdir -p blib/lib'$$subdir >> $@; \\\n-\t\techo '\tcp '$$i'.pm blib/lib/'$$i'.pm' >> $@; \\\n-\tdone\n-\techo '\t$(RM) blib/lib/Error.pm' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm blib/lib/Error.pm' >> $@\n-\techo install: >> $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\t\techo '\tmkdir -p \"$$(DESTDIR)$(instdir_SQ)'$$subdir'\"' >> $@; \\\n-\t\techo '\tcp '$$i'.pm \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\tdone\n-\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\techo instlibdir: >> $@\n-\techo '\techo $(instdir_SQ)' >> $@\n-else\n-$(makfile): Makefile.PL ../GIT-CFLAGS\n-\t$(PERL_PATH) $< PREFIX='$(prefix_SQ)' INSTALL_BASE='' --localedir='$(localedir_SQ)'\n-endif\n-\n-# this is just added comfort for calling make directly in perl dir\n-# (even though GIT-CFLAGS aren't used yet. If ever)\n-../GIT-CFLAGS:\n-\t$(MAKE) -C .. GIT-CFLAGS\ndiff --git a/perl/Makefile.PL b/perl/Makefile.PL\ndeleted file mode 100644\nindex 3f29ba98a6..0000000000\n--- a/perl/Makefile.PL\n+++ /dev/null\n@@ -1,62 +0,0 @@\n-use strict;\n-use warnings;\n-use ExtUtils::MakeMaker;\n-use Getopt::Long;\n-use File::Find;\n-\n-# Don't forget to update the perl/Makefile, too.\n-# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease\n-\n-# Sanity: die at first unknown option\n-Getopt::Long::Configure qw/ pass_through /;\n-\n-my $localedir = '';\n-GetOptions(\"localedir=s\" => \\$localedir);\n-\n-sub MY::postamble {\n-\treturn <<'MAKE_FRAG';\n-instlibdir:\n-\t@echo '$(INSTALLSITELIB)'\n-\n-ifneq (,$(DESTDIR))\n-ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))\n-$(error ExtUtils::MakeMaker version \"$(MM_VERSION)\" is older than 6.11 and so \\\n-\tis likely incompatible with the DESTDIR mechanism.  Try setting \\\n-\tNO_PERL_MAKEMAKER=1 instead)\n-endif\n-endif\n-\n-MAKE_FRAG\n-}\n-\n-# Find all the .pm files in \"Git/\" and Git.pm\n-my %pm;\n-find sub {\n-\treturn unless /\\.pm$/;\n-\n-\t# sometimes File::Find prepends a ./  Strip it.\n-\tmy $pm_path = $File::Find::name;\n-\t$pm_path =~ s{^\\./}{};\n-\n-\t$pm{$pm_path} = '$(INST_LIBDIR)/'.$pm_path;\n-}, \"Git\", \"Git.pm\";\n-\n-\n-# We come with our own bundled Error.pm. It's not in the set of default\n-# Perl modules so install it if it's not available on the system yet.\n-if ( !eval { require Error } || $Error::VERSION < 0.15009) {\n-\t$pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';\n-}\n-\n-# redirect stdout, otherwise the message \"Writing perl.mak for Git\"\n-# disrupts the output for the target 'instlibdir'\n-open STDOUT, \">&STDERR\";\n-\n-WriteMakefile(\n-\tNAME            => 'Git',\n-\tVERSION_FROM    => 'Git.pm',\n-\tPM\t\t=> \\%pm,\n-\tPM_FILTER\t=> qq[\\$(PERL) -pe \"s<\\\\Q++LOCALEDIR++\\\\E><$localedir>\"],\n-\tMAKEFILE\t=> 'perl.mak',\n-\tINSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'\n-);\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex e401208488..3096f4ec77 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -1,6 +1,6 @@\n #!/usr/bin/perl\n \n-use lib '../../perl/blib/lib';\n+use lib '../../perl/build/lib';\n use strict;\n use warnings;\n use Git;\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex e7065df2bb..a6f00ff712 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -919,7 +919,7 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/build/lib\n export GITPERLLIB\n test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\ndiff --git a/wrap-for-bin.sh b/wrap-for-bin.sh\nindex 22b6e4948f..5842408817 100644\n--- a/wrap-for-bin.sh\n+++ b/wrap-for-bin.sh\n@@ -14,7 +14,7 @@ else\n \tGIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'\n \texport GIT_TEMPLATE_DIR\n fi\n-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'\n PATH='@@BUILD_DIR@@/bin-wrappers:'\"$PATH\"\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"335064","messageId":"20171220061545.GF3693@zaya.teonanacatl.net","threadId":"47345","inReplyTo":"20171219235759.27570-1-avarab@gmail.com","subject":"Re: [PATCH v4] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2017-12-20T06:15:45Z","receivedAt":"2017-12-20T06:15:55Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Hi Ævar,\n\nÆvar Arnfjörð Bjarmason wrote:\n> Here's a hopefully final version. The only difference with v3 is:\n> \n>     -    local @_ = ($caller, @_);\n>     +    unshift @_, $caller;\n> \n> As it turns out localizing @_ isn't something that worked properly\n> until\n> https://github.com/Perl/perl5/commit/049bd5ffd62b73325d4b2e75e59ba04b3569137d\n> \n> That commit isn't part of the 5.16.3 version that ships with CentOS 7,\n> which explains why Michael J Gruber had issues with it. I've tested\n> this on CentOS 7 myself, it passes all tests now.\n\nThanks for tracking this down!\n\nFWIW, I applied this version to next and tested it with\nCentOS 6 and 7.  The tests pass on both (though there are\nsome unrelated failures on CentOS 6 in t5700-protocol-v1,\nwhich I haven't looked into further yet).\n\nI also applied this patch to 2.15.1 and ran the tests in the\nFedora build system for all fedora and epel releases, which\nalso passed (though with some spurious git-svn failures on\nx86_64 in fedora 28, AKA rawhide).\n\nThe .pmc extensions seem to cause rpm to fail to parse the\nfiles for rpm 'provides' as it normally would.  This causes\nscripts like git-send-email which generates a 'requires' on\nGit::Error to fail to find anything which provides it.\n\nI'm not familiar with the .pmc extenstion.  Searching the\nfedora repositories, there is only one other package - and\none file within it - which has a .pmc extension.\n\n(The package is perl-test, the file is\n/usr/libexec/perl5-tests/perl-tests/t/run/flib/t2.pmc.)\n\nPerhaps it's a bug in rpm's perl dependency generator, but\nI'd like to think that git wouldn't be the first package to\nfind it.\n\nIs the .pmc extension important to ensure these files are\nloaded in the right order?  Since they're all in the Git\nnamespace, I don't imagine there should be anything else in\n@INC which would be provided by the system or another\npackage.\n\nPardon my ignorance if I've missed the obvious (I haven't\nfully read \"perldoc -f require\" which you referenced in the\ncommit message).\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nSuppose I were a member of Congress, and suppose I were an idiot. But,\nI repeat myself.\n    -- Mark Twain\n\n"},{"id":"335071","messageId":"20171220115240.19510-1-avarab@gmail.com","threadId":"47345","inReplyTo":"20171220061545.GF3693@zaya.teonanacatl.net","subject":"[PATCH v5] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-12-20T11:52:40Z","receivedAt":"2017-12-20T11:53:03Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Replace the perl/Makefile.PL and the fallback perl/Makefile used under\nNO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\ninspired by how the i18n infrastructure's build process works[1].\n\nThe reason for having the Makefile.PL in the first place is that it\nwas initially[2] building a perl C binding to interface with libgit,\nthis functionality, that was removed[3] before Git.pm ever made it to\nthe master branch.\n\nWe've since since started maintaining a fallback perl/Makefile, as\nMakeMaker wouldn't work on some platforms[4]. That's just the tip of\nthe iceberg. We have the PM.stamp hack in the top-level Makefile[5] to\ndetect whether we need to regenerate the perl/perl.mak, which I fixed\njust recently to deal with issues like the perl version changing from\nunder us[6].\n\nThere is absolutely no reason for why this needs to be so complex\nanymore. All we're getting out of this elaborate Rube Goldberg machine\nwas copying perl/* to perl/blib/* as we do a string-replacement on\nthe *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as\npod2man-ing Git.pm & friends.\n\nSo replace the whole thing with something that's pretty much a copy of\nhow we generate po/build/**.mo from po/*.po, just with a small sed(1)\ncommand instead of msgfmt.\n\nWhile I'm at it, change the fallback for Error.pm from being something\nwhere we'll ship our own Error.pm if one doesn't exist at build time\nto one where we just use a Git::Error wrapper that'll always prefer\nthe system-wide Error.pm, only falling back to our own copy if it\nreally doesn't exist at runtime. It's now shipped as\nGit::FromCPAN::Error, making it easy to add other modules to\nGit::FromCPAN::* in the future if that's needed.\n\nFunctional changes:\n\n * This will not always install into perl's idea of its global\n   \"installsitelib\". This only potentially matters for packagers that\n   need to expose Git.pm for non-git use, and as explained in the\n   INSTALL file there's a trivial workaround.\n\n * The scripts themselves will 'use lib' the target directory, but if\n   INSTLIBDIR is set it overrides it. It doesn't have to be this way,\n   it could be set in addition to INSTLIBDIR, but my reading of [7] is\n   that this is the desired behavior.\n\n * We don't build man pages for all of the perl modules as we used to,\n   only Git(3pm). As discussed on-list[8] that we were building\n   installed manpages for purely internal APIs like Git::I18N or\n   private-Error.pm was always a bug anyway, and all the Git::SVN::*\n   ones say they're internal APIs.\n\n   There are apparently external users of Git.pm, but I don't expect\n   there to be any of the others.\n\n   As a side-effect of these general changes the perl documentation\n   now only installed by install-{doc,man}, not a mere \"install\" as\n   before.\n\n1. 5e9637c629 (\"i18n: add infrastructure for translating Git with\n   gettext\", 2011-11-18)\n\n2. b1edc53d06 (\"Introduce Git.pm (v4)\", 2006-06-24)\n\n3. 18b0fc1ce1 (\"Git.pm: Kill Git.xs for now\", 2006-09-23)\n\n4. f848718a69 (\"Make perl/ build procedure ActiveState friendly.\",\n   2006-12-04)\n\n5. ee9be06770 (\"perl: detect new files in MakeMaker builds\",\n   2012-07-27)\n\n6. c59c4939c2 (\"perl: regenerate perl.mak if perl -V changes\",\n   2017-03-29)\n\n7. 0386dd37b1 (\"Makefile: add PERLLIB_EXTRA variable that adds to\n   default perl path\", 2013-11-15)\n\n8. 87bmjjv1pu.fsf@evledraar.booking.com (\"Re: [PATCH] Makefile:\n   replace perl/Makefile.PL with simple make rules\"\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nOn Wed, Dec 20, 2017 at 7:15 AM, Todd Zullinger <tmz@pobox.com> wrote:\n\n[Sorry for not CC-ing you on the last version. Forgot to update the\ngiant send-email line I'm juggling for this series].\n\n> FWIW, I applied this version to next and tested it with\n> CentOS 6 and 7.  The tests pass on both (though there are\n> some unrelated failures on CentOS 6 in t5700-protocol-v1,\n> which I haven't looked into further yet).\n>\n> I also applied this patch to 2.15.1 and ran the tests in the\n> Fedora build system for all fedora and epel releases, which\n> also passed (though with some spurious git-svn failures on\n> x86_64 in fedora 28, AKA rawhide).\n\nGreat, thanks a lot.\n\n> The .pmc extensions seem to cause rpm to fail to parse the\n> files for rpm 'provides' as it normally would.  This causes\n> scripts like git-send-email which generates a 'requires' on\n> Git::Error to fail to find anything which provides it.\n>\n> I'm not familiar with the .pmc extenstion.  Searching the\n> fedora repositories, there is only one other package - and\n> one file within it - which has a .pmc extension.\n>\n> (The package is perl-test, the file is\n> /usr/libexec/perl5-tests/perl-tests/t/run/flib/t2.pmc.)\n>\n> Perhaps it's a bug in rpm's perl dependency generator, but\n> I'd like to think that git wouldn't be the first package to\n> find it.\n>\n> Is the .pmc extension important to ensure these files are\n> loaded in the right order?  Since they're all in the Git\n> namespace, I don't imagine there should be anything else in\n> @INC which would be provided by the system or another\n> package.\n>\n> Pardon my ignorance if I've missed the obvious (I haven't\n> fully read \"perldoc -f require\" which you referenced in the\n> commit message).\n\nThis *.pmc thing is just me being overly clever. Here's a v5 that gets\nrid of it. Diff with v4:\n\n    1: f85565f93b ! 1: 59cda7589f Makefile: replace perl/Makefile.PL with simple make rules\n        @@ -26,9 +26,7 @@\n\n             So replace the whole thing with something that's pretty much a copy of\n             how we generate po/build/**.mo from po/*.po, just with a small sed(1)\n        -    command instead of msgfmt. As that's being done rename the files\n        -    from *.pm to *.pmc just to indicate that they're generated (see\n        -    \"perldoc -f require\").\n        +    command instead of msgfmt.\n\n             While I'm at it, change the fallback for Error.pm from being something\n             where we'll ship our own Error.pm if one doesn't exist at build time\n        @@ -226,14 +224,14 @@\n          po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n            $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n\n        -+PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n        -+PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))\n        ++LIB_PERL := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n        ++LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n         +\n         +ifndef NO_PERL\n        -+all:: $(PMCFILES)\n        ++all:: $(LIB_PERL_GEN)\n         +endif\n         +\n        -+perl/build/lib/%.pmc: perl/%.pm\n        ++perl/build/lib/%.pm: perl/%.pm\n         +  $(QUIET_GEN)mkdir -p $(dir $@) && \\\n         +  sed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n         +\n\nAside from the tooling issues you mentioned:\n\n * It's obscure enough that lots of editors won't know *.pmc is perl\n   for syntax highlighting etc.\n\n * Even though this use case works, perl really expects you to have a\n   *.pm file alongside the *.pmc, so e.g if there's an error it\n   *reports the *.pm path, even though no such file exists. I.e. it's\n   *for compiler-generated files where the compiled version could have\n   *changed line numbers etc.\n\n INSTALL                                          | 17 ++++-\n Makefile                                         | 67 ++++++++++--------\n contrib/examples/git-difftool.perl               |  2 +-\n git-send-email.perl                              |  2 +-\n perl/.gitignore                                  |  9 +--\n perl/Git.pm                                      |  2 +-\n perl/Git/Error.pm                                | 46 ++++++++++++\n perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0\n perl/Git/I18N.pm                                 |  2 +-\n perl/Makefile                                    | 90 ------------------------\n perl/Makefile.PL                                 | 62 ----------------\n t/perf/aggregate.perl                            |  2 +-\n t/test-lib.sh                                    |  2 +-\n wrap-for-bin.sh                                  |  2 +-\n 14 files changed, 106 insertions(+), 199 deletions(-)\n create mode 100644 perl/Git/Error.pm\n rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)\n delete mode 100644 perl/Makefile\n delete mode 100644 perl/Makefile.PL\n\ndiff --git a/INSTALL b/INSTALL\nindex ffb071e9f0..808e07b659 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -84,9 +84,24 @@ Issues of note:\n \n \tGIT_EXEC_PATH=`pwd`\n \tPATH=`pwd`:$PATH\n-\tGITPERLLIB=`pwd`/perl/blib/lib\n+\tGITPERLLIB=`pwd`/perl/build/lib\n \texport GIT_EXEC_PATH PATH GITPERLLIB\n \n+ - By default (unless NO_PERL is provided) Git will ship various perl\n+   scripts & libraries it needs. However, for simplicity it doesn't\n+   use the ExtUtils::MakeMaker toolchain to decide where to place the\n+   perl libraries. Depending on the system this can result in the perl\n+   libraries not being where you'd like them if they're expected to be\n+   used by things other than Git itself.\n+\n+   Manually supplying a perllibdir prefix should fix this, if this is\n+   a problem you care about, e.g.:\n+\n+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')\n+\n+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,\n+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.\n+\n  - Git is reasonably self-sufficient, but does depend on a few external\n    programs and libraries.  Git can be used without most of them by adding\n    the approriate \"NO_<LIBRARY>=YesPlease\" to the make command line or\ndiff --git a/Makefile b/Makefile\nindex 9dc5a588e2..32a84c07fd 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -295,9 +295,6 @@ all::\n #\n # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).\n #\n-# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n-# MakeMaker (e.g. using ActiveState under Cygwin).\n-#\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n@@ -473,6 +470,7 @@ gitexecdir = libexec/git-core\n mergetoolsdir = $(gitexecdir)/mergetools\n sharedir = $(prefix)/share\n gitwebdir = $(sharedir)/gitweb\n+perllibdir = $(sharedir)/perl5\n localedir = $(sharedir)/locale\n template_dir = share/git-core/templates\n htmldir = $(prefix)/share/doc/git-doc\n@@ -486,7 +484,7 @@ mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))\n infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))\n htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))\n \n-export prefix bindir sharedir sysconfdir gitwebdir localedir\n+export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir\n \n CC = cc\n AR = ar\n@@ -1527,9 +1525,6 @@ ifdef SHA1_MAX_BLOCK_SIZE\n \tLIB_OBJS += compat/sha1-chunked.o\n \tBASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE=\"$(SHA1_MAX_BLOCK_SIZE)\"\n endif\n-ifdef NO_PERL_MAKEMAKER\n-\texport NO_PERL_MAKEMAKER\n-endif\n ifdef NO_HSTRERROR\n \tCOMPAT_CFLAGS += -DNO_HSTRERROR\n \tCOMPAT_OBJS += compat/hstrerror.o\n@@ -1716,8 +1711,10 @@ ETC_GITATTRIBUTES_SQ = $(subst ','\\'',$(ETC_GITATTRIBUTES))\n DESTDIR_SQ = $(subst ','\\'',$(DESTDIR))\n bindir_SQ = $(subst ','\\'',$(bindir))\n bindir_relative_SQ = $(subst ','\\'',$(bindir_relative))\n+mandir_SQ = $(subst ','\\'',$(mandir))\n mandir_relative_SQ = $(subst ','\\'',$(mandir_relative))\n infodir_relative_SQ = $(subst ','\\'',$(infodir_relative))\n+perllibdir_SQ = $(subst ','\\'',$(perllibdir))\n localedir_SQ = $(subst ','\\'',$(localedir))\n gitexecdir_SQ = $(subst ','\\'',$(gitexecdir))\n template_dir_SQ = $(subst ','\\'',$(template_dir))\n@@ -1826,9 +1823,6 @@ all::\n ifndef NO_TCLTK\n \t$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all\n \t$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all\n-endif\n-ifndef NO_PERL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all\n endif\n \t$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'\n \n@@ -1909,7 +1903,8 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)\n \n SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\\\n \t$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\\\n-\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV)\n+\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\\\n+\t$(perllibdir_SQ)\n define cmd_munge_script\n $(RM) $@ $@+ && \\\n sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n@@ -1953,29 +1948,17 @@ git.res: git.rc GIT-VERSION-FILE\n $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS\n \n ifndef NO_PERL\n-$(SCRIPT_PERL_GEN): perl/perl.mak\n-\n-perl/perl.mak: perl/PM.stamp\n-\n-perl/PM.stamp: FORCE\n-\t@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \\\n-\t$(PERL_PATH) -V >>$@+ && \\\n-\t{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \\\n-\t$(RM) $@+\n-\n-perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)\n+$(SCRIPT_PERL_GEN):\n \n-PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n-$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n+PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n+$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\n-\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n+\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n \t    -e '\tH' \\\n \t    -e '\tx' \\\n \t    -e '}' \\\n@@ -2293,6 +2276,21 @@ endif\n po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n \n+LIB_PERL := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n+LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n+\n+ifndef NO_PERL\n+all:: $(LIB_PERL_GEN)\n+endif\n+\n+perl/build/lib/%.pm: perl/%.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n+\n+perl/build/man/man3/Git.3pm: perl/Git.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tpod2man $< $@\n+\n FIND_SOURCE_FILES = ( \\\n \tgit ls-files \\\n \t\t'*.[hcS]' \\\n@@ -2552,7 +2550,9 @@ ifndef NO_GETTEXT\n \t(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)\n endif\n ifndef NO_PERL\n-\t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n+\t(cd perl/build/lib && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n \t$(MAKE) -C gitweb install\n endif\n ifndef NO_TCLTK\n@@ -2602,12 +2602,17 @@ endif\n install-gitweb:\n \t$(MAKE) -C gitweb install\n \n-install-doc:\n+install-doc: install-man-perl\n \t$(MAKE) -C Documentation install\n \n-install-man:\n+install-man: install-man-perl\n \t$(MAKE) -C Documentation install-man\n \n+install-man-perl: perl/build/man/man3/Git.3pm\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'\n+\t(cd perl/build/man/man3 && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)\n+\n install-html:\n \t$(MAKE) -C Documentation install-html\n \n@@ -2699,7 +2704,7 @@ clean: profile-clean coverage-clean\n \t$(MAKE) -C Documentation/ clean\n ifndef NO_PERL\n \t$(MAKE) -C gitweb clean\n-\t$(MAKE) -C perl clean\n+\t$(RM) -r perl/build/\n endif\n \t$(MAKE) -C templates/ clean\n \t$(MAKE) -C t/ clean\ndiff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl\nindex df59bdfe97..fb0fd0b84b 100755\n--- a/contrib/examples/git-difftool.perl\n+++ b/contrib/examples/git-difftool.perl\n@@ -13,7 +13,7 @@\n use 5.008;\n use strict;\n use warnings;\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use File::Basename qw(dirname);\n use File::Copy;\n use File::Find;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex edcc6d3469..63ca2ddfb7 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -26,7 +26,7 @@ use Text::ParseWords;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n use File::Spec::Functions qw(catdir catfile);\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\ndiff --git a/perl/.gitignore b/perl/.gitignore\nindex 0f1fc27f86..84c048a73c 100644\n--- a/perl/.gitignore\n+++ b/perl/.gitignore\n@@ -1,8 +1 @@\n-perl.mak\n-perl.mak.old\n-MYMETA.json\n-MYMETA.yml\n-blib\n-blibdirs\n-pm_to_blib\n-PM.stamp\n+/build/\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex ffa09ace92..02a3871e94 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -101,7 +101,7 @@ increase notwithstanding).\n \n \n use Carp qw(carp croak); # but croak is bad - throw instead\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\ndiff --git a/perl/Git/Error.pm b/perl/Git/Error.pm\nnew file mode 100644\nindex 0000000000..09bbc97390\n--- /dev/null\n+++ b/perl/Git/Error.pm\n@@ -0,0 +1,46 @@\n+package Git::Error;\n+use 5.008;\n+use strict;\n+use warnings;\n+\n+=head1 NAME\n+\n+Git::Error - Wrapper for the L<Error> module, in case it's not installed\n+\n+=head1 DESCRIPTION\n+\n+Wraps the import function for the L<Error> module.\n+\n+This module is only intended to be used for code shipping in the\n+C<git.git> repository. Use it for anything else at your peril!\n+\n+=cut\n+\n+sub import {\n+    shift;\n+    my $caller = caller;\n+\n+    eval {\n+\trequire Error;\n+\t1;\n+    } or do {\n+\tmy $error = $@ || \"Zombie Error\";\n+\n+\tmy $Git_Error_pm_path = $INC{\"Git/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\n+\trequire File::Basename;\n+\tmy $Git_Error_pm_root = File::Basename::dirname($Git_Error_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_Error_pm_path'!\";\n+\n+\trequire File::Spec;\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');\n+\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n+\n+\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n+\trequire Error;\n+    };\n+\n+    unshift @_, $caller;\n+    goto &Error::import;\n+}\n+\n+1;\ndiff --git a/perl/private-Error.pm b/perl/Git/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/private-Error.pm\nrename to perl/Git/FromCPAN/Error.pm\ndiff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm\nindex 836a5c2382..dba96fff0a 100644\n--- a/perl/Git/I18N.pm\n+++ b/perl/Git/I18N.pm\n@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;\n \n sub __bootstrap_locale_messages {\n \tour $TEXTDOMAIN = 'git';\n-\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';\n+\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';\n \n \trequire POSIX;\n \tPOSIX->import(qw(setlocale));\ndiff --git a/perl/Makefile b/perl/Makefile\ndeleted file mode 100644\nindex f657de20e3..0000000000\n--- a/perl/Makefile\n+++ /dev/null\n@@ -1,90 +0,0 @@\n-#\n-# Makefile for perl support modules and routine\n-#\n-makfile:=perl.mak\n-modules =\n-\n-PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n-prefix_SQ = $(subst ','\\'',$(prefix))\n-localedir_SQ = $(subst ','\\'',$(localedir))\n-\n-ifndef V\n-\tQUIET = @\n-endif\n-\n-all install instlibdir: $(makfile)\n-\t$(QUIET)$(MAKE) -f $(makfile) $@\n-\n-clean:\n-\t$(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0\n-\t$(RM) ppport.h\n-\t$(RM) $(makfile)\n-\t$(RM) $(makfile).old\n-\t$(RM) PM.stamp\n-\n-$(makfile): PM.stamp\n-\n-ifdef NO_PERL_MAKEMAKER\n-instdir_SQ = $(subst ','\\'',$(prefix)/lib)\n-\n-modules += Git\n-modules += Git/I18N\n-modules += Git/IndexInfo\n-modules += Git/Packet\n-modules += Git/SVN\n-modules += Git/SVN/Memoize/YAML\n-modules += Git/SVN/Fetcher\n-modules += Git/SVN/Editor\n-modules += Git/SVN/GlobSpec\n-modules += Git/SVN/Log\n-modules += Git/SVN/Migration\n-modules += Git/SVN/Prompt\n-modules += Git/SVN/Ra\n-modules += Git/SVN/Utils\n-\n-$(makfile): ../GIT-CFLAGS Makefile\n-\techo all: private-Error.pm Git.pm Git/I18N.pm > $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) blib/lib/'$$i'.pm' >> $@; \\\n-\t\techo '\tmkdir -p blib/lib'$$subdir >> $@; \\\n-\t\techo '\tcp '$$i'.pm blib/lib/'$$i'.pm' >> $@; \\\n-\tdone\n-\techo '\t$(RM) blib/lib/Error.pm' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm blib/lib/Error.pm' >> $@\n-\techo install: >> $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\t\techo '\tmkdir -p \"$$(DESTDIR)$(instdir_SQ)'$$subdir'\"' >> $@; \\\n-\t\techo '\tcp '$$i'.pm \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\tdone\n-\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\techo instlibdir: >> $@\n-\techo '\techo $(instdir_SQ)' >> $@\n-else\n-$(makfile): Makefile.PL ../GIT-CFLAGS\n-\t$(PERL_PATH) $< PREFIX='$(prefix_SQ)' INSTALL_BASE='' --localedir='$(localedir_SQ)'\n-endif\n-\n-# this is just added comfort for calling make directly in perl dir\n-# (even though GIT-CFLAGS aren't used yet. If ever)\n-../GIT-CFLAGS:\n-\t$(MAKE) -C .. GIT-CFLAGS\ndiff --git a/perl/Makefile.PL b/perl/Makefile.PL\ndeleted file mode 100644\nindex 3f29ba98a6..0000000000\n--- a/perl/Makefile.PL\n+++ /dev/null\n@@ -1,62 +0,0 @@\n-use strict;\n-use warnings;\n-use ExtUtils::MakeMaker;\n-use Getopt::Long;\n-use File::Find;\n-\n-# Don't forget to update the perl/Makefile, too.\n-# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease\n-\n-# Sanity: die at first unknown option\n-Getopt::Long::Configure qw/ pass_through /;\n-\n-my $localedir = '';\n-GetOptions(\"localedir=s\" => \\$localedir);\n-\n-sub MY::postamble {\n-\treturn <<'MAKE_FRAG';\n-instlibdir:\n-\t@echo '$(INSTALLSITELIB)'\n-\n-ifneq (,$(DESTDIR))\n-ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))\n-$(error ExtUtils::MakeMaker version \"$(MM_VERSION)\" is older than 6.11 and so \\\n-\tis likely incompatible with the DESTDIR mechanism.  Try setting \\\n-\tNO_PERL_MAKEMAKER=1 instead)\n-endif\n-endif\n-\n-MAKE_FRAG\n-}\n-\n-# Find all the .pm files in \"Git/\" and Git.pm\n-my %pm;\n-find sub {\n-\treturn unless /\\.pm$/;\n-\n-\t# sometimes File::Find prepends a ./  Strip it.\n-\tmy $pm_path = $File::Find::name;\n-\t$pm_path =~ s{^\\./}{};\n-\n-\t$pm{$pm_path} = '$(INST_LIBDIR)/'.$pm_path;\n-}, \"Git\", \"Git.pm\";\n-\n-\n-# We come with our own bundled Error.pm. It's not in the set of default\n-# Perl modules so install it if it's not available on the system yet.\n-if ( !eval { require Error } || $Error::VERSION < 0.15009) {\n-\t$pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';\n-}\n-\n-# redirect stdout, otherwise the message \"Writing perl.mak for Git\"\n-# disrupts the output for the target 'instlibdir'\n-open STDOUT, \">&STDERR\";\n-\n-WriteMakefile(\n-\tNAME            => 'Git',\n-\tVERSION_FROM    => 'Git.pm',\n-\tPM\t\t=> \\%pm,\n-\tPM_FILTER\t=> qq[\\$(PERL) -pe \"s<\\\\Q++LOCALEDIR++\\\\E><$localedir>\"],\n-\tMAKEFILE\t=> 'perl.mak',\n-\tINSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'\n-);\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex e401208488..3096f4ec77 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -1,6 +1,6 @@\n #!/usr/bin/perl\n \n-use lib '../../perl/blib/lib';\n+use lib '../../perl/build/lib';\n use strict;\n use warnings;\n use Git;\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex e7065df2bb..a6f00ff712 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -919,7 +919,7 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/build/lib\n export GITPERLLIB\n test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\ndiff --git a/wrap-for-bin.sh b/wrap-for-bin.sh\nindex 22b6e4948f..5842408817 100644\n--- a/wrap-for-bin.sh\n+++ b/wrap-for-bin.sh\n@@ -14,7 +14,7 @@ else\n \tGIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'\n \texport GIT_TEMPLATE_DIR\n fi\n-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'\n PATH='@@BUILD_DIR@@/bin-wrappers:'\"$PATH\"\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"335092","messageId":"20171220174147.GG3693@zaya.teonanacatl.net","threadId":"47345","inReplyTo":"20171220115240.19510-1-avarab@gmail.com","subject":"Re: [PATCH v5] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2017-12-20T17:41:47Z","receivedAt":"2017-12-20T17:41:56Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n> [Sorry for not CC-ing you on the last version. Forgot to update the\n> giant send-email line I'm juggling for this series].\n\nNo worries.  It is a rather large CC list at this point. :)\n\n> This *.pmc thing is just me being overly clever. Here's a v5 that gets\n> rid of it. Diff with v4:\n\nAhh, thanks for the additional details on this.\n\n>         -+PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n>         -+PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))\n>         ++LIB_PERL := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n>         ++LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n>          +\n>          +ifndef NO_PERL\n>         -+all:: $(PMCFILES)\n>         ++all:: $(LIB_PERL_GEN)\n>          +endif\n>          +\n>         -+perl/build/lib/%.pmc: perl/%.pm\n>         ++perl/build/lib/%.pm: perl/%.pm\n>          +  $(QUIET_GEN)mkdir -p $(dir $@) && \\\n>          +  sed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n>          +\n\nWithout the .pmc extensions, rpm picks up the perl\ndependencies, which is good.  But an additional build/lib\ndir is created, which ends up in $perllibdir after install.\n\nHere's an extract from a local build:\n\nmkdir -p perl/build/lib/build/lib/ && \\\nsed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git.pm > perl/build/lib/build/lib/Git.pm\nmkdir -p perl/build/lib/build/lib/Git/ && \\\nsed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git/IndexInfo.pm > perl/build/lib/build/lib/Git/IndexInfo.pm\nmkdir -p perl/build/lib/build/lib/Git/ && \\\nsed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git/SVN.pm > perl/build/lib/build/lib/Git/SVN.pm\nmkdir -p perl/build/lib/build/lib/Git/ && \\\nsed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git/Error.pm > perl/build/lib/build/lib/Git/Error.pm\nmkdir -p perl/build/lib/build/lib/Git/ && \\\nsed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git/I18N.pm > perl/build/lib/build/lib/Git/I18N.pm\n\nWhen PMFILES and PMCFILES matched .pm and .pmc respectively,\nthe glob didn't match duplicated files under build/lib, so\nthis wasn't an issue.  I'm not sure where this is best\nfixed.  The build/lib dir could be moved outside of perl or\nit could be made .build/lib to avoid the wildcard match,\nperhaps.\n\nBuilding with perllibdir=/usr/share/perl5/vendor_perl\nresults in:\n\n/usr/share/perl5/vendor_perl/Git\n/usr/share/perl5/vendor_perl/Git.pm\n/usr/share/perl5/vendor_perl/Git/Error.pm\n/usr/share/perl5/vendor_perl/Git/FromCPAN\n/usr/share/perl5/vendor_perl/Git/FromCPAN/Error.pm\n/usr/share/perl5/vendor_perl/Git/I18N.pm\n/usr/share/perl5/vendor_perl/Git/IndexInfo.pm\n/usr/share/perl5/vendor_perl/Git/SVN\n/usr/share/perl5/vendor_perl/Git/SVN.pm\n/usr/share/perl5/vendor_perl/Git/SVN/Editor.pm\n/usr/share/perl5/vendor_perl/Git/SVN/Fetcher.pm\n/usr/share/perl5/vendor_perl/Git/SVN/GlobSpec.pm\n/usr/share/perl5/vendor_perl/Git/SVN/Log.pm\n/usr/share/perl5/vendor_perl/Git/SVN/Memoize\n/usr/share/perl5/vendor_perl/Git/SVN/Memoize/YAML.pm\n/usr/share/perl5/vendor_perl/Git/SVN/Migration.pm\n/usr/share/perl5/vendor_perl/Git/SVN/Prompt.pm\n/usr/share/perl5/vendor_perl/Git/SVN/Ra.pm\n/usr/share/perl5/vendor_perl/Git/SVN/Utils.pm\n/usr/share/perl5/vendor_perl/build\n/usr/share/perl5/vendor_perl/build/lib\n/usr/share/perl5/vendor_perl/build/lib/Git\n/usr/share/perl5/vendor_perl/build/lib/Git.pm\n/usr/share/perl5/vendor_perl/build/lib/Git/Error.pm\n/usr/share/perl5/vendor_perl/build/lib/Git/I18N.pm\n/usr/share/perl5/vendor_perl/build/lib/Git/IndexInfo.pm\n/usr/share/perl5/vendor_perl/build/lib/Git/SVN.pm\n\nNote that not all of the .pm files are matched, which I\nbelieve is due to the glob matches only going 4 levels deep\nunder the perl dir.\n\nThanks,\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nNever do today that which will become someone else's responsibility\ntomorrow.\n\n"},{"id":"335096","messageId":"20171220182419.16865-1-avarab@gmail.com","threadId":"47345","inReplyTo":"20171220174147.GG3693@zaya.teonanacatl.net","subject":"[PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-12-20T18:24:19Z","receivedAt":"2017-12-20T18:24:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Replace the perl/Makefile.PL and the fallback perl/Makefile used under\nNO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\ninspired by how the i18n infrastructure's build process works[1].\n\nThe reason for having the Makefile.PL in the first place is that it\nwas initially[2] building a perl C binding to interface with libgit,\nthis functionality, that was removed[3] before Git.pm ever made it to\nthe master branch.\n\nWe've since since started maintaining a fallback perl/Makefile, as\nMakeMaker wouldn't work on some platforms[4]. That's just the tip of\nthe iceberg. We have the PM.stamp hack in the top-level Makefile[5] to\ndetect whether we need to regenerate the perl/perl.mak, which I fixed\njust recently to deal with issues like the perl version changing from\nunder us[6].\n\nThere is absolutely no reason for why this needs to be so complex\nanymore. All we're getting out of this elaborate Rube Goldberg machine\nwas copying perl/* to perl/blib/* as we do a string-replacement on\nthe *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as\npod2man-ing Git.pm & friends.\n\nSo replace the whole thing with something that's pretty much a copy of\nhow we generate po/build/**.mo from po/*.po, just with a small sed(1)\ncommand instead of msgfmt.\n\nWhile I'm at it, change the fallback for Error.pm from being something\nwhere we'll ship our own Error.pm if one doesn't exist at build time\nto one where we just use a Git::Error wrapper that'll always prefer\nthe system-wide Error.pm, only falling back to our own copy if it\nreally doesn't exist at runtime. It's now shipped as\nGit::FromCPAN::Error, making it easy to add other modules to\nGit::FromCPAN::* in the future if that's needed.\n\nFunctional changes:\n\n * This will not always install into perl's idea of its global\n   \"installsitelib\". This only potentially matters for packagers that\n   need to expose Git.pm for non-git use, and as explained in the\n   INSTALL file there's a trivial workaround.\n\n * The scripts themselves will 'use lib' the target directory, but if\n   INSTLIBDIR is set it overrides it. It doesn't have to be this way,\n   it could be set in addition to INSTLIBDIR, but my reading of [7] is\n   that this is the desired behavior.\n\n * We don't build man pages for all of the perl modules as we used to,\n   only Git(3pm). As discussed on-list[8] that we were building\n   installed manpages for purely internal APIs like Git::I18N or\n   private-Error.pm was always a bug anyway, and all the Git::SVN::*\n   ones say they're internal APIs.\n\n   There are apparently external users of Git.pm, but I don't expect\n   there to be any of the others.\n\n   As a side-effect of these general changes the perl documentation\n   now only installed by install-{doc,man}, not a mere \"install\" as\n   before.\n\n1. 5e9637c629 (\"i18n: add infrastructure for translating Git with\n   gettext\", 2011-11-18)\n\n2. b1edc53d06 (\"Introduce Git.pm (v4)\", 2006-06-24)\n\n3. 18b0fc1ce1 (\"Git.pm: Kill Git.xs for now\", 2006-09-23)\n\n4. f848718a69 (\"Make perl/ build procedure ActiveState friendly.\",\n   2006-12-04)\n\n5. ee9be06770 (\"perl: detect new files in MakeMaker builds\",\n   2012-07-27)\n\n6. c59c4939c2 (\"perl: regenerate perl.mak if perl -V changes\",\n   2017-03-29)\n\n7. 0386dd37b1 (\"Makefile: add PERLLIB_EXTRA variable that adds to\n   default perl path\", 2013-11-15)\n\n8. 87bmjjv1pu.fsf@evledraar.booking.com (\"Re: [PATCH] Makefile:\n   replace perl/Makefile.PL with simple make rules\"\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nOn Wed, Dec 20, 2017 at 6:41 PM, Todd Zullinger <tmz@pobox.com> wrote:\n> /usr/share/perl5/vendor_perl/Git\n> /usr/share/perl5/vendor_perl/Git.pm\n> /usr/share/perl5/vendor_perl/Git/Error.pm\n> [...]\n> /usr/share/perl5/vendor_perl/build\n> /usr/share/perl5/vendor_perl/build/lib\n> /usr/share/perl5/vendor_perl/build/lib/Git\n> /usr/share/perl5/vendor_perl/build/lib/Git.pm\n> /usr/share/perl5/vendor_perl/build/lib/Git/Error.pm\n> [...]\n> Note that not all of the .pm files are matched, which I\n> believe is due to the glob matches only going 4 levels deep\n> under the perl dir.\n\nOuch, that's a stupid mistake of mine. Didn't consider that changing\nit from *.pm to *.pmc would of course impact that glob match.\n\nThis fixes it, changes against v5:\n\n    @@ -224,7 +224,7 @@\n      po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n        $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n      \n    -+LIB_PERL := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n    ++LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n     +LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n     +\n     +ifndef NO_PERL\n\nI.e. let's keep calling it \"build\" for consistency with other stuff\nand so \"ls\" will show it, but just alter the glob so we'll only match\nmodules like Git{,::*}. I don't think we'll ever add anything outside\nthat namespace, so this seems like the best solution.\n\nWith this \"make install\" gives the expected results, i.e. no build/\ndirectory in perllibdir.\n\n INSTALL                                          | 17 ++++-\n Makefile                                         | 67 ++++++++++--------\n contrib/examples/git-difftool.perl               |  2 +-\n git-send-email.perl                              |  2 +-\n perl/.gitignore                                  |  9 +--\n perl/Git.pm                                      |  2 +-\n perl/Git/Error.pm                                | 46 ++++++++++++\n perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0\n perl/Git/I18N.pm                                 |  2 +-\n perl/Makefile                                    | 90 ------------------------\n perl/Makefile.PL                                 | 62 ----------------\n t/perf/aggregate.perl                            |  2 +-\n t/test-lib.sh                                    |  2 +-\n wrap-for-bin.sh                                  |  2 +-\n 14 files changed, 106 insertions(+), 199 deletions(-)\n create mode 100644 perl/Git/Error.pm\n rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)\n delete mode 100644 perl/Makefile\n delete mode 100644 perl/Makefile.PL\n\ndiff --git a/INSTALL b/INSTALL\nindex ffb071e9f0..808e07b659 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -84,9 +84,24 @@ Issues of note:\n \n \tGIT_EXEC_PATH=`pwd`\n \tPATH=`pwd`:$PATH\n-\tGITPERLLIB=`pwd`/perl/blib/lib\n+\tGITPERLLIB=`pwd`/perl/build/lib\n \texport GIT_EXEC_PATH PATH GITPERLLIB\n \n+ - By default (unless NO_PERL is provided) Git will ship various perl\n+   scripts & libraries it needs. However, for simplicity it doesn't\n+   use the ExtUtils::MakeMaker toolchain to decide where to place the\n+   perl libraries. Depending on the system this can result in the perl\n+   libraries not being where you'd like them if they're expected to be\n+   used by things other than Git itself.\n+\n+   Manually supplying a perllibdir prefix should fix this, if this is\n+   a problem you care about, e.g.:\n+\n+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')\n+\n+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,\n+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.\n+\n  - Git is reasonably self-sufficient, but does depend on a few external\n    programs and libraries.  Git can be used without most of them by adding\n    the approriate \"NO_<LIBRARY>=YesPlease\" to the make command line or\ndiff --git a/Makefile b/Makefile\nindex 9dc5a588e2..3e7e662c1e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -295,9 +295,6 @@ all::\n #\n # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).\n #\n-# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n-# MakeMaker (e.g. using ActiveState under Cygwin).\n-#\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n@@ -473,6 +470,7 @@ gitexecdir = libexec/git-core\n mergetoolsdir = $(gitexecdir)/mergetools\n sharedir = $(prefix)/share\n gitwebdir = $(sharedir)/gitweb\n+perllibdir = $(sharedir)/perl5\n localedir = $(sharedir)/locale\n template_dir = share/git-core/templates\n htmldir = $(prefix)/share/doc/git-doc\n@@ -486,7 +484,7 @@ mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))\n infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))\n htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))\n \n-export prefix bindir sharedir sysconfdir gitwebdir localedir\n+export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir\n \n CC = cc\n AR = ar\n@@ -1527,9 +1525,6 @@ ifdef SHA1_MAX_BLOCK_SIZE\n \tLIB_OBJS += compat/sha1-chunked.o\n \tBASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE=\"$(SHA1_MAX_BLOCK_SIZE)\"\n endif\n-ifdef NO_PERL_MAKEMAKER\n-\texport NO_PERL_MAKEMAKER\n-endif\n ifdef NO_HSTRERROR\n \tCOMPAT_CFLAGS += -DNO_HSTRERROR\n \tCOMPAT_OBJS += compat/hstrerror.o\n@@ -1716,8 +1711,10 @@ ETC_GITATTRIBUTES_SQ = $(subst ','\\'',$(ETC_GITATTRIBUTES))\n DESTDIR_SQ = $(subst ','\\'',$(DESTDIR))\n bindir_SQ = $(subst ','\\'',$(bindir))\n bindir_relative_SQ = $(subst ','\\'',$(bindir_relative))\n+mandir_SQ = $(subst ','\\'',$(mandir))\n mandir_relative_SQ = $(subst ','\\'',$(mandir_relative))\n infodir_relative_SQ = $(subst ','\\'',$(infodir_relative))\n+perllibdir_SQ = $(subst ','\\'',$(perllibdir))\n localedir_SQ = $(subst ','\\'',$(localedir))\n gitexecdir_SQ = $(subst ','\\'',$(gitexecdir))\n template_dir_SQ = $(subst ','\\'',$(template_dir))\n@@ -1826,9 +1823,6 @@ all::\n ifndef NO_TCLTK\n \t$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all\n \t$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all\n-endif\n-ifndef NO_PERL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all\n endif\n \t$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'\n \n@@ -1909,7 +1903,8 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)\n \n SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\\\n \t$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\\\n-\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV)\n+\t$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\\\n+\t$(perllibdir_SQ)\n define cmd_munge_script\n $(RM) $@ $@+ && \\\n sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n@@ -1953,29 +1948,17 @@ git.res: git.rc GIT-VERSION-FILE\n $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS\n \n ifndef NO_PERL\n-$(SCRIPT_PERL_GEN): perl/perl.mak\n-\n-perl/perl.mak: perl/PM.stamp\n-\n-perl/PM.stamp: FORCE\n-\t@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \\\n-\t$(PERL_PATH) -V >>$@+ && \\\n-\t{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \\\n-\t$(RM) $@+\n-\n-perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL\n-\t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)\n+$(SCRIPT_PERL_GEN):\n \n-PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n-$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n+PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n+$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\n-\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n+\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n \t    -e '\tH' \\\n \t    -e '\tx' \\\n \t    -e '}' \\\n@@ -2293,6 +2276,21 @@ endif\n po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n \n+LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n+LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n+\n+ifndef NO_PERL\n+all:: $(LIB_PERL_GEN)\n+endif\n+\n+perl/build/lib/%.pm: perl/%.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n+\n+perl/build/man/man3/Git.3pm: perl/Git.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n+\tpod2man $< $@\n+\n FIND_SOURCE_FILES = ( \\\n \tgit ls-files \\\n \t\t'*.[hcS]' \\\n@@ -2552,7 +2550,9 @@ ifndef NO_GETTEXT\n \t(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)\n endif\n ifndef NO_PERL\n-\t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n+\t(cd perl/build/lib && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n \t$(MAKE) -C gitweb install\n endif\n ifndef NO_TCLTK\n@@ -2602,12 +2602,17 @@ endif\n install-gitweb:\n \t$(MAKE) -C gitweb install\n \n-install-doc:\n+install-doc: install-man-perl\n \t$(MAKE) -C Documentation install\n \n-install-man:\n+install-man: install-man-perl\n \t$(MAKE) -C Documentation install-man\n \n+install-man-perl: perl/build/man/man3/Git.3pm\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'\n+\t(cd perl/build/man/man3 && $(TAR) cf - .) | \\\n+\t(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)\n+\n install-html:\n \t$(MAKE) -C Documentation install-html\n \n@@ -2699,7 +2704,7 @@ clean: profile-clean coverage-clean\n \t$(MAKE) -C Documentation/ clean\n ifndef NO_PERL\n \t$(MAKE) -C gitweb clean\n-\t$(MAKE) -C perl clean\n+\t$(RM) -r perl/build/\n endif\n \t$(MAKE) -C templates/ clean\n \t$(MAKE) -C t/ clean\ndiff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl\nindex df59bdfe97..fb0fd0b84b 100755\n--- a/contrib/examples/git-difftool.perl\n+++ b/contrib/examples/git-difftool.perl\n@@ -13,7 +13,7 @@\n use 5.008;\n use strict;\n use warnings;\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use File::Basename qw(dirname);\n use File::Copy;\n use File::Find;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex edcc6d3469..63ca2ddfb7 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -26,7 +26,7 @@ use Text::ParseWords;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n use File::Spec::Functions qw(catdir catfile);\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\ndiff --git a/perl/.gitignore b/perl/.gitignore\nindex 0f1fc27f86..84c048a73c 100644\n--- a/perl/.gitignore\n+++ b/perl/.gitignore\n@@ -1,8 +1 @@\n-perl.mak\n-perl.mak.old\n-MYMETA.json\n-MYMETA.yml\n-blib\n-blibdirs\n-pm_to_blib\n-PM.stamp\n+/build/\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex ffa09ace92..02a3871e94 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -101,7 +101,7 @@ increase notwithstanding).\n \n \n use Carp qw(carp croak); # but croak is bad - throw instead\n-use Error qw(:try);\n+use Git::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\ndiff --git a/perl/Git/Error.pm b/perl/Git/Error.pm\nnew file mode 100644\nindex 0000000000..09bbc97390\n--- /dev/null\n+++ b/perl/Git/Error.pm\n@@ -0,0 +1,46 @@\n+package Git::Error;\n+use 5.008;\n+use strict;\n+use warnings;\n+\n+=head1 NAME\n+\n+Git::Error - Wrapper for the L<Error> module, in case it's not installed\n+\n+=head1 DESCRIPTION\n+\n+Wraps the import function for the L<Error> module.\n+\n+This module is only intended to be used for code shipping in the\n+C<git.git> repository. Use it for anything else at your peril!\n+\n+=cut\n+\n+sub import {\n+    shift;\n+    my $caller = caller;\n+\n+    eval {\n+\trequire Error;\n+\t1;\n+    } or do {\n+\tmy $error = $@ || \"Zombie Error\";\n+\n+\tmy $Git_Error_pm_path = $INC{\"Git/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\n+\trequire File::Basename;\n+\tmy $Git_Error_pm_root = File::Basename::dirname($Git_Error_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_Error_pm_path'!\";\n+\n+\trequire File::Spec;\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');\n+\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n+\n+\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n+\trequire Error;\n+    };\n+\n+    unshift @_, $caller;\n+    goto &Error::import;\n+}\n+\n+1;\ndiff --git a/perl/private-Error.pm b/perl/Git/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/private-Error.pm\nrename to perl/Git/FromCPAN/Error.pm\ndiff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm\nindex 836a5c2382..dba96fff0a 100644\n--- a/perl/Git/I18N.pm\n+++ b/perl/Git/I18N.pm\n@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;\n \n sub __bootstrap_locale_messages {\n \tour $TEXTDOMAIN = 'git';\n-\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';\n+\tour $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';\n \n \trequire POSIX;\n \tPOSIX->import(qw(setlocale));\ndiff --git a/perl/Makefile b/perl/Makefile\ndeleted file mode 100644\nindex f657de20e3..0000000000\n--- a/perl/Makefile\n+++ /dev/null\n@@ -1,90 +0,0 @@\n-#\n-# Makefile for perl support modules and routine\n-#\n-makfile:=perl.mak\n-modules =\n-\n-PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n-prefix_SQ = $(subst ','\\'',$(prefix))\n-localedir_SQ = $(subst ','\\'',$(localedir))\n-\n-ifndef V\n-\tQUIET = @\n-endif\n-\n-all install instlibdir: $(makfile)\n-\t$(QUIET)$(MAKE) -f $(makfile) $@\n-\n-clean:\n-\t$(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0\n-\t$(RM) ppport.h\n-\t$(RM) $(makfile)\n-\t$(RM) $(makfile).old\n-\t$(RM) PM.stamp\n-\n-$(makfile): PM.stamp\n-\n-ifdef NO_PERL_MAKEMAKER\n-instdir_SQ = $(subst ','\\'',$(prefix)/lib)\n-\n-modules += Git\n-modules += Git/I18N\n-modules += Git/IndexInfo\n-modules += Git/Packet\n-modules += Git/SVN\n-modules += Git/SVN/Memoize/YAML\n-modules += Git/SVN/Fetcher\n-modules += Git/SVN/Editor\n-modules += Git/SVN/GlobSpec\n-modules += Git/SVN/Log\n-modules += Git/SVN/Migration\n-modules += Git/SVN/Prompt\n-modules += Git/SVN/Ra\n-modules += Git/SVN/Utils\n-\n-$(makfile): ../GIT-CFLAGS Makefile\n-\techo all: private-Error.pm Git.pm Git/I18N.pm > $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) blib/lib/'$$i'.pm' >> $@; \\\n-\t\techo '\tmkdir -p blib/lib'$$subdir >> $@; \\\n-\t\techo '\tcp '$$i'.pm blib/lib/'$$i'.pm' >> $@; \\\n-\tdone\n-\techo '\t$(RM) blib/lib/Error.pm' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm blib/lib/Error.pm' >> $@\n-\techo install: >> $@\n-\tset -e; \\\n-\tfor i in $(modules); \\\n-\tdo \\\n-\t\tif test $$i = $${i%/*}; \\\n-\t\tthen \\\n-\t\t\tsubdir=; \\\n-\t\telse \\\n-\t\t\tsubdir=/$${i%/*}; \\\n-\t\tfi; \\\n-\t\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\t\techo '\tmkdir -p \"$$(DESTDIR)$(instdir_SQ)'$$subdir'\"' >> $@; \\\n-\t\techo '\tcp '$$i'.pm \"$$(DESTDIR)$(instdir_SQ)/'$$i'.pm\"' >> $@; \\\n-\tdone\n-\techo '\t$(RM) \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\t'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \\\n-\techo '\tcp private-Error.pm \"$$(DESTDIR)$(instdir_SQ)/Error.pm\"' >> $@\n-\techo instlibdir: >> $@\n-\techo '\techo $(instdir_SQ)' >> $@\n-else\n-$(makfile): Makefile.PL ../GIT-CFLAGS\n-\t$(PERL_PATH) $< PREFIX='$(prefix_SQ)' INSTALL_BASE='' --localedir='$(localedir_SQ)'\n-endif\n-\n-# this is just added comfort for calling make directly in perl dir\n-# (even though GIT-CFLAGS aren't used yet. If ever)\n-../GIT-CFLAGS:\n-\t$(MAKE) -C .. GIT-CFLAGS\ndiff --git a/perl/Makefile.PL b/perl/Makefile.PL\ndeleted file mode 100644\nindex 3f29ba98a6..0000000000\n--- a/perl/Makefile.PL\n+++ /dev/null\n@@ -1,62 +0,0 @@\n-use strict;\n-use warnings;\n-use ExtUtils::MakeMaker;\n-use Getopt::Long;\n-use File::Find;\n-\n-# Don't forget to update the perl/Makefile, too.\n-# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease\n-\n-# Sanity: die at first unknown option\n-Getopt::Long::Configure qw/ pass_through /;\n-\n-my $localedir = '';\n-GetOptions(\"localedir=s\" => \\$localedir);\n-\n-sub MY::postamble {\n-\treturn <<'MAKE_FRAG';\n-instlibdir:\n-\t@echo '$(INSTALLSITELIB)'\n-\n-ifneq (,$(DESTDIR))\n-ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))\n-$(error ExtUtils::MakeMaker version \"$(MM_VERSION)\" is older than 6.11 and so \\\n-\tis likely incompatible with the DESTDIR mechanism.  Try setting \\\n-\tNO_PERL_MAKEMAKER=1 instead)\n-endif\n-endif\n-\n-MAKE_FRAG\n-}\n-\n-# Find all the .pm files in \"Git/\" and Git.pm\n-my %pm;\n-find sub {\n-\treturn unless /\\.pm$/;\n-\n-\t# sometimes File::Find prepends a ./  Strip it.\n-\tmy $pm_path = $File::Find::name;\n-\t$pm_path =~ s{^\\./}{};\n-\n-\t$pm{$pm_path} = '$(INST_LIBDIR)/'.$pm_path;\n-}, \"Git\", \"Git.pm\";\n-\n-\n-# We come with our own bundled Error.pm. It's not in the set of default\n-# Perl modules so install it if it's not available on the system yet.\n-if ( !eval { require Error } || $Error::VERSION < 0.15009) {\n-\t$pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';\n-}\n-\n-# redirect stdout, otherwise the message \"Writing perl.mak for Git\"\n-# disrupts the output for the target 'instlibdir'\n-open STDOUT, \">&STDERR\";\n-\n-WriteMakefile(\n-\tNAME            => 'Git',\n-\tVERSION_FROM    => 'Git.pm',\n-\tPM\t\t=> \\%pm,\n-\tPM_FILTER\t=> qq[\\$(PERL) -pe \"s<\\\\Q++LOCALEDIR++\\\\E><$localedir>\"],\n-\tMAKEFILE\t=> 'perl.mak',\n-\tINSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'\n-);\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex e401208488..3096f4ec77 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -1,6 +1,6 @@\n #!/usr/bin/perl\n \n-use lib '../../perl/blib/lib';\n+use lib '../../perl/build/lib';\n use strict;\n use warnings;\n use Git;\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex e7065df2bb..a6f00ff712 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -919,7 +919,7 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/build/lib\n export GITPERLLIB\n test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\ndiff --git a/wrap-for-bin.sh b/wrap-for-bin.sh\nindex 22b6e4948f..5842408817 100644\n--- a/wrap-for-bin.sh\n+++ b/wrap-for-bin.sh\n@@ -14,7 +14,7 @@ else\n \tGIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'\n \texport GIT_TEMPLATE_DIR\n fi\n-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'\"${GITPERLLIB:+:$GITPERLLIB}\"\n GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'\n PATH='@@BUILD_DIR@@/bin-wrappers:'\"$PATH\"\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"335105","messageId":"20171220201703.GI3693@zaya.teonanacatl.net","threadId":"47345","inReplyTo":"20171220182419.16865-1-avarab@gmail.com","subject":"Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2017-12-20T20:17:04Z","receivedAt":"2017-12-20T20:17:22Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n> On Wed, Dec 20, 2017 at 6:41 PM, Todd Zullinger <tmz@pobox.com> wrote:\n>> /usr/share/perl5/vendor_perl/Git\n>> /usr/share/perl5/vendor_perl/Git.pm\n>> /usr/share/perl5/vendor_perl/Git/Error.pm\n>> [...]\n>> /usr/share/perl5/vendor_perl/build\n>> /usr/share/perl5/vendor_perl/build/lib\n>> /usr/share/perl5/vendor_perl/build/lib/Git\n>> /usr/share/perl5/vendor_perl/build/lib/Git.pm\n>> /usr/share/perl5/vendor_perl/build/lib/Git/Error.pm\n>> [...]\n>> Note that not all of the .pm files are matched, which I\n>> believe is due to the glob matches only going 4 levels deep\n>> under the perl dir.\n> \n> Ouch, that's a stupid mistake of mine. Didn't consider that changing\n> it from *.pm to *.pmc would of course impact that glob match.\n> \n> This fixes it, changes against v5:\n> \n>     @@ -224,7 +224,7 @@\n>       po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n>         $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n>       \n>     -+LIB_PERL := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n>     ++LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n>      +LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n>      +\n>      +ifndef NO_PERL\n> \n> I.e. let's keep calling it \"build\" for consistency with other stuff\n> and so \"ls\" will show it, but just alter the glob so we'll only match\n> modules like Git{,::*}. I don't think we'll ever add anything outside\n> that namespace, so this seems like the best solution.\n\nSounds good.  While it might not have been too bad to have a\nhidden dir for build artifacts, using the more explicit glob\npattern is much nicer.\n\nI'll use this locally and let you know if I notice any\nissues.  Thanks for working on this.\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nSome people never go crazy. What truly horrible lives they must\nlive.\n    -- Charles Bukowski\n\n"},{"id":"335119","messageId":"20171221072207.4hdshon4ytgboonx@pflmari","threadId":"47345","inReplyTo":"20171220182419.16865-1-avarab@gmail.com","subject":"Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Alex Riesen","fromEmail":"alexander.riesen@cetitec.com","sentAt":"2017-12-21T07:22:07Z","receivedAt":"2017-12-21T07:22:50Z","isPatch":true,"sender":{"key":"alexander.riesen@cetitec.com","avatar":"https://avatars.githubusercontent.com/u/24452597?v=4"},"body":"Ævar Arnfjörð Bjarmason, Wed, Dec 20, 2017 19:24:19 +0100:\n> diff --git a/INSTALL b/INSTALL\n> index ffb071e9f0..808e07b659 100644\n> --- a/INSTALL\n> +++ b/INSTALL\n> @@ -84,9 +84,24 @@ Issues of note:\n>  \n>  \tGIT_EXEC_PATH=`pwd`\n>  \tPATH=`pwd`:$PATH\n> -\tGITPERLLIB=`pwd`/perl/blib/lib\n> +\tGITPERLLIB=`pwd`/perl/build/lib\n>  \texport GIT_EXEC_PATH PATH GITPERLLIB\n\nSincerely sorry for off-topic, I just wonder why this section of INSTALL\nuses the backticks for command substitution. Is there a shell which does not\nsupport the alternative form $(...) but has all the rest of the used syntax?\n\n\n---\nDiese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.\nhttps://www.avast.com/antivirus\n\n"},{"id":"335147","messageId":"alpine.DEB.2.10.1712211126470.4980@alexmv-linux","threadId":"47345","inReplyTo":"20171130213105.GA8861@sigill.intra.peff.net","subject":"Re: [PATCH] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Alex Vandiver","fromEmail":"alexmv@dropbox.com","sentAt":"2017-12-21T19:29:46Z","receivedAt":"2017-12-21T19:30:06Z","isPatch":true,"sender":{"key":"alexmv@dropbox.com","avatar":null},"body":"On Thu, 30 Nov 2017, Jeff King wrote:\n> On Wed, Nov 29, 2017 at 07:54:30PM +0000, Ævar Arnfjörð Bjarmason wrote:\n> \n> > Replace the perl/Makefile.PL and the fallback perl/Makefile used under\n> > NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily\n> > inspired by how the i18n infrastructure's build process works[1].\n> \n> I'm very happy to see the recursive make invocation go away. The perl\n> makefile generation was one of the few places where parallel make could\n> racily get confused (though I haven't seen that for a while, so maybe it\n> was fixed alongside some of the other .stamp work you did).\n\nAs a datapoint, I've seen it fairly regularly with -j8 in 2.15.1\nbuilds from a clean tree that I've been doing recently.  I'm looking\nforward to not having to make the choice between \"maybe run it twice\"\nor \"compile slower\" -- this looks great!\n- Alex"},{"id":"335182","messageId":"xmqqefnmshsm.fsf@gitster.mtv.corp.google.com","threadId":"47345","inReplyTo":"20171220182419.16865-1-avarab@gmail.com","subject":"Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-22T19:07:21Z","receivedAt":"2017-12-22T19:07:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n\nThanks, but I thought the patch was already in 'next' for a week or\nmore and it's time to refine incrementally.\n\nHere is the difference as I see between what we already have and\nthis update, and a proposed summary.\n\n-- >8 --\nFrom: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\nSubject: perl: avoid *.pmc and fix Error.pm further\n\nThe previous round tried to use *.pmc files but it confused RPM\ndependency analysis on some distros.  Install them as plain\nvanilla *.pm files instead.\n\nAlso \"local @_\" construct did not properly work when goto &sub\nis used until recent versions of Perl.  Avoid it (and we do not\nneed to localize it here anyway).\n\n\n---\ndiff --git a/Makefile b/Makefile\nindex ba6607b7e7..5c73cd208a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2274,14 +2274,14 @@ endif\n po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n \n-PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n-PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))\n+LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n+LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n \n ifndef NO_PERL\n-all:: $(PMCFILES)\n+all:: $(LIB_PERL_GEN)\n endif\n \n-perl/build/lib/%.pmc: perl/%.pm\n+perl/build/lib/%.pm: perl/%.pm\n \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n \tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n \ndiff --git a/perl/Git/Error.pm b/perl/Git/Error.pm\nindex 5874672150..09bbc97390 100644\n--- a/perl/Git/Error.pm\n+++ b/perl/Git/Error.pm\n@@ -39,7 +39,7 @@ sub import {\n \trequire Error;\n     };\n \n-    local @_ = ($caller, @_);\n+    unshift @_, $caller;\n     goto &Error::import;\n }\n \n"},{"id":"335399","messageId":"87lghnrerd.fsf@evledraar.gmail.com","threadId":"47345","inReplyTo":"xmqqefnmshsm.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-12-27T22:24:06Z","receivedAt":"2017-12-27T22:24:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Fri, Dec 22 2017, Junio C. Hamano jotted:\n\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>> ---\n>\n> Thanks, but I thought the patch was already in 'next' for a week or\n> more and it's time to refine incrementally.\n>\n> Here is the difference as I see between what we already have and\n> this update, and a proposed summary.\n>\n> -- >8 --\n> From: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> Subject: perl: avoid *.pmc and fix Error.pm further\n>\n> The previous round tried to use *.pmc files but it confused RPM\n> dependency analysis on some distros.  Install them as plain\n> vanilla *.pm files instead.\n>\n> Also \"local @_\" construct did not properly work when goto &sub\n> is used until recent versions of Perl.  Avoid it (and we do not\n> need to localize it here anyway).\n\nWhen I read this back on the 22nd I missed that you were waiting on my\nfeedback on this. Just saw What's Cooking now. Yes, LGTM:\n\nAcked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n(if needed)\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n\n> ---\n> diff --git a/Makefile b/Makefile\n> index ba6607b7e7..5c73cd208a 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -2274,14 +2274,14 @@ endif\n>  po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n>  \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n>\n> -PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)\n> -PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))\n> +LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n> +LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n>\n>  ifndef NO_PERL\n> -all:: $(PMCFILES)\n> +all:: $(LIB_PERL_GEN)\n>  endif\n>\n> -perl/build/lib/%.pmc: perl/%.pm\n> +perl/build/lib/%.pm: perl/%.pm\n>  \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n>  \tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n>\n> diff --git a/perl/Git/Error.pm b/perl/Git/Error.pm\n> index 5874672150..09bbc97390 100644\n> --- a/perl/Git/Error.pm\n> +++ b/perl/Git/Error.pm\n> @@ -39,7 +39,7 @@ sub import {\n>  \trequire Error;\n>      };\n>\n> -    local @_ = ($caller, @_);\n> +    unshift @_, $caller;\n>      goto &Error::import;\n>  }\n>\n"},{"id":"335473","messageId":"xmqqwp16lmxv.fsf@gitster.mtv.corp.google.com","threadId":"47345","inReplyTo":"87lghnrerd.fsf@evledraar.gmail.com","subject":"Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-28T18:36:12Z","receivedAt":"2017-12-28T18:36:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n>> Here is the difference as I see between what we already have and\n>> this update, and a proposed summary.\n>> ...\n>\n> When I read this back on the 22nd I missed that you were waiting on my\n> feedback on this. Just saw What's Cooking now. Yes, LGTM:\n\nThanks!\n"},{"id":"335619","messageId":"20180102191720.GB131371@aiede.mtv.corp.google.com","threadId":"47345","inReplyTo":"20171220182419.16865-1-avarab@gmail.com","subject":"Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-01-02T19:17:20Z","receivedAt":"2018-01-02T19:17:31Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nÆvar Arnfjörð Bjarmason wrote:\n\n> +++ b/Makefile\n[...]\n> -PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n> -$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n> +PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n> +$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n>  \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n> -\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n>  \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n>  \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n>  \tsed -e '1{' \\\n>  \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n>  \t    -e '\th' \\\n> -\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n> +\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n\nThis appears to have broken a build with INSTLIBDIR set.\n\n $ head -2 /usr/local/git/current/libexec/git-core/git-add--interactive\n #!/usr/bin/perl\n use lib (split(/:/, $ENV{GITPERLLIB} || \":/Applications/Xcode.app/Contents/Developer/Library/Perl/5.@{[sub{use Config; $Config{api_version}}->()]}/darwin-thread-multi-2level\" || \"/usr/local/git/current/share/perl5\"));\n\n(forgive the hackiness there).\n\nIs there a reason we don't do\n\n\tINSTLIBDIR='$(perllibdir_SQ)' && \\\n\tINSTLIBDIR_EXTRA=... &&\n\tINSTLIBDIR=...\n\nand\n\n\tuse lib ... || \"'\"$$INSTLIBDIR\"'\"));=' \\\n\n?\n\nThanks,\nJonathan\n"},{"id":"335625","messageId":"20180102200140.GC131371@aiede.mtv.corp.google.com","threadId":"47345","inReplyTo":"20180102191720.GB131371@aiede.mtv.corp.google.com","subject":"[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)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-01-02T20:01:40Z","receivedAt":"2018-01-02T20:02:21Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Subject: perl: treat PERLLIB_EXTRA as an extra path again\n\nPERLLIB_EXTRA was introduced in v1.9-rc0~88^2 (2013-11-15) as a way\nfor packagers to add additional directories such as the location of\nSubversion's perl bindings to Git's perl path.  Since 20d2a30f\n(Makefile: replace perl/Makefile.PL with simple make rules,\n2012-12-10) setting that variable breaks perl-based commands instead:\n\n $ PATH=$HOME/opt/git/bin:$PATH\n $ make install prefix=$HOME/opt/git PERLLIB_EXTRA=anextralibdir\n[...]\n $ head -2 $HOME/opt/git/libexec/git-core/git-add--interactive\n #!/usr/bin/perl\n use lib (split(/:/, $ENV{GITPERLLIB} || \":helloiamanextrainstlibdir\" || \"/usr/local/google/home/jrn/opt/git/share/perl5\"));\n $ git add -p\n Empty compile time value given to use lib at /home/jrn/opt/git/libexec/git-core/git-add--interactive line 2.\n\nRemoving the spurious \":\" at the beginning of \":$PERLLIB_EXTRA\" avoids\nthe \"Empty compile time value\" error but with that tweak the problem\nstill remains: PERLLIB_EXTRA ends up replacing instead of\nsupplementing the perllibdir that would be passed to 'use lib' if\nPERLLIB_EXTRA were not set.\n\nThe intent was to simplify, as the commit message to 20d2a30f\nexplains:\n\n| The scripts themselves will 'use lib' the target directory, but if\n| INSTLIBDIR is set it overrides it. It doesn't have to be this way,\n| it could be set in addition to INSTLIBDIR, but my reading of\n| [v1.9-rc0~88^2] is that this is the desired behavior.\n\nRestore the previous code structure to make PERLLIB_EXTRA work again.\n\nReproducing this problem requires an invocation of \"make install\"\ninstead of running bin-wrappers/git in place, since the latter sets\nthe GITPERLLIB environment variable, avoiding trouble.\n\nReported-by: Jonathan Koren <jdkoren@google.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nJonathan Nieder wrote:\n> Hi,\n> \n> Ævar Arnfjörð Bjarmason wrote:\n> \n> > +++ b/Makefile\n> [...]\n> > -PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n> > -$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n> > +PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n> > +$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n> >  \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n> > -\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n> >  \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n> >  \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n> >  \tsed -e '1{' \\\n> >  \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n> >  \t    -e '\th' \\\n> > -\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n> > +\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n> \n> This appears to have broken a build with INSTLIBDIR set.\n\nHere it is in patch form.\n\n Makefile | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/Makefile b/Makefile\nindex 5c73cd208a..409e8f6ec9 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1951,12 +1951,13 @@ $(SCRIPT_PERL_GEN):\n PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n+\tINSTLIBDIR='$(perllibdir_SQ)' && \\\n \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\n-\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n+\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n \t    -e '\tH' \\\n \t    -e '\tx' \\\n \t    -e '}' \\\n-- \n2.16.0.rc0.224.g99853183ba\n\n"},{"id":"335628","messageId":"87lghgc7wf.fsf@evledraar.gmail.com","threadId":"47345","inReplyTo":"20180102200140.GC131371@aiede.mtv.corp.google.com","subject":"Re: [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)","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-01-02T20:39:28Z","receivedAt":"2018-01-02T20:39:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Jan 02 2018, Jonathan Nieder jotted:\n\n> Subject: perl: treat PERLLIB_EXTRA as an extra path again\n>\n> PERLLIB_EXTRA was introduced in v1.9-rc0~88^2 (2013-11-15) as a way\n> for packagers to add additional directories such as the location of\n> Subversion's perl bindings to Git's perl path.  Since 20d2a30f\n> (Makefile: replace perl/Makefile.PL with simple make rules,\n> 2012-12-10) setting that variable breaks perl-based commands instead:\n>\n>  $ PATH=$HOME/opt/git/bin:$PATH\n>  $ make install prefix=$HOME/opt/git PERLLIB_EXTRA=anextralibdir\n> [...]\n>  $ head -2 $HOME/opt/git/libexec/git-core/git-add--interactive\n>  #!/usr/bin/perl\n>  use lib (split(/:/, $ENV{GITPERLLIB} || \":helloiamanextrainstlibdir\" || \"/usr/local/google/home/jrn/opt/git/share/perl5\"));\n>  $ git add -p\n>  Empty compile time value given to use lib at /home/jrn/opt/git/libexec/git-core/git-add--interactive line 2.\n>\n> Removing the spurious \":\" at the beginning of \":$PERLLIB_EXTRA\" avoids\n> the \"Empty compile time value\" error but with that tweak the problem\n> still remains: PERLLIB_EXTRA ends up replacing instead of\n> supplementing the perllibdir that would be passed to 'use lib' if\n> PERLLIB_EXTRA were not set.\n>\n> The intent was to simplify, as the commit message to 20d2a30f\n> explains:\n>\n> | The scripts themselves will 'use lib' the target directory, but if\n> | INSTLIBDIR is set it overrides it. It doesn't have to be this way,\n> | it could be set in addition to INSTLIBDIR, but my reading of\n> | [v1.9-rc0~88^2] is that this is the desired behavior.\n>\n> Restore the previous code structure to make PERLLIB_EXTRA work again.\n>\n> Reproducing this problem requires an invocation of \"make install\"\n> instead of running bin-wrappers/git in place, since the latter sets\n> the GITPERLLIB environment variable, avoiding trouble.\n>\n> Reported-by: Jonathan Koren <jdkoren@google.com>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Jonathan Nieder wrote:\n>> Hi,\n>>\n>> Ævar Arnfjörð Bjarmason wrote:\n>>\n>> > +++ b/Makefile\n>> [...]\n>> > -PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)\n>> > -$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE\n>> > +PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n>> > +$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n>> >  \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n>> > -\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n>> >  \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n>> >  \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n>> >  \tsed -e '1{' \\\n>> >  \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n>> >  \t    -e '\th' \\\n>> > -\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n>> > +\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n>>\n>> This appears to have broken a build with INSTLIBDIR set.\n>\n> Here it is in patch form.\n>\n>  Makefile | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 5c73cd208a..409e8f6ec9 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1951,12 +1951,13 @@ $(SCRIPT_PERL_GEN):\n>  PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)\n>  $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE\n>  \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n> +\tINSTLIBDIR='$(perllibdir_SQ)' && \\\n>  \tINSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \\\n>  \tINSTLIBDIR=\"$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}\" && \\\n>  \tsed -e '1{' \\\n>  \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n>  \t    -e '\th' \\\n> -\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\" || \"'\"$(perllibdir_SQ)\"'\"));=' \\\n> +\t    -e '\ts=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || \"'\"$$INSTLIBDIR\"'\"));=' \\\n>  \t    -e '\tH' \\\n>  \t    -e '\tx' \\\n>  \t    -e '}' \\\n\nThis obviously makes perfect sense if the intent is to add this lib dir\ninstead of it being a replacement (as is clear from this being an issue\nyou're noting).\n\nWith the benefit of hindsight in re-reading the commit + this report I\ncan see that it *should* be that way, but I assumed it was the other way\naround when I wrote this up.\n\nThanks!\n"}]}