Android: added make files

This commit is contained in:
Dmitry Podgorny
2015-10-16 17:07:35 +03:00
parent 09e5103eee
commit f46cf669a3
6 changed files with 120 additions and 0 deletions

3
.gitignore vendored
View File

@@ -56,3 +56,6 @@ tests/test_snprintf
tests/test_sock
m4/
libstrophe.project
libs/
obj/
expat/

View File

@@ -1,6 +1,7 @@
0.9.0
- IPv6 support
- Legacy SSL support
- Initial Android support
- New API:
- xmpp_uuid_gen()
- xmpp_conn_get_flags()

View File

@@ -41,6 +41,11 @@ another path use the `--prefix` option during configure, e.g.:
./configure --prefix=/usr
### Android
Run script `build-android.sh` and follow the instructions. You will
need expat sources and android-ndk.
Requirements
------------

31
build-android.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
DIR=`dirname $0`
EXPAT_PATH="$DIR/expat"
EXPAT_FILE='lib/expat.h'
if [ ! -d $EXPAT_PATH ]; then
mkdir $EXPAT_PATH
fi
# TODO Accept expat tarball as argument and extract it to the right place.
if [ ! -d $EXPAT_PATH/lib -o ! -f "$EXPAT_PATH/$EXPAT_FILE" ]; then
cat <<EOT
Error: expat sources not found.
Extract expat sources to $EXPAT_PATH. Make sure $EXPAT_PATH/$EXPAT_FILE and
other source files exist.
EOT
exit 1
fi
ndk-build -C "$DIR" clean || exit 1
ndk-build -C "$DIR" || exit 1
echo
echo "basic example:"
ls -l "$DIR"/libs/*/basic
echo
echo "libstrophe.a:"
ls -l "$DIR"/obj/local/*/libstrophe.a

78
jni/Android.mk Normal file
View File

@@ -0,0 +1,78 @@
LOCAL_PATH:= $(call my-dir)
#
# examples/basic
#
include $(CLEAR_VARS)
LOCAL_MODULE := basic
LOCAL_CFLAGS :=
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/..
LOCAL_SRC_FILES := \
../examples/basic.c
LOCAL_STATIC_LIBRARIES := libstrophe libexpat
include $(BUILD_EXECUTABLE)
#
# libstrohe (static library)
#
include $(CLEAR_VARS)
LOCAL_MODULE := libstrophe
LOCAL_CFLAGS :=
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/.. \
$(LOCAL_PATH)/../src \
$(LOCAL_PATH)/../expat/lib
LOCAL_SRC_FILES := \
../src/auth.c \
../src/conn.c \
../src/crypto.c \
../src/ctx.c \
../src/event.c \
../src/handler.c \
../src/hash.c \
../src/jid.c \
../src/md5.c \
../src/parser_expat.c \
../src/rand.c \
../src/resolver.c \
../src/sasl.c \
../src/scram.c \
../src/sha1.c \
../src/snprintf.c \
../src/sock.c \
../src/stanza.c \
../src/tls_dummy.c \
../src/util.c \
../src/uuid.c
LOCAL_STATIC_LIBRARIES := libstrophe
include $(BUILD_STATIC_LIBRARY)
#
# expat
#
include $(CLEAR_VARS)
LOCAL_MODULE := libexpat
LOCAL_CFLAGS := -DHAVE_MEMMOVE
#LOCAL_C_INCLUDES := \
# $(LOCAL_PATH)/expat
LOCAL_SRC_FILES := \
../expat/lib/xmlparse.c \
../expat/lib/xmlrole.c \
../expat/lib/xmltok.c \
../expat/lib/xmltok_impl.c \
../expat/lib/xmltok_ns.c
LOCAL_STATIC_LIBRARIES := libexpat
include $(BUILD_STATIC_LIBRARY)

2
jni/Application.mk Normal file
View File

@@ -0,0 +1,2 @@
APP_ABI := armeabi armeabi-v7a mips x86
APP_PLATFORM := android-19