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

Re: $^O for Android

Thread Previous | Thread Next
From:
Brian Fraser
Date:
January 12, 2014 23:57
Subject:
Re: $^O for Android
Message ID:
CA+nL+naWYCL+K5YSjiFAgcBBy-iWKpQ9QvOXqBUh1Rwkyatamg@mail.gmail.com
On Sun, Jan 12, 2014 at 8:27 PM, Piotr Roszatycki <
piotr.roszatycki@gmail.com> 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]
> https://github.com/Hugmeir/utf8mess/commit/abb428c536af4c48bfb912183b5d86d02f9912d8
> [2]
> https://github.com/dex4er/perl5/commit/63853cf7503cbac31914727dffa99f18a592480e
> [3] https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/pull/82
>
> --
> Piotr Roszatycki
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About