In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/191f8909fa4eca1db16a91ada42dd4a065c04890?hp=86c170d91dbbbcdb41664cd9419732ad10d6056b>

- Log -----------------------------------------------------------------
commit 191f8909fa4eca1db16a91ada42dd4a065c04890
Author: Tony Cook <t...@develop-help.com>
Date:   Thu Oct 4 14:41:03 2018 +1000

    (perl #127606) adjust dependency paths on installation on darwin
    
    SIP (System Integrity Protection) on OS X prevents the
    DYLD_LIBRARY_PATH environment variable from being propagated through
    /bin/sh, causes many tests to fail (and some more recent build issues)
    for -Duseshrplib builds.
    
    To avoid that, we change the way libperl.dylib is linked to perl, so
    for the initial build the library's id is at the build location rather
    than the install location, and the generated executable also expects
    to find libperl in that location.
    
    This obviously won't work once we copy both to the installation
    directory, so we adjust both the id of the library and the dependency
    path in the executable to point to the new location of the library.
    
    A previous attempt set -rpath and used @rpath in the id, but this made
    the embedding test fail.

-----------------------------------------------------------------------

Summary of changes:
 Makefile.SH | 34 ++++++++++++++++++++++++++++++++--
 installperl | 25 +++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/Makefile.SH b/Makefile.SH
index 6e4d5ee684..bebe50dc13 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -67,8 +67,16 @@ true)
                             -compatibility_version \
                                
${api_revision}.${api_version}.${api_subversion} \
                             -current_version \
-                               ${revision}.${patchlevel}.${subversion} \
-                            -install_name \$(shrpdir)/\$@"
+                               ${revision}.${patchlevel}.${subversion}"
+               case "$osvers" in
+               1[5-9]*|[2-9]*)
+                       shrpldflags="$shrpldflags -install_name `pwd`/\$@ 
-Xlinker -headerpad_max_install_names"
+                       exeldflags="-Xlinker -headerpad_max_install_names"
+                       ;;
+               *)
+                       shrpldflags="$shrpldflags -install_name \$(shrpdir)/\$@"
+                       ;;
+               esac
                ;;
        cygwin*)
                shrpldflags="$shrpldflags -Wl,--out-implib=libperl.dll.a 
-Wl,--image-base,0x52000000"
@@ -339,6 +347,14 @@ MANIFEST_SRT = MANIFEST.srt
 
 !GROK!THIS!
 
+case "$useshrplib$osname" in
+truedarwin)
+       $spitshell >>$Makefile <<!GROK!THIS!
+PERL_EXE_LDFLAGS=$exeldflags
+!GROK!THIS!
+       ;;
+esac
+
 case "$usecrosscompile$perl" in
 define?*)
        $spitshell >>$Makefile <<!GROK!THIS!
@@ -1050,6 +1066,20 @@ $(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) 
ext.libs $(PERLEXPORT)
        $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) 
$(LLIBPERL) $(static_ext) `cat ext.libs` $(libs)
 !NO!SUBS!
         ;;
+
+       darwin)
+           case "$useshrplib$osvers" in
+           true1[5-9]*|true[2-9]*) $spitshell >>$Makefile <<'!NO!SUBS!'
+       $(SHRPENV) $(CC) -o perl $(PERL_EXE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) 
$(perlmain_objs) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+!NO!SUBS!
+              ;;
+           *) $spitshell >>$Makefile <<'!NO!SUBS!'
+       $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) 
$(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+!NO!SUBS!
+              ;;
+           esac
+        ;;
+
         *) $spitshell >>$Makefile <<'!NO!SUBS!'
        $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) 
$(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 !NO!SUBS!
diff --git a/installperl b/installperl
index 3bf79d2d6f..6cd65a0923 100755
--- a/installperl
+++ b/installperl
@@ -304,6 +304,7 @@ elsif ($^O ne 'dos') {
        safe_unlink("$installbin/$perl_verbase$ver$exe_ext");
        copy("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext");
        strip("$installbin/$perl_verbase$ver$exe_ext");
+       fix_dep_names("$installbin/$perl_verbase$ver$exe_ext");
        chmod(0755, "$installbin/$perl_verbase$ver$exe_ext");
     }
     else {
@@ -388,6 +389,7 @@ foreach my $file (@corefiles) {
     if (copy_if_diff($file,"$installarchlib/CORE/$file")) {
        if ($file =~ /\.(\Q$so\E|\Q$dlext\E)$/) {
            strip("-S", "$installarchlib/CORE/$file") if $^O eq 'darwin';
+           fix_dep_names("$installarchlib/CORE/$file");
            chmod($SO_MODE, "$installarchlib/CORE/$file");
        } else {
            chmod($NON_SO_MODE, "$installarchlib/CORE/$file");
@@ -791,4 +793,27 @@ sub strip
     }
 }
 
+sub fix_dep_names {
+    my $file = shift;
+
+    $^O eq "darwin" && $Config{osvers} =~ /^(1[5-9]|[2-9])/
+      && $Config{useshrplib}
+      or return;
+
+    my @opts;
+    my $so = $Config{so};
+    my $libperl = "$Config{archlibexp}/CORE/libperl.$Config{so}";
+    if ($file =~ /\blibperl.\Q$Config{so}\E$/a) {
+        push @opts, -id => $libperl;
+    }
+    else {
+        push @opts, -change => getcwd . "/libperl.$so", $libperl;
+    }
+    push @opts, $file;
+
+    $opts{verbose} and print "  install_name_tool @opts\n";
+    system "install_name_tool", @opts
+      and die "Cannot update $file dependency paths\n";
+}
+
 # ex: set ts=8 sts=4 sw=4 et:

-- 
Perl5 Master Repository

Reply via email to