summaryrefslogtreecommitdiff
blob: 41f26098b2bda9a095ae12e5ea8cd683cc0d9da7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
--- a/lib/ExtUtils/MM_Any.pm
+++ b/lib/ExtUtils/MM_Any.pm
@@ -1900,6 +1900,13 @@ CODE
             # LD_RUN_PATH now computed by ExtUtils::Liblist
             ($self->{EXTRALIBS},  $self->{BSLOADLIBS}, 
              $self->{LDLOADLIBS}, $self->{LD_RUN_PATH}) = @libs;
+            # We do not want the build root in RPATH
+            if ( exists $ENV{PORTAGE_TMPDIR} ){
+                # If we have a PORTAGE_TMPDIR set, strip that, as just testing for
+                # /usr and /opt might not be sufficient.
+                $self->{LD_RUN_PATH} = join ':', grep !/^\Q$ENV{PORTAGE_TMPDIR}/,
+                                       split /:/, $self->{LD_RUN_PATH};
+            }
             last;
         }
     }