neurocyte / ghc-android

Build scripts for building ghc cross compilers targeting Android
182 stars 29 forks source link

ifdef check for android? #13

Open joeyh opened 11 years ago

joeyh commented 11 years ago

At this point I have ported hundreds of haskell libraries to android, and have a fully working application.

I have not sent many of my patches to the library authors. Partly because they often need #ifdef, and I'm not sure what to test for to detect that an Android cross compile is being done.

It would be possible to do this just via cabal flags, so cabal install -fAndroid sets a cpp ANDROID. But that would make for more intrusive patches, and would need to manually specify the cabal flag. It would be much nicer if there were something already defined that cpp could use.

Perhaps there already is a symbol I can use. If so, please consider this a request to document it in the README so I have something to point library authors at as they integrate Android support

joeyh commented 11 years ago

BTW, the other reason I've not sent many of my patches is that a lot of them are really ugly. However, interested people can browse them all here: http://source.git-annex.branchable.com/?p=source.git;a=tree;f=standalone/android/haskell-patches

neurocyte commented 11 years ago

It seems to me that very few (if any) of your patches are directly related to Android. I’d much rather get the underlying issues fixed than #ifdefing everything that causes a build problem, especially if it is not directly Android related. Porting stuff to ghc HEAD is useful to many more people than just us.

joeyh commented 11 years ago

CJ van den Berg wrote:

It seems to me that very few (if any) of your patches are directly related to Android. I’d much rather get the underlying issues fixed than #ifdefing everything that causes a build problem, especially if it is not directly Android related. Porting stuff to ghc HEAD is useful to many more people than just us.

There are a fair number of places that need an #ifdef, for example certificate needs to look in the place android places SSL certs.

see shy jo

joeyh commented 11 years ago

Looks like it builds with -Dlinux_android_HOST_OS

see shy jo

neurocyte commented 11 years ago

BTW, I nearly have a template-haskell enabled build working. Hopefully I’ll push it sometime later today. That should eliminate 90% or so of your diffs for you.

neurocyte commented 11 years ago

FYI, the unix termios patch I just added to ghc-android should replace unix_2.6.0.1_0001-remove-stuff-not-available-on-Android.patch in your patch collection. Those functions aren’t missing, they’re just inlined. Although, you can probably just remove it once you rebuild ghc-android.