xref: /openbmc/openbmc/poky/meta/recipes-devtools/perl/files/perl-dynloader.patch (revision 213cb2696d00a85cd48d356cb5131824a302d828)
1Upstream-Status:Inappropriate [embedded specific]
2
3Allow the location that .so files are searched for for dynamic
4loading to be changed via an environment variable. This is to allow
5us to load .so's from the host system while building for the target
6system.
7
8Update by Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/21
9
10Index: perl-5.24.1/dist/XSLoader/XSLoader_pm.PL
11===================================================================
12--- perl-5.24.1.orig/dist/XSLoader/XSLoader_pm.PL
13+++ perl-5.24.1/dist/XSLoader/XSLoader_pm.PL
14@@ -52,6 +52,24 @@ sub load {
15     my ($caller, $modlibname) = caller();
16     my $module = $caller;
17
18+    # OE: Allow env to form dynamic loader to look in a different place
19+    # This is so it finds the host .so files, not the targets
20+    if (defined $ENV{PERLHOSTLIB})
21+    {
22+        my $hostlib = $ENV{PERLHOSTLIB};
23+        my $hostarchlib = $ENV{PERLHOSTARCHLIB};
24+        print STDERR "*** Module name IN: $modlibname\n";
25+        ($p1, $p2, $p3, $p4, $p5, $p6, $p7) = $modlibname =~ m/(^(.*lib\w*\/)?)((perl5\/[0-9\.]*\/)?)(([^\/]*)\/)?(.*)$/;
26+        print STDERR "*** p1: $p1  p3: $p3  p5: $p5 p7: $p7\n";
27+        if ( $p1 ne "" ) {
28+            $modlibname = $hostlib.$p7;
29+        }
30+        if ( $p6 ne "" ) {
31+            $modlibname = $hostarchlib.$p7;
32+        }
33+        print STDERR "*** Module name OUT: $modlibname\n";
34+    }
35+
36     if (@_) {
37         $module = $_[0];
38     } else {
39