Apply conversion script to all *.md files. authored by Alexander Hansen Færøy's avatar Alexander Hansen Færøy
= CROSS COMPILING PYTHON PROGRAMS FOR ANDROID = # CROSS COMPILING PYTHON PROGRAMS FOR ANDROID
Specifically, compiling OONI for armv7 AOS. Specifically, compiling OONI for armv7 AOS.
Active questions should be underlined until answered. Active questions should be underlined until answered.
...@@ -11,14 +11,14 @@ abel ...@@ -11,14 +11,14 @@ abel
Please keep your colour when answering someone else's questions. Please keep your colour when answering someone else's questions.
== OONI == ## OONI
OONI is described [https://ooni.torproject.org here]. OONI is described [here](https://ooni.torproject.org).
Our main git repository is here: https://gitweb.torproject.org/ooni-probe.git Our main git repository is here: https://gitweb.torproject.org/ooni-probe.git
And individual project members currently use github for their personal and development branches, which And individual project members currently use github for their personal and development branches, which
shouldn't ever be pulled from unless you really know what you're doing or have talked to that developer. shouldn't ever be pulled from unless you really know what you're doing or have talked to that developer.
OONI documentation is [https://ooni.torproject.org/docs/ here]. OONI documentation is [here](https://ooni.torproject.org/docs/).
Our necessary libraries and such are in a pip (in Debian python-pip) requirements.txt file, in the top Our necessary libraries and such are in a pip (in Debian python-pip) requirements.txt file, in the top
level of our repo. I believe many of these dependency libraries will need to be cross-compiled as well. level of our repo. I believe many of these dependency libraries will need to be cross-compiled as well.
...@@ -26,15 +26,15 @@ Some of these things, so far as I can recall, have already been compiled for And ...@@ -26,15 +26,15 @@ Some of these things, so far as I can recall, have already been compiled for And
think Twisted was already done, last I checked, but I do not remember which version. think Twisted was already done, last I checked, but I do not remember which version.
== Setting up your Android toolchain, the Android SDK, & Android NDK (if you don't already have them) == ## Setting up your Android toolchain, the Android SDK, & Android NDK (if you don't already have them)
see https://code.google.com/p/python-for-android/wiki/CrossCompilingPython see https://code.google.com/p/python-for-android/wiki/CrossCompilingPython
=== Useful ~/.bashrc.android === ### Useful ~/.bashrc.android
I use this when doing NDK stuff, the python-for-android link defines ANDROID_NDK_TOOLCHAIN_ROOT which seems to be a copy of the toolchain in a new location, this .bashrc.android does not take that into account. In my ~/src/android, android-ndk is a symlink to the current NDK folder (which atm is android-ndk-r8b). I use this when doing NDK stuff, the python-for-android link defines ANDROID_NDK_TOOLCHAIN_ROOT which seems to be a copy of the toolchain in a new location, this .bashrc.android does not take that into account. In my ~/src/android, android-ndk is a symlink to the current NDK folder (which atm is android-ndk-r8b).
file: $HOME/.bashrc.android file: $HOME/.bashrc.android
{{{ ```
export NDK_BASE=$HOME/src/android/android-ndk export NDK_BASE=$HOME/src/android/android-ndk
export NDK_ROOT=$NDK_BASE export NDK_ROOT=$NDK_BASE
...@@ -44,9 +44,9 @@ export SDK_TOOLS=${SDK_BASE}/tools ...@@ -44,9 +44,9 @@ export SDK_TOOLS=${SDK_BASE}/tools
export SDK_PLATFORM_TOOLS=${SDK_BASE}/platform-tools export SDK_PLATFORM_TOOLS=${SDK_BASE}/platform-tools
export PATH="${PATH}:${NDK_BASE}:${NDK_TOOLCHAIN_BASE}/bin:${SDK_TOOLS}:${SDK_PLATFORM_TOOLS}" export PATH="${PATH}:${NDK_BASE}:${NDK_TOOLCHAIN_BASE}/bin:${SDK_TOOLS}:${SDK_PLATFORM_TOOLS}"
}}} ```
The relevant bits of mine are: The relevant bits of mine are:
{{{ ```
## ANDROID DEV ## ANDROID DEV
####################### #######################
export NDKROOT=$ISIS/code/android/android-ndk-r7 ## Android NDK export NDKROOT=$ISIS/code/android/android-ndk-r7 ## Android NDK
...@@ -69,11 +69,11 @@ export PATH=$PATH:$ISIS/code/android/android-sdk-linux/platform-tools ...@@ -69,11 +69,11 @@ export PATH=$PATH:$ISIS/code/android/android-sdk-linux/platform-tools
#export HPY=/usr/bin/python2.7 #export HPY=/usr/bin/python2.7
#export HPGEN=$ISIS/code/android/python-compiled-for-host #export HPGEN=$ISIS/code/android/python-compiled-for-host
#export MAKE="make -j4 HOSTPYTHON=$HPY HOSTPGEN=$HPGEN CROSS_COMPILE=arm-eabi- CROSS_COMPILE_TARGET=yes" #export MAKE="make -j4 HOSTPYTHON=$HPY HOSTPGEN=$HPGEN CROSS_COMPILE=arm-eabi- CROSS_COMPILE_TARGET=yes"
}}} ```
== Patching Python due to Android OS's lack of support for $LOCALE == ## Patching Python due to Android OS's lack of support for $LOCALE
There is [http://mdqinc.com/blog/2011/09/cross-compiling-python-for-android/ a good article on this here]. There is [a good article on this here](http://mdqinc.com/blog/2011/09/cross-compiling-python-for-android/).
Specifically, we'll need [https://bitbucket.org/gabomdq/ignifuga/raw/tip/tools/patches/python.android.diff this patch]. Specifically, we'll need [this patch](https://bitbucket.org/gabomdq/ignifuga/raw/tip/tools/patches/python.android.diff).
OONI's code doesn't use locale anywhere yet, though, of our current dependencies, sphinx, docutils, & twisted.mail and twisted.conch, use locale settings. We don't use twisted.mail or twisted.conch, and sphinx and docutils are merely for generating OONI's documentation, which isn't necessary to do on android. OONI's code doesn't use locale anywhere yet, though, of our current dependencies, sphinx, docutils, & twisted.mail and twisted.conch, use locale settings. We don't use twisted.mail or twisted.conch, and sphinx and docutils are merely for generating OONI's documentation, which isn't necessary to do on android.
... ...
......