ExtUtils::CBuilder: Android with useshrplib needs -lperl
authorPiotr Roszatycki <piotr.roszatycki@gmail.com>
Wed, 15 Jan 2014 22:34:57 +0000 (23:34 +0100)
committerBrian Fraser <fraserbn@gmail.com>
Sun, 26 Jan 2014 17:44:25 +0000 (14:44 -0300)
dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm [new file with mode: 0644]

diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm
new file mode 100644 (file)
index 0000000..5e3e29b
--- /dev/null
@@ -0,0 +1,27 @@
+package ExtUtils::CBuilder::Platform::android;
+
+use strict;
+use File::Spec;
+use ExtUtils::CBuilder::Platform::Unix;
+
+use vars qw($VERSION @ISA);
+$VERSION = '0.280212';
+@ISA = qw(ExtUtils::CBuilder::Platform::Unix);
+
+# The Android linker will not recognize symbols from
+# libperl unless the module explicitly depends on it.
+sub link {
+  my ($self, %args) = @_;
+
+  if ($self->{config}{useshrplib}) {
+    $args{extra_linker_flags} = [
+      $self->split_like_shell($args{extra_linker_flags}),
+      '-L' . $self->perl_inc(),
+      '-lperl',
+    ];
+  }
+
+  return $self->SUPER::link(%args);
+}
+
+1;