530b04
From f55b546a261651ad76a2a339768a599a4d84b4f5 Mon Sep 17 00:00:00 2001
530b04
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
530b04
Date: Wed, 3 Jul 2013 11:01:02 +0200
530b04
Subject: [PATCH] Link XS modules to libperl.so with EU::CBuilder on Linux
530b04
MIME-Version: 1.0
530b04
Content-Type: text/plain; charset=UTF-8
530b04
Content-Transfer-Encoding: 8bit
530b04
530b04
<https://bugzilla.redhat.com/show_bug.cgi?id=960048>
530b04
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=327585#50>
530b04
530b04
Signed-off-by: Petr Písař <ppisar@redhat.com>
530b04
---
530b04
 MANIFEST                                |  1 +
530b04
 lib/ExtUtils/CBuilder/Platform/linux.pm | 25 +++++++++++++++++++++++++
530b04
 2 files changed, 26 insertions(+)
530b04
 create mode 100644 lib/ExtUtils/CBuilder/Platform/linux.pm
530b04
530b04
diff --git a/MANIFEST b/MANIFEST
530b04
index fdc8bd9..a7de63a 100644
530b04
--- a/MANIFEST
530b04
+++ b/MANIFEST
530b04
@@ -25,6 +25,7 @@ lib/ExtUtils/CBuilder/Platform/android.pm
530b04
 lib/ExtUtils/CBuilder/Platform/cygwin.pm
530b04
 lib/ExtUtils/CBuilder/Platform/darwin.pm
530b04
 lib/ExtUtils/CBuilder/Platform/dec_osf.pm
530b04
+lib/ExtUtils/CBuilder/Platform/linux.pm
530b04
 lib/ExtUtils/CBuilder/Platform/os2.pm
530b04
 t/00-have-compiler.t
530b04
 t/01-basic.t
530b04
diff --git a/lib/ExtUtils/CBuilder/Platform/linux.pm b/lib/ExtUtils/CBuilder/Platform/linux.pm
530b04
new file mode 100644
530b04
index 0000000..823f852
530b04
--- /dev/null
530b04
+++ b/lib/ExtUtils/CBuilder/Platform/linux.pm
530b04
@@ -0,0 +1,25 @@
530b04
+package ExtUtils::CBuilder::Platform::linux;
530b04
+
530b04
+use strict;
530b04
+use ExtUtils::CBuilder::Platform::Unix;
530b04
+use File::Spec;
530b04
+
530b04
+our $VERSION = '0.280230';
530b04
+our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
530b04
+
530b04
+sub link {
530b04
+  my ($self, %args) = @_;
530b04
+  my $cf = $self->{config};
530b04
+
530b04
+  # Link XS modules to libperl.so explicitly because multiple
530b04
+  # dlopen(, RTLD_LOCAL) hides libperl symbols from XS module.
530b04
+  local $cf->{lddlflags} = $cf->{lddlflags};
530b04
+  if ($ENV{PERL_CORE}) {
530b04
+    $cf->{lddlflags} .= ' -L' . $self->perl_inc();
530b04
+  }
530b04
+  $cf->{lddlflags} .= ' -lperl';
530b04
+
530b04
+  return $self->SUPER::link(%args);
530b04
+}
530b04
+
530b04
+1;
530b04
-- 
530b04
2.13.6
530b04