damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.42k stars 804 forks source link

Tutorial on how to compile core Perl XS modules (that are in C versus pure Perl) #236

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:26

One of Perl's strengths is its base of core modules, in additon to the huge 
number of 3rd party modules that can be downloaded from CPAN.

Many of the core modules are missing however from the Perl interpreter .zip 
file. Some are just "pure Perl" .pm modules (i.e., text files), but others are 
"XS" modules, which are coded in C and need to be compiled for the host OS 
(i.e., Android).

Assuming that most pure Perl modules can just be copied into the '/5.10.0' 
directory, it would be very helpful to be able to compile XS modules (like 
Compress::Zlib for example) for Android. Most of these modules compile fine on 
a large variety of OS's, so it seems probable that they should on Android as 
well.

A step-by-step guide on how to do this would be extremely helpful, and so would 
a repository where users could upload the resulting binaries to save others the 
trouble of compiling the same core Perl modules. Alternatively an optional .zip 
file containing these core modules could be downloaded if the goal is to keep 
the Perl interpreter .zip small in size.

Original issue reported on code.google.com by danielop...@gmail.com on 2 Jul 2010 at 7:33

Copied from original issue: damonkohler/android-scripting#366

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Original comment by damonkoh...@gmail.com on 2 Jul 2010 at 7:53

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Does anyone involved with the Perl interpreter for ASE have experience in 
compiling XS modules for Android? I'd be happy to write out the aforementioned 
guide for core modules based on an example of any single module. Thanks.

Original comment by danielop...@gmail.com on 7 Jul 2010 at 9:47

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

I personally don't, but I intend to speak to the Perl 5 Porters group (those in 
charge of maintaining Perl5) and see how this can be achieved.

If successful at that, I'll write a tutorial.

Original comment by xsawy...@gmail.com on 8 Jul 2010 at 5:00

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Thanks for the follow-up. Any updates from the Perl 5 Porters group yet?

Original comment by danielop...@gmail.com on 17 Jul 2010 at 12:30

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Just checking in - any progress yet? Perl is very limited with only non-XS 
modules. Thanks!

Original comment by danielop...@gmail.com on 13 Aug 2010 at 12:53

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Sorry for the lack of updates on my behalf.

I have successfully compiled Perl 5.13.3 for arm, but unfortunately not using 
clibc. I reckon that's why it didn't work on Android. This means most modules 
will come pre-built with Perl already.

Once I get that worked up, I'll write up how to compile XS modules natively.

Original comment by xsawy...@gmail.com on 13 Aug 2010 at 1:32

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Sounds good, many thanks for your efforts - happy to test anything or assist 
with documentation if helpful.

Original comment by danielop...@gmail.com on 13 Aug 2010 at 8:36

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

It's been a while since I checked - has there been any progress on compiling 
Perl XS modules, like Compress::Zlib, for Android? Any help on how to do this 
would be really appreciated! Thanks.

Original comment by danielop...@gmail.com on 13 Dec 2010 at 12:56

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

I have managed to compile perl for android, I can copy it to my emulator and 
run it.  I'm going to try some modules now.

Original comment by jacode...@gmail.com on 27 Aug 2011 at 7:34

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

That's awesome news!

What version? What modules are included? Any XS?

How did you compile? agcc? The Android toolchain? Manually cross-compiling? 
PAR? The Staticperl by Marc Lehmann?

Please share.

Original comment by xsawy...@gmail.com on 27 Aug 2011 at 8:19

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Sounds good! It would be great to be able to use standard modules like 
Compress::Zlib. PAR would be great too! :-) Thanks for your efforts.

Original comment by danielop...@gmail.com on 27 Aug 2011 at 9:41

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Maybe I should make more noise. I've been working on Perl cross-compiliing for 
Android with P5P for several weeks now. I have it as far as compiling 5.15 
(blead) with agcc and including all the core modules. I also modified the 
installer from sl4a to pull from my webserver so I could install it. It's all 
in a branch on github: http://github.com/castaway/perl/tree/x-compile-android . 
Now that works I'm tweaking the install code to install/keep a local copy 
around with miniperl, so that other modules can be built against it later (see 
most recent commits).

Keep meaning to blog about it and failing.. 

Original comment by schiffbr...@googlemail.com on 28 Aug 2011 at 7:59

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Incredible work!

Mad props! :)

Original comment by xsawy...@gmail.com on 28 Aug 2011 at 9:09

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

schiffbr, thanks for updating the list - there's likely a lot more of us who'd 
love to have the full Perl distribution functional on Android. 

Having the added ability to have SL4A download the Perl interpreter package 
from your own server is a great plus too, so developers could include whatever 
modules they wanted. 

It would be ideal if "Sharing Scripts as APKs" under the Wiki (or a blog) could 
detail how to build an APK that calls a Perl package from your own server. That 
would really make developing APKs in Perl much more practical. Thanks!

Original comment by danielop...@gmail.com on 28 Aug 2011 at 12:25

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

schiffbr, I'd love to assist in this work. Some basic instructions on how to 
build it would be a big help though. Care to put down some words?

Original comment by ctoo...@gmail.com on 30 Jan 2012 at 12:59