[PATCH (Apple Git) 10/13] Support for Xcode.app co-exestince and relocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch has been trimmed down significantly from its original version
when rebasing on top of git 2.18 because git 2.18 included support for
runtime prefix support for darwin, making this patch mostly duplicative.

The remaining changes are needed to ensure that git-perl can find the
subversion perl module (which relocates with it) and handle relocation
of python scripts.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@xxxxxxxxx>
---
 Makefile                                      |  3 +++
 .../runtime_prefix.template.pl                | 25 +++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/Makefile b/Makefile
index 60711d6abe..97f46444f5 100644
--- a/Makefile
+++ b/Makefile
@@ -2171,6 +2171,7 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
 	sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
 	    -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
 	    -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
+	    -e 's=@@PERLVERSION@@=$(shell grep DEFAULT /usr/local/versioner/perl/versions | sed 's:^.*= *\([^ ]*\)$$:\1:')=g' \
 	    -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
 	    -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
 	    $< >$@+ && \
@@ -2206,6 +2207,8 @@ $(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
 $(SCRIPT_PYTHON_GEN): % : %.py
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
+	    -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \
+	    -e 's|"@@INSTLIBDIR@@"|os.path.realpath(os.path.dirname(sys.argv[0])) + "/../../share/git-core/python"|g' \
 	    $< >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d863..b0b6b0bef1 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -1,3 +1,28 @@
+# BEGIN XCODE RUNTIME_PREFIX generated code
+BEGIN {
+    use File::Spec;
+    my $PERLVERSION = "@@PERLVERSION@@";
+    if ($^V =~ m/v([0-9]+).([0-9]+)/) {
+        $PERLVERSION = $1.".".$2;
+    }
+    my $__prefix = File::Spec->rel2abs( __FILE__ );
+
+    if ($__prefix =~ m/\/libexec\/git-core\// ) {
+        $__prefix =~ s/\/libexec\/git-core\/.*//;
+        unshift @INC, $__prefix . "/share/git-core/perl";
+        unshift @INC, $__prefix . "/../Library/Perl/".$PERLVERSION."/darwin-thread-multi-2level";
+    } elsif ($__prefix =~ m/\/bin\// ) {
+        $__prefix =~ s/\/bin\/.*//;
+        unshift @INC, $__prefix . "/share/git-core/perl";
+        unshift @INC, $__prefix . "/../Library/Perl/".$PERLVERSION."/darwin-thread-multi-2level";
+    } elsif ( $__prefix =~ m/\/usr\// ) {
+        $__prefix =~ s/\/usr\/.*/\/usr/;
+        unshift @INC, $__prefix . "/share/git-core/perl";
+        unshift @INC, $__prefix . "/../Library/Perl/".$PERLVERSION."/darwin-thread-multi-2level";
+    }
+}
+# END XCODE RUNTIME_PREFIX generated code.
+
 # BEGIN RUNTIME_PREFIX generated code.
 #
 # This finds our Git::* libraries relative to the script's runtime path.
-- 
2.20.0 (Apple Git-115)




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux