From 66d19e10e701c2b6313f0717c33513cb6215c5dd Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Fri, 1 Dec 2017 21:14:52 +0100 Subject: [PATCH] Add build information for Android platforms Signed-off-by: Ralf Habacker Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104022 --- README.android | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 README.android diff --git a/README.android b/README.android new file mode 100644 index 00000000..2cfca1ff --- /dev/null +++ b/README.android @@ -0,0 +1,99 @@ +Build DBus for android on Linux +=============================== + + +1. download and install android-studio.sh +----------------------------------------- + +see https://developer.android.com/studio/index.html + + +2. install required Android SDK and Tools +----------------------------------------- +This is performed with the android-studio SDK manager +(see https://developer.android.com/studio/intro/update.html#sdk-manager) + +Install + from SDK Platforms + - Android 5.0 ABI level 21 (for example) + + from SDK tools + - CMake + - Android NDK + +into say ~/Android/Sdk + + +3. Setup environment in bash shell +---------------------------------- + +export ANDROID_NDK=~/Android/Sdk/ndk-bundle +# this path may change with newer cmake installations +export ANDROID_CMAKE=~/Android/Sdk/cmake/3.6.4111459/bin/cmake +export ANDROID_NATIVE_API_LEVEL=21 +export ANDROID_ABI=armeabi-v7a +export ANDROID_INSTALL_DIR=~/dbus-android-binaries + + +4. fetch and build expat +------------------------ + +mkdir src +cd src +git clone https://github.com/libexpat/libexpat.git +mkdir libexpat-android-build +cd libexpat-android-build +$ANDROID_CMAKE \ + -DANDROID_TOOLCHAIN=clang \ + -DANDROID_STANDALONE_TOOLCHAIN=$ANDROID_NDK \ + -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \ + -DANDROID_NATIVE_API_LEVEL=$ANDROID_NATIVE_API_LEVEL \ + -DANDROID_ABI=$ANDROID_ABI \ + -DCMAKE_INSTALL_PREFIX=/data/local/tmp/dbus \ + ../libexpat/expat +make +make install DESTDIR=$ANDROID_INSTALL_DIR +cd .. + + +5. fetch and build dbus +------------------------ + +git clone git://anongit.freedesktop.org/git/dbus/dbus +mkdir dbus-android-buil +cd dbus-android-build + +$ANDROID_CMAKE \ + -DANDROID_TOOLCHAIN=clang \ + -DANDROID_STANDALONE_TOOLCHAIN=$ANDROID_NDK \ + -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \ + -DANDROID_NATIVE_API_LEVEL=$ANDROID_NATIVE_API_LEVEL \ + -DANDROID_ABI=$ANDROID_ABI \ + -DDBUS_ENABLE_XML_DOCS=OFF \ + -DEXPAT_INCLUDE_DIR=$ANDROID_INSTALL_DIR/data/local/tmp/dbus/include \ + -DEXPAT_LIBRARY=$ANDROID_INSTALL_DIR/data/local/tmp/dbus/lib/libexpat.so \ + -DCMAKE_INSTALL_PREFIX=/data/local/tmp/dbus \ + ../dbus/cmake +make +make install DESTDIR=$ANDROID_INSTALL_DIR + + +6. install dbus on android device +--------------------------------- + +adb push $ANDROID_INSTALL_DIR/data /data + + +7. start dbus daemon +-------------------- + +adb shell +cd /data/local/tmp/dbus/ +export LD_LIBRARY_PATH=$PWD/lib +eval `bin/dbus-launch --config-file=share/dbus-1/session.conf --sh-syntax` + + +8. start client +---------------- + +bin/dbus-monitor -- 2.12.3