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