1package ExtUtils::CBuilder::Platform::android;
2
3use warnings;
4use strict;
5use File::Spec;
6use ExtUtils::CBuilder::Platform::Unix;
7use Config;
8
9our $VERSION = '0.280238'; # VERSION
10our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
11
12# The Android linker will not recognize symbols from
13# libperl unless the module explicitly depends on it.
14sub link {
15  my ($self, %args) = @_;
16
17  if ($self->{config}{useshrplib} eq 'true') {
18    $args{extra_linker_flags} = [
19      $self->split_like_shell($args{extra_linker_flags}),
20      '-L' . $self->perl_inc(),
21      '-lperl',
22      $self->split_like_shell($Config{perllibs}),
23    ];
24  }
25
26  # Several modules on CPAN rather rightfully expect being
27  # able to pass $so_file to DynaLoader::dl_load_file and
28  # have it Just Work.  However, $so_file will more likely
29  # than not be a relative path, and unless the module
30  # author subclasses MakeMaker/Module::Build to modify
31  # LD_LIBRARY_PATH, which would be insane, Android's linker
32  # won't find the .so
33  # So we make this all work by returning an absolute path.
34  my($so_file, @so_tmps) = $self->SUPER::link(%args);
35  $so_file = File::Spec->rel2abs($so_file);
36  return wantarray ? ($so_file, @so_tmps) : $so_file;
37}
38
391;
40