From: Junio C Hamano Date: Tue, 8 May 2018 06:59:17 +0000 (+0900) Subject: Merge branch 'dj/runtime-prefix' X-Git-Tag: v2.18.0-rc0~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92034a9cd5e71cf686ef66029433bdaba75027b0;p=thirdparty%2Fgit.git Merge branch 'dj/runtime-prefix' A build-time option has been added to allow Git to be told to refer to its associated files relative to the main binary, in the same way that has been possible on Windows for quite some time, for Linux, BSDs and Darwin. * dj/runtime-prefix: Makefile: quote $INSTLIBDIR when passing it to sed Makefile: remove unused @@PERLLIBDIR@@ substitution variable mingw/msvc: use the new-style RUNTIME_PREFIX helper exec_cmd: provide a new-style RUNTIME_PREFIX helper for Windows exec_cmd: RUNTIME_PREFIX on some POSIX systems Makefile: add Perl runtime prefix support Makefile: generate Perl header from template file --- 92034a9cd5e71cf686ef66029433bdaba75027b0 diff --cc Makefile index b345d0eaa9,2ba24035f5..46a215dc89 --- a/Makefile +++ b/Makefile @@@ -2021,10 -2102,19 +2109,23 @@@ GIT-PERL-DEFINES: FORC echo "$$FLAGS" >$@; \ 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_REL@@=$(perllibdir_relative_SQ)=g' \ + -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \ + -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \ + $< >$@+ && \ + mv $@+ $@ + +.PHONY: perllibdir +perllibdir: + @echo '$(perllibdir_SQ)' + .PHONY: gitweb gitweb: $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all @@@ -2165,9 -2255,10 +2266,10 @@@ els $(OBJECTS): $(LIB_H) endif -exec_cmd.sp exec_cmd.s exec_cmd.o: GIT-PREFIX -exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \ +exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX +exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \ '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \ + '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \ '-DBINDIR="$(bindir_relative_SQ)"' \ '-DPREFIX="$(prefix_SQ)"' diff --cc exec-cmd.c index 8a8261746a,6e114f8b3a..3b0a039083 --- a/exec-cmd.c +++ b/exec-cmd.c @@@ -1,13 -1,41 +1,41 @@@ #include "cache.h" -#include "exec_cmd.h" +#include "exec-cmd.h" #include "quote.h" #include "argv-array.h" - #define MAX_ARGS 32 - static const char *argv_exec_path; + #if defined(RUNTIME_PREFIX) + + #if defined(HAVE_NS_GET_EXECUTABLE_PATH) + #include + #endif + + #if defined(HAVE_BSD_KERN_PROC_SYSCTL) + #include + #include + #include + #endif + + #endif /* RUNTIME_PREFIX */ + + #define MAX_ARGS 32 + + static const char *system_prefix(void); #ifdef RUNTIME_PREFIX - static const char *argv0_path; + + /** + * When using a runtime prefix, Git dynamically resolves paths relative to its + * executable. + * + * The method for determining the path of the executable is highly + * platform-specific. + */ + + /** + * Path to the current Git executable. Resolved on startup by + * 'git_resolve_executable_dir'. + */ + static const char *executable_dirname; static const char *system_prefix(void) { diff --cc gettext.c index db727ea020,6b64d5c2e8..baba28343c --- a/gettext.c +++ b/gettext.c @@@ -2,7 -2,8 +2,8 @@@ * Copyright (c) 2010 Ævar Arnfjörð Bjarmason */ - #include "git-compat-util.h" + #include "cache.h" -#include "exec_cmd.h" ++#include "exec-cmd.h" #include "gettext.h" #include "strbuf.h" #include "utf8.h"