]> granicus.if.org Git - git/commitdiff
Merge branch 'dj/runtime-prefix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 8 May 2018 06:59:17 +0000 (15:59 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 May 2018 06:59:17 +0000 (15:59 +0900)
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

1  2 
.gitignore
Makefile
cache.h
common-main.c
exec-cmd.c
exec-cmd.h
gettext.c
git.c

diff --cc .gitignore
Simple merge
diff --cc Makefile
index b345d0eaa956e9a28be7c852e1988cc9e81b65bb,2ba24035f55d8cc5b10aaf44bddbf4c3d86bf089..46a215dc89f61ccb24ade982315251c3ed2de16a
+++ 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
  $(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 cache.h
Simple merge
diff --cc common-main.c
Simple merge
diff --cc exec-cmd.c
index 8a8261746afc66441408e1a4ea3b6f98dba5f884,6e114f8b3a15450ef82070b6aae20402a470f0d8..3b0a039083a8d377325983272e4aa38ee1b5674c
@@@ -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 <mach-o/dyld.h>
+ #endif
+ #if defined(HAVE_BSD_KERN_PROC_SYSCTL)
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #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 exec-cmd.h
Simple merge
diff --cc gettext.c
index db727ea0204aa13acea0f189ea03e59b5cdb918f,6b64d5c2e8a5cc2a194ba1486de05437dd8051c6..baba28343c311594e048d62e190ded09e49ed5b0
+++ 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"
diff --cc git.c
Simple merge