summaryrefslogtreecommitdiff
path: root/installperl
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2018-10-04 14:41:03 +1000
committerTony Cook <tony@develop-help.com>2018-11-02 10:46:03 +1100
commit191f8909fa4eca1db16a91ada42dd4a065c04890 (patch)
treef8d87942feda46c95ad7b005c4a00539082f9a5e /installperl
parent86c170d91dbbbcdb41664cd9419732ad10d6056b (diff)
downloadperl-191f8909fa4eca1db16a91ada42dd4a065c04890.tar.gz
(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.
Diffstat (limited to 'installperl')
-rwxr-xr-xinstallperl25
1 files changed, 25 insertions, 0 deletions
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: