develooper Front page | perl.perl5.porters | Postings from January 2014

Re: $^O for Android

Thread Previous | Thread Next
Brian Fraser
January 12, 2014 23:57
Re: $^O for Android
Message ID:
On Sun, Jan 12, 2014 at 8:27 PM, Piotr Roszatycki <> wrote:

> What should contain $^O for Android port?
> There are two options already I've noticed: 'linux-androideabi' [1]
> and 'android' [2]

I will copy paste what I said in the github comment:

[linux-androideabi was] castaway's choice, but it's for the sake of
Configure & has some background
in how cross-compilation has previously worked (osname would've been just
targetarch, sans the first component, e.g. mipsel-linux-android ->
linux-android, arm-linux-gnueabihf -> linux-gnueabihf, etc. That's getting
changed in the future). Native android is a hacked Linux system; if we used
linux-android we don't have to hack Configure to add an extra check for
android whenever it's looking for Linux; it's also future proofing the
whole thing, since what's bound to happen is that someone will add a new
linux branch but not add the |android bit.

Mind you, it might be plausible to add a Configure hook to change osname to
'android' after Configure is done but before make is run. I think that's
probably the way to go, but castaway (who did much of the porting for
android) should chime in, so please send a mail to perl5-porters about it.

To expand here, the alternatives are adding android| everywhere in
Configure where linux| is used, and then waiting until someone doesn't know
that every linux| has to be coupled with an android| and things break --
which is the approach that we've been taking with the *BSDs -- or changing
those linux| to *linux*| and having the osname as linux-android, which gets
us those checks for free while also being slightly more future-proof.

> I think it should be just 'android' as far as Cygwin has 'cygwin', not
> 'MSWin32-cygwin'. This is the same case: different libc and ABI on the
> same platform.

Not the same case. I copypaste again:

cygwin has a proper toolchain and isn't cross-compiled, though. There's
also the issue of future-proofing Configure, see above.

What I didn't know at the time is that there's a native toolchain for
android on the Play Store (i.e. not provided by Google). That's interesting
and I'll try it soon, but it doesn't change the point of future-proofing.

> Anyway, I would like to know how to mark Android OS before I'll make
> some patches ie. for ExtUtils::MakeMaker [3]

Copypasting again:

$^O =~ /android/

> [1]
> [2]
> [3]
> --
> Piotr Roszatycki

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About