[Reproducible-commits] [libextutils-depends-perl] 139/187: Added Android support

Maria Valentina Marin Rodrigues akira-guest at moszumanska.debian.org
Wed Jan 21 21:16:57 UTC 2015


This is an automated email from the git hooks/post-receive script.

akira-guest pushed a commit to branch pu/reproducible_builds
in repository libextutils-depends-perl.

commit 48b6b8ede5bdf74db694a2003442231957ced421
Author: Brian Fraser <fraserbn at gmail.com>
Date:   Fri Jul 25 17:28:55 2014 +0200

    Added Android support
---
 lib/ExtUtils/Depends.pm | 16 +++++++++++++++-
 t/04_extra_libs.t       |  9 +++++++--
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/lib/ExtUtils/Depends.pm b/lib/ExtUtils/Depends.pm
index 8b7f448..ea13db3 100644
--- a/lib/ExtUtils/Depends.pm
+++ b/lib/ExtUtils/Depends.pm
@@ -7,6 +7,7 @@ package ExtUtils::Depends;
 use strict;
 use warnings;
 use Carp;
+use Config;
 use File::Find;
 use File::Spec;
 use Data::Dumper;
@@ -301,7 +302,7 @@ sub build_dll_lib {
 	my ($self, $vars) = @_;
 	$vars->{macro} ||= {};
 	$vars->{macro}{'INST_DYNAMIC_LIB'} =
-		'$(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)';
+		'$(INST_ARCHAUTODIR)/$(DLBASE)$(LIB_EXT)';
 }
 
 # Search for extra library files to link against on Windows (either native
@@ -313,6 +314,7 @@ sub find_extra_libs {
 	my %mappers = (
 		MSWin32 => sub { $_[0] . '\.(?:lib|a)' },
 		cygwin	=> sub { $_[0] . '\.dll'},
+		android => sub { $_[0] . '\.' . $Config{dlext} },
 	);
 	my $mapper = $mappers{$^O};
 	return () unless defined $mapper;
@@ -338,6 +340,18 @@ sub find_extra_libs {
 
 		if ($matching_file && -f $matching_file) {
 			push @found_libs, ('-L' . $matching_dir, '-l' . $stem);
+			# Android's linker ignores the RTLD_GLOBAL flag
+			# and loads everything as if under RTLD_LOCAL.
+			# What this means in practice is that modules need
+			# to explicitly link to their dependencies,
+			# because otherwise they won't be able to locate any
+			# functions they define.
+			# We use the -l:foo.so flag to indicate that the
+			# actual library name to look for is foo.so, not
+			# libfoo.so
+			if ( $^O eq 'android' ) {
+				$found_libs[-1] = "-l:$stem.$Config{dlext}";
+			}
 			next;
 		}
 	}
diff --git a/t/04_extra_libs.t b/t/04_extra_libs.t
index dbf70f4..9f303ea 100644
--- a/t/04_extra_libs.t
+++ b/t/04_extra_libs.t
@@ -12,7 +12,7 @@ use ExtUtils::Depends;
 
 my $tmp_inc = temp_inc;
 
-plan (($^O eq 'MSWin32' || $^O eq 'cygwin') ?
+plan (($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'android') ?
         (tests => 1) :
         (skip_all => 'test only applicable to MSWin32 and cygwin'));
 
@@ -24,6 +24,11 @@ $dep_info->save_config (catfile $tmp_inc, qw(DepTest Install Files.pm));
 my $use_info = ExtUtils::Depends->new ('UseTest', 'DepTest');
 my %vars = $use_info->get_makefile_vars;
 
-like ($vars{LIBS}, qr/DepTest/);
+my $libname = 'DepTest';
+
+require DynaLoader;
+$libname = DynaLoader::mod2fname([$libname]) if defined &DynaLoader::mod2fname;
+
+like ($vars{LIBS}, qr/$libname/);
 
 # --------------------------------------------------------------------------- #

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/libextutils-depends-perl.git



More information about the Reproducible-commits mailing list