1From 25a26c52c320e699b37a7ad1f4f045bc8aa4cb00 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard@openedhand.com>
3Date: Sun, 27 May 2007 21:04:11 +0000
4Subject: [PATCH] perl: 5.8.7 -> 5.8.8 (from OE)
5
6Upstream-Status: Inappropriate [embedded specific]
7
8Allow the location that .so files are searched for for dynamic
9loading to be changed via an environment variable. This is to allow
10us to load .so's from the host system while building for the target
11system.
12
13Update by Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/21
14---
15 dist/XSLoader/XSLoader_pm.PL | 18 ++++++++++++++++++
16 1 file changed, 18 insertions(+)
17
18diff --git a/dist/XSLoader/XSLoader_pm.PL b/dist/XSLoader/XSLoader_pm.PL
19index ff5ca31..0d50803 100644
20--- a/dist/XSLoader/XSLoader_pm.PL
21+++ b/dist/XSLoader/XSLoader_pm.PL
22@@ -32,6 +32,24 @@ sub load {
23     my ($caller, $modlibname) = caller();
24     my $module = $caller;
25
26+    # OE: Allow env to form dynamic loader to look in a different place
27+    # This is so it finds the host .so files, not the targets
28+    if (defined $ENV{PERLHOSTLIB})
29+    {
30+        my $hostlib = $ENV{PERLHOSTLIB};
31+        my $hostarchlib = $ENV{PERLHOSTARCHLIB};
32+        print STDERR "*** Module name IN: $modlibname\n";
33+        my ($p1, $p2, $p3, $p4, $p5, $p6, $p7) = $modlibname =~ m/(^(.*lib\w*\/)?)((perl5\/[0-9\.]*\/)?)(([^\/]*)\/)?(.*)$/;
34+        print STDERR "*** p1: $p1  p3: $p3  p5: $p5 p7: $p7\n";
35+        if ( $p1 ne "" ) {
36+            $modlibname = $hostlib.$p7;
37+        }
38+        if ( $p6 ne "" ) {
39+            $modlibname = $hostarchlib.$p7;
40+        }
41+        print STDERR "*** Module name OUT: $modlibname\n";
42+    }
43+
44     if (@_) {
45         $module = $_[0];
46     } else {
47