From 05d6f487dfee45dedc9447a67ff052c79cc4bf38 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 1 Sep 2012 10:50:51 +0100 Subject: perl on android --- src/SW/perl-on-android/.gitignore | 2 + src/SW/perl-on-android/document.en.rest.txt | 183 ++++++++++++++++++++++++++++ src/SW/perl-on-android/du2html.xsl | 1 + 3 files changed, 186 insertions(+) create mode 100644 src/SW/perl-on-android/.gitignore create mode 100644 src/SW/perl-on-android/document.en.rest.txt create mode 120000 src/SW/perl-on-android/du2html.xsl (limited to 'src/SW') diff --git a/src/SW/perl-on-android/.gitignore b/src/SW/perl-on-android/.gitignore new file mode 100644 index 0000000..08d33d4 --- /dev/null +++ b/src/SW/perl-on-android/.gitignore @@ -0,0 +1,2 @@ +/document.en.du.xml +/document.it.du.xml diff --git a/src/SW/perl-on-android/document.en.rest.txt b/src/SW/perl-on-android/document.en.rest.txt new file mode 100644 index 0000000..754915f --- /dev/null +++ b/src/SW/perl-on-android/document.en.rest.txt @@ -0,0 +1,183 @@ +========================= +Compiling Perl on Android +========================= +:CreationDate: 2012-09-01 09:19:00 +:Id: SW/perl-on-android +:tags: - software + - perl + + +At `YAPC::EU 2013`_, I only had my Asus TF101, and I wanted to play +with some of the modules that the speakers were talking about. + +The Google-provided "Perl for Android" (part of the `Android Scripting +Environment`_) is nearly useless, since you don't get the whole Perl +core, the CPAN shell does not work, and you don't have a compiler for +XS modules. + +Another option would be to cross-compile from a normal computer, but +apart from the fact that I did not another computer with me, you still +would not be able to install XS modules directly from the +cross-compiled Perl. + +So I did what any self-respecting programmer would do: tried to build +my own. I haven't yet managed to completely build the Perl +distribution, but I have come some way, and I thought that it would be +nice to write things down. + +Prerequisites +============= + +First of all, you need root access on your device: we have to create +filesystems, change owners and permissions, mount images. + +Then, you need quite some RAM, storage, and processor. I wouldn't try +it on a phone or a low-powered tablet. + +Finally, you need ``busybox``: the bare-bones command line tools +shipped with most Android images are so limited that not even the very +conservative Perl ``Configure`` can use them. You'll want to execute +this (or something similar) to get ``busybox`` binaries in preference +to the built-in ones:: + + export PATH=/system/xbin:$PATH + +Preparations +============ + +We need a native compiler. I found a well-built ``gcc`` on a wiki +about ``R``: +http://rwiki.sciviews.org/doku.php?id=getting-started:installation:android + +Get the two ``gcc`` tarballs. + +We're going to build a filesystem image, mount it via the loopback +device, and install everything there: this way, the image can be moved +between devices (we'll make sure everything is as relocatable as +possible). I stored everything under ``/data/media/native`` (I created +that directory). ``/data/media`` is, on my device, the actual store +that is exposed (via a sort of bind-mount) as ``/sdcard``, with the +difference that the latter has ``noexec``, the former doesn't. + +We want a rather large image, let's say 3 GB. I tried to make a sparse +file with ``dd if=/dev/zero of=native.e2.diskimg bs=1024 seek=3000000 +count=1`` but it failed. I ended up creating two smaller files and +concatenating them. Then:: + + # cd /data/media/native + + # mke2fs -f native.e2.diskimg + + # cat > /data/media/native/start < /data/media/native/stop < /Removable/bin/true <