Blame SOURCES/ExtUtils-MakeMaker-7.30-USE_MM_LD_RUN_PATH.patch

4da5a0
From 83b4921f10f9df96ec359e20489864080f7b37ca Mon Sep 17 00:00:00 2001
4da5a0
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
4da5a0
Date: Thu, 12 Jan 2012 17:05:19 +0100
4da5a0
Subject: [PATCH] Do not set RPATH by default
4da5a0
MIME-Version: 1.0
4da5a0
Content-Type: text/plain; charset=UTF-8
4da5a0
Content-Transfer-Encoding: 8bit
4da5a0
4da5a0
Former behavior can be forced by setting USE_MM_LD_RUN_PATH
4da5a0
environment variable to 1.
4da5a0
4da5a0
This is copy from `perl' package.
4da5a0
See <https://bugzilla.redhat.com/show_bug.cgi?id=773622>.
4da5a0
4da5a0
Signed-off-by: Petr Písař <ppisar@redhat.com>
4da5a0
---
4da5a0
 lib/ExtUtils/Liblist.pm   |  5 +++++
4da5a0
 lib/ExtUtils/MM_Unix.pm   |  2 +-
4da5a0
 lib/ExtUtils/MakeMaker.pm | 56 ++++++++++++++++++++++++++++++++++++++++++++++-
4da5a0
 3 files changed, 61 insertions(+), 2 deletions(-)
4da5a0
4da5a0
diff --git a/lib/ExtUtils/Liblist.pm b/lib/ExtUtils/Liblist.pm
4da5a0
index 15eed3c..219e96b 100644
4da5a0
--- a/lib/ExtUtils/Liblist.pm
4da5a0
+++ b/lib/ExtUtils/Liblist.pm
4da5a0
@@ -89,6 +89,11 @@ libraries.  LD_RUN_PATH is a colon separated list of the directories
4da5a0
 in LDLOADLIBS. It is passed as an environment variable to the process
4da5a0
 that links the shared library.
4da5a0
 
4da5a0
+Fedora extension: This generation of LD_RUN_PATH is disabled by default.
4da5a0
+To use the generated LD_RUN_PATH for all links, set the USE_MM_LD_RUN_PATH
4da5a0
+MakeMaker object attribute / argument, (or set the $USE_MM_LD_RUN_PATH
4da5a0
+environment variable).
4da5a0
+
4da5a0
 =head2 BSLOADLIBS
4da5a0
 
4da5a0
 List of those libraries that are needed but can be linked in
4da5a0
diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm
4da5a0
index 6233513..198f05e 100644
4da5a0
--- a/lib/ExtUtils/MM_Unix.pm
4da5a0
+++ b/lib/ExtUtils/MM_Unix.pm
4da5a0
@@ -1045,7 +1045,7 @@ sub xs_make_dynamic_lib {
4da5a0
     }
4da5a0
 
4da5a0
     my $ld_run_path_shell = "";
4da5a0
-    if ($self->{LD_RUN_PATH} ne "") {
4da5a0
+    if (($self->{LD_RUN_PATH} ne "") && ($self->{USE_MM_LD_RUN_PATH})) {
4da5a0
         $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" ';
4da5a0
     }
4da5a0
 
4da5a0
diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm
4da5a0
index 3d4913e..b52c96d 100644
4da5a0
--- a/lib/ExtUtils/MakeMaker.pm
4da5a0
+++ b/lib/ExtUtils/MakeMaker.pm
4da5a0
@@ -317,7 +317,7 @@ sub full_setup {
4da5a0
     PERM_DIR PERM_RW PERM_RWX MAGICXS
4da5a0
     PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE
4da5a0
     PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
4da5a0
-    SIGN SKIP TEST_REQUIRES TYPEMAPS UNINST VERSION VERSION_FROM XS
4da5a0
+    SIGN SKIP TEST_REQUIRES TYPEMAPS UNINST USE_MM_LD_RUN_PATH VERSION VERSION_FROM XS
4da5a0
     XSBUILD XSMULTI XSOPT XSPROTOARG XS_VERSION
4da5a0
     clean depend dist dynamic_lib linkext macro realclean tool_autosplit
4da5a0
 
4da5a0
@@ -503,6 +503,26 @@ sub new {
4da5a0
         $self->_PRINT_PREREQ;
4da5a0
    }
4da5a0
 
4da5a0
+    # USE_MM_LD_RUN_PATH - another RedHatism to disable automatic RPATH generation
4da5a0
+    if ( ( ! $self->{USE_MM_LD_RUN_PATH} )
4da5a0
+       &&( ("@ARGV" =~ /\bUSE_MM_LD_RUN_PATH(=([01]))?\b/)
4da5a0
+        ||( exists( $ENV{USE_MM_LD_RUN_PATH} )
4da5a0
+           &&( $ENV{USE_MM_LD_RUN_PATH} =~ /([01])?$/ )
4da5a0
+           )
4da5a0
+        )
4da5a0
+       )
4da5a0
+    {
4da5a0
+       my $v = $1;
4da5a0
+       if( $v )
4da5a0
+       {
4da5a0
+           $v = ($v=~/=([01])$/)[0];
4da5a0
+       }else
4da5a0
+       {
4da5a0
+           $v = 1;
4da5a0
+       };
4da5a0
+       $self->{USE_MM_LD_RUN_PATH}=$v;
4da5a0
+    };
4da5a0
+
4da5a0
     print "MakeMaker (v$VERSION)\n" if $Verbose;
4da5a0
     if (-f "MANIFEST" && ! -f "Makefile" && ! $UNDER_CORE){
4da5a0
         check_manifest();
4da5a0
@@ -2797,6 +2817,40 @@ precedence.  A typemap in the current directory has highest
4da5a0
 precedence, even if it isn't listed in TYPEMAPS.  The default system
4da5a0
 typemap has lowest precedence.
4da5a0
 
4da5a0
+=item USE_MM_LD_RUN_PATH
4da5a0
+
4da5a0
+boolean
4da5a0
+The Fedora perl MakeMaker distribution differs from the standard
4da5a0
+upstream release in that it disables use of the MakeMaker generated
4da5a0
+LD_RUN_PATH by default, UNLESS this attribute is specified , or the
4da5a0
+USE_MM_LD_RUN_PATH environment variable is set during the MakeMaker run.
4da5a0
+
4da5a0
+The upstream MakeMaker will set the ld(1) environment variable LD_RUN_PATH
4da5a0
+to the concatenation of every -L ld(1) option directory in which a -l ld(1)
4da5a0
+option library is found, which is used as the ld(1) -rpath option if none
4da5a0
+is specified. This means that, if your application builds shared libraries
4da5a0
+and your MakeMaker application links to them, that the absolute paths of the
4da5a0
+libraries in the build tree will be inserted into the RPATH header of all
4da5a0
+MakeMaker generated binaries, and that such binaries will be unable to link
4da5a0
+to these libraries if they do not still reside in the build tree directories
4da5a0
+(unlikely) or in the system library directories (/lib or /usr/lib), regardless
4da5a0
+of any LD_LIBRARY_PATH setting. So if you specified -L../mylib -lmylib , and
4da5a0
+ your 'libmylib.so' gets installed into /some_directory_other_than_usr_lib,
4da5a0
+ your MakeMaker application will be unable to link to it, even if LD_LIBRARY_PATH
4da5a0
+is set to include /some_directory_other_than_usr_lib, because RPATH overrides
4da5a0
+LD_LIBRARY_PATH.
4da5a0
+
4da5a0
+So for Fedora MakeMaker builds LD_RUN_PATH is NOT generated by default for
4da5a0
+every link. You can still use explicit -rpath ld options or the LD_RUN_PATH
4da5a0
+environment variable during the build to generate an RPATH for the binaries.
4da5a0
+
4da5a0
+You can set the USE_MM_LD_RUN_PATH attribute to 1 on the MakeMaker command
4da5a0
+line or in the WriteMakefile arguments to enable generation of LD_RUN_PATH
4da5a0
+for every link command.
4da5a0
+
4da5a0
+USE_MM_LD_RUN_PATH will default to 1 (LD_RUN_PATH will be used) IF the
4da5a0
+$USE_MM_LD_RUN_PATH environment variable is set during a MakeMaker run.
4da5a0
+
4da5a0
 =item VENDORPREFIX
4da5a0
 
4da5a0
 Like PERLPREFIX, but only for the vendor install locations.
4da5a0
-- 
4da5a0
2.13.6
4da5a0