diff --git a/adb-push-sflphone.sh b/adb-push-sflphone.sh new file mode 100755 index 0000000000000000000000000000000000000000..2e1ea75eaf6acd1d48d59158d6fa1057118ff339 --- /dev/null +++ b/adb-push-sflphone.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# Copyright (C) 2004-2012 Savoir-Faire Linux Inc. +# +# Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Additional permission under GNU GPL version 3 section 7: +# +# If you modify this program, or any covered work, by linking or +# combining it with the OpenSSL project's OpenSSL library (or a +# modified version of that library), containing parts covered by the +# terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. +# grants you additional permission to convey the resulting work. +# Corresponding Source for a non-source form of such a combination +# shall include the source code for the parts of OpenSSL used as well +# as that of the covered work. +# + +ANDROID_REMT_CMD="abd remount" +ANDROID_PUSH_CMD="adb push" + +ANDROID_SYSTEM="/system" +ANDROID_SYSTEM_BIN="$ANDROID_SYSTEM/bin" +ANDROID_SYSTEM_XBN="$ANDROID_SYSTEM/xbin" +ANDROID_SYSTEM_LIB="$ANDROID_SYSTEM/lib" +ANDROID_SYSTEM_ETC="$ANDROID_SYSTEM/etc" + +ANDROID_DATA_DATA="/data/data" +ANDROID_DATA_CODECS="$ANDROID_DATA_DATA/codecs" +ANDROID_DATA_CONFIG="$ANDROID_DATA_DATA/org.sflphone.service" + +LOCAL_BIN_PATH="$PWD/obj/local/armeabi" + +DBUS_SESSION_D=/system/etc/session.d + + +adb remount + +adb shell mkdir $ANDROID_DATA_CODECS +adb shell mkdir $ANDROID_DATA_CONFIG +adb shell mkdir $DBUS_SESSION_D + +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/busybox $ANDROID_SYSTEM_XBN" + +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/dbus-daemon $ANDROID_SYSTEM_BIN" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/dbus-send $ANDROID_SYSTEM_BIN" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/dbus-monitor $ANDROID_SYSTEM_BIN" + +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libccgnu2.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libcrypto.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libdbus.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libgnustl_shared.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libspeexresampler.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libcodec_ulaw.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libcodec_alaw.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libccrtp1.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libdbus-c++-1.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libexpat.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libsamplerate.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libssl.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libyaml.so $ANDROID_SYSTEM_LIB" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libsflphone.so $ANDROID_SYSTEM_LIB" + +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/session.conf $ANDROID_SYSTEM_ETC" + +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libcodec_ulaw.so $ANDROID_DATA_CODECS" +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/libcodec_alaw.so $ANDROID_DATA_CODECS" + +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/sflphoned.yml $ANDROID_DATA_CONFIG" + +eval "$ANDROID_PUSH_CMD $LOCAL_BIN_PATH/sflphoned $ANDROID_SYSTEM_BIN" diff --git a/jenkins-sflphone-android.sh b/jenkins-sflphone-android.sh new file mode 100755 index 0000000000000000000000000000000000000000..fb2611c505fc4fdc508cd57309b2ab48fff9f24d --- /dev/null +++ b/jenkins-sflphone-android.sh @@ -0,0 +1,135 @@ +#!/bin/bash +# +# Copyright (C) 2004-2012 Savoir-Faire Linux Inc. +# +# Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Additional permission under GNU GPL version 3 section 7: +# +# If you modify this program, or any covered work, by linking or +# combining it with the OpenSSL project's OpenSSL library (or a +# modified version of that library), containing parts covered by the +# terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. +# grants you additional permission to convey the resulting work. +# Corresponding Source for a non-source form of such a combination +# shall include the source code for the parts of OpenSSL used as well +# as that of the covered work. +# + +# Script used by Jenkins continious integration server to build and +# test sflphone-android project + +# +# Make sure that: +# Download android_ndk_ +# android_sdk_ +# Install java runtime engine, ant +# Required dependencies +# sudo apt-get install libglfw-dev + +# Setup environment variables +export ANDROID_NDK=$HOME/android/android-ndk-r8b +export ANDROID_SDK=$HOME/android/android-sdk-linux +export ANDROID_SWT=$ANDROID_SDK/tools/lib/x86_64 + +ANDROID_SDK_TOOLS=$ANDROID_SDK/tools + +export PATH=$PATH:$ANDROID_NDK +export PATH=$PATH:$ANDROID_SDK +export PATH=$PATH:$ANDROID_SDK/platform-tools +export PATH=$PATH:$ANDROID_SDK_TOOLS + +VIRTUAL_DEVICE_ID=15 +VIRTUAL_DEVICE_ABI=9 +VIRTUAL_DEVICE_NAME=sflphone-android + +ANDROID_PROJECT_PATH=$HOME/sflphone/sflphone-android + +print_help() { + echo "Init sflphone-android test server, run test suite + Options: + -h Print this help message + -i Init test server environment (should be run only once) + -b Build the application, do not run the test suite + -r Run the full test suite, priorly build the application" +} + +init_build_server() { + android delete avd --name $VIRTUAL_DEVICE_NAME + + echo "Create a new android virtual device, overwrite precendent one" + android create avd -n $VIRTUAL_DEVICE_NAME -t $VIRTUAL_DEVICE_ID -f +} + +build_sflphone_android() { + # android update project --target $VIRTUAL_DEVICE_ID --path $ANDROID_PROJECT_PATH + + echo "Build JNI related libraries" + # ndk-build clean + ndk-build -j4 + + echo "Build Java application" + ant debug +} + +run_test_suite() { + echo "Terminate any currently running emulator" + killall emulator-arm -u $USER + + # build_sflphone_android + echo "List of currently available android virtual devices" + android list avd + + echo "Launching the android emulator using \"$VIRTUAL_DEVICE_NAME\" avd" + emulator -avd $VIRTUAL_DEVICE_NAME -audio none -gpu off -partition-size 256 -no-window & + + echo "Waiting for device ..." + adb wait-for-device + + echo "List of devices currently running" + adb devices + + echo "Upload sflphone on the virtual device" +# ./adb-push-sflphone.sh + +# adb push launch-sflphone.sh /data/data +# adb shell sh /data/data/launch-sflphone.sh +} + +if [ "$#" -eq 0 ]; then + print_help +fi + +while getopts "hibr" opts; do + case $opts in + h) + print_help + ;; + i) + init_build_server + ;; + b) + build_sflphone_android + ;; + r) + run_test_suite + ;; + *) + print_help + ;; + esac +done diff --git a/launch-sflphone.sh b/launch-sflphone.sh new file mode 100755 index 0000000000000000000000000000000000000000..daf02e78c5b52c7a53258a70878c36f25df9fbdc --- /dev/null +++ b/launch-sflphone.sh @@ -0,0 +1,53 @@ +#!/sytem/bin/sh +# +# Copyright (C) 2004-2012 Savoir-Faire Linux Inc. +# +# Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Additional permission under GNU GPL version 3 section 7: +# +# If you modify this program, or any covered work, by linking or +# combining it with the OpenSSL project's OpenSSL library (or a +# modified version of that library), containing parts covered by the +# terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. +# grants you additional permission to convey the resulting work. +# Corresponding Source for a non-source form of such a combination +# shall include the source code for the parts of OpenSSL used as well +# as that of the covered work. +# + +# Meant to be run on the target platform using adb shell + +mkdir /data/data/ok + +/system/bin/dbus-daemon --fork --print-pid --print-address --session > /data/data/dbus.info + +DBUS_ADDRESS_COMPLETE="" +while read line; +do + DBUS_ADDRESS_COMPLETE="$line" +done < "/data/data/dbus.info" + +IFS="," +set -- $DBUS_ADDRESS_COMPLETE + +DBUS_ADDRESS=$1 +DBUS_EXPORT="DBUS_SESSION_BUS_ADDRESS=$DBUS_ADDRESS" + +export $DBUS_EXPORT + +/system/bin/sflphoned -d -c &