зеркало из https://github.com/microsoft/git.git
Makefile: generate Perl header from template file
Currently, the generated Perl script headers are emitted by commands in the Makefile. This mechanism restricts options to introduce alternative header content, needed by Perl runtime prefix support, and obscures the origin of the Perl script header. Change the Makefile to generate a header by processing a template file and move the header content into the "perl/" subdirectory. The generated header content will now be stored in the "GIT-PERL-HEADER" file. This allows the content of the Perl header to be controlled by changing the path of the template in the Makefile. Signed-off-by: Dan Jacques <dnj@google.com> Thanks-to: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Thanks-to: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
8b026edac3
Коммит
f6a0ad4be7
|
@ -3,6 +3,7 @@
|
||||||
/GIT-LDFLAGS
|
/GIT-LDFLAGS
|
||||||
/GIT-PREFIX
|
/GIT-PREFIX
|
||||||
/GIT-PERL-DEFINES
|
/GIT-PERL-DEFINES
|
||||||
|
/GIT-PERL-HEADER
|
||||||
/GIT-PYTHON-VARS
|
/GIT-PYTHON-VARS
|
||||||
/GIT-SCRIPT-DEFINES
|
/GIT-SCRIPT-DEFINES
|
||||||
/GIT-USER-AGENT
|
/GIT-USER-AGENT
|
||||||
|
|
27
Makefile
27
Makefile
|
@ -1987,20 +1987,15 @@ git.res: git.rc GIT-VERSION-FILE
|
||||||
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
|
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
|
||||||
|
|
||||||
ifndef NO_PERL
|
ifndef NO_PERL
|
||||||
$(SCRIPT_PERL_GEN):
|
PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
|
||||||
|
|
||||||
PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
|
PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
|
||||||
$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE
|
|
||||||
|
$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
|
||||||
$(QUIET_GEN)$(RM) $@ $@+ && \
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
||||||
INSTLIBDIR='$(perllibdir_SQ)' && \
|
|
||||||
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
|
|
||||||
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
|
|
||||||
sed -e '1{' \
|
sed -e '1{' \
|
||||||
-e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
|
-e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
|
||||||
-e ' h' \
|
-e ' rGIT-PERL-HEADER' \
|
||||||
-e ' s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
|
-e ' G' \
|
||||||
-e ' H' \
|
|
||||||
-e ' x' \
|
|
||||||
-e '}' \
|
-e '}' \
|
||||||
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
|
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
|
||||||
$< >$@+ && \
|
$< >$@+ && \
|
||||||
|
@ -2014,6 +2009,16 @@ GIT-PERL-DEFINES: FORCE
|
||||||
echo "$$FLAGS" >$@; \
|
echo "$$FLAGS" >$@; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
|
||||||
|
$(QUIET_GEN)$(RM) $@ && \
|
||||||
|
INSTLIBDIR='$(perllibdir_SQ)' && \
|
||||||
|
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
|
||||||
|
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
|
||||||
|
sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
|
||||||
|
-e 's=@@INSTLIBDIR@@='$$INSTLIBDIR'=g' \
|
||||||
|
-e 's=@@PERLLIBDIR@@='$(perllibdir_SQ)'=g' \
|
||||||
|
$< >$@+ && \
|
||||||
|
mv $@+ $@
|
||||||
|
|
||||||
.PHONY: gitweb
|
.PHONY: gitweb
|
||||||
gitweb:
|
gitweb:
|
||||||
|
@ -2793,7 +2798,7 @@ ifndef NO_TCLTK
|
||||||
endif
|
endif
|
||||||
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
|
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
|
||||||
$(RM) GIT-USER-AGENT GIT-PREFIX
|
$(RM) GIT-USER-AGENT GIT-PREFIX
|
||||||
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PYTHON-VARS
|
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
|
||||||
|
|
||||||
.PHONY: all install profile-clean clean strip
|
.PHONY: all install profile-clean clean strip
|
||||||
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
|
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
|
Загрузка…
Ссылка в новой задаче