| 1 | package ExtUtils::CBuilder::Platform::android; | ||
| 2 | $ExtUtils::CBuilder::Platform::android::VERSION = '0.280224'; | ||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | use File::Spec; | ||
| 6 | use ExtUtils::CBuilder::Platform::Unix; | ||
| 7 | use Config; | ||
| 8 | |||
| 9 | use vars qw(@ISA); | ||
| 10 | @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. | ||
| 14 | sub 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 | |||
| 39 | 1; |