Browse Source

Instructions to build for android

pull/2/merge
Hoa V. Dinh 7 years ago
parent
commit
d708babae5
9 changed files with 1235 additions and 0 deletions
  1. +9
    -0
      build-android/.gitignore
  2. +12
    -0
      build-android/README.md
  3. +66
    -0
      build-android/build.sh
  4. +607
    -0
      build-android/dependencies/cyrus-sasl/build-android/include/config.h
  5. +56
    -0
      build-android/dependencies/cyrus-sasl/build-android/jni/Android.mk
  6. +72
    -0
      build-android/dependencies/cyrus-sasl/build.sh
  7. +108
    -0
      build-android/dependencies/openssl/build.sh
  8. +180
    -0
      build-android/include/config.h
  9. +125
    -0
      build-android/jni/Android.mk

+ 9
- 0
build-android/.gitignore View File

@ -0,0 +1,9 @@
dependencies/cyrus-sasl/cyrus-sasl-android-*.zip
dependencies/cyrus-sasl/build-android/obj
dependencies/openssl/openssl-android-*.zip
dependencies/openssl/packages
include/libetpan
third-parties
obj
libetpan-android-*.zip

+ 12
- 0
build-android/README.md View File

@ -0,0 +1,12 @@
## Build instruction for Android ##
```
$ cd build-android
$ ./build.sh
```
It will produce the following binaries:
- libetpan-android-*version*.zip
- dependencies/cyrus-sasl/cyrus-sasl-android-*version*.zip
- dependencies/openssl/openssl-android-*version*.zip

+ 66
- 0
build-android/build.sh View File

@ -0,0 +1,66 @@
#!/bin/sh
build_version=1
ANDROID_PLATFORM=android-21
openssl_build_version=1
cyrus_sasl_build_version=1
archs="armeabi armeabi-v7a x86 x86_64"
package_name=libetpan-android
current_dir="`pwd`"
if test "x$ANDROID_NDK" = x ; then
echo should set ANDROID_NDK before running this script.
exit 1
fi
if test ! -f "$current_dir/dependencies/openssl/openssl-android-$openssl_build_version.zip" ; then
echo Building OpenSSL first
cd "$current_dir/dependencies/openssl"
./build.sh
fi
if test ! -f "$current_dir/dependencies/cyrus-sasl/cyrus-sasl-android-$cyrus_sasl_build_version.zip" ; then
echo Building Cyrus SASL first
cd "$current_dir/dependencies/cyrus-sasl"
./build.sh
fi
function build {
rm -rf "$current_dir/obj"
mkdir -p "$current_dir/third-parties"
cd "$current_dir/third-parties"
unzip -qo "$current_dir/dependencies/openssl/openssl-android-$openssl_build_version.zip"
unzip -qo "$current_dir/dependencies/cyrus-sasl/cyrus-sasl-android-$cyrus_sasl_build_version.zip"
cd "$current_dir/jni"
$ANDROID_NDK/ndk-build TARGET_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI \
OPENSSL_PATH="$current_dir/third-parties/openssl-android-$openssl_build_version" \
CYRUS_SASL_PATH="$current_dir/third-parties/cyrus-sasl-android-$cyrus_sasl_build_version"
mkdir -p "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
cp "$current_dir/obj/local/$TARGET_ARCH_ABI/libetpan.a" "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
rm -rf "$current_dir/src"
rm -rf "$current_dir/obj"
}
cd "$current_dir/.."
tar xzf "$current_dir/../build-mac/autogen-result.tar.gz"
./configure
make prepare
# Copy public headers to include
cp -r include/libetpan "$current_dir/include"
mkdir -p "$current_dir/$package_name-$build_version/include"
cp -r include/libetpan "$current_dir/$package_name-$build_version/include"
# Start building.
for arch in $archs ; do
TARGET_ARCH_ABI=$arch
build
done
cd "$current_dir"
zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"
rm -rf "$package_name-$build_version"

+ 607
- 0
build-android/dependencies/cyrus-sasl/build-android/include/config.h View File

@ -0,0 +1,607 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* acconfig.h - autoheader configuration input */
/*
* Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef CONFIG_H
#define CONFIG_H
/* Runtime config file location */
#define CONFIGDIR "/usr/lib/sasl2:/etc/sasl2"
/* Do we need a leading _ for dlsym? */
/* #undef DLSYM_NEEDS_UNDERSCORE */
/* Should we build a shared plugin (via dlopen) library? */
/* #undef DO_DLOPEN */
/* should we support sasl_checkapop? */
#define DO_SASL_CHECKAPOP /**/
/* should we support setpass() for SRP? */
/* #undef DO_SRP_SETPASS */
/* should we mutex-wrap calls into the GSS library? */
#define GSS_USE_MUTEXES /**/
/* Enable 'alwaystrue' password verifier? */
/* #undef HAVE_ALWAYSTRUE */
/* Include support for Courier's authdaemond? */
#define HAVE_AUTHDAEMON /**/
/* Define to 1 if you have the <des.h> header file. */
/* #undef HAVE_DES_H */
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `dns_lookup' function. */
/* #undef HAVE_DNS_LOOKUP */
/* Define to 1 if you have the `dn_expand' function. */
#define HAVE_DN_EXPAND 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Do we have a getaddrinfo? */
#define HAVE_GETADDRINFO /**/
/* Define to 1 if you have the `getdomainname' function. */
#define HAVE_GETDOMAINNAME 1
/* Define to 1 if you have the `gethostname' function. */
#define HAVE_GETHOSTNAME 1
/* Do we have a getnameinfo() function? */
#define HAVE_GETNAMEINFO /**/
/* Define to 1 if you have the `getpassphrase' function. */
/* #undef HAVE_GETPASSPHRASE */
/* Define to 1 if you have the `getpwnam' function. */
#define HAVE_GETPWNAM 1
/* Define to 1 if you have the `getspnam' function. */
/* #undef HAVE_GETSPNAM */
/* do we have getsubopt()? */
#define HAVE_GETSUBOPT /**/
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <gssapi/gssapi_ext.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_EXT_H */
/* Define if you have the gssapi.h header file */
#define HAVE_GSSAPI_H /**/
/* Define to 1 if you have the `gsskrb5_register_acceptor_identity' function.
*/
/* #undef HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY */
/* Define if your GSSAPI implementation defines GSS_C_NT_HOSTBASED_SERVICE */
#define HAVE_GSS_C_NT_HOSTBASED_SERVICE /**/
/* Define if your GSSAPI implementation defines GSS_C_NT_USER_NAME */
#define HAVE_GSS_C_NT_USER_NAME /**/
/* Define to 1 if you have the `gss_decapsulate_token' function. */
/* #undef HAVE_GSS_DECAPSULATE_TOKEN */
/* Define to 1 if you have the `gss_encapsulate_token' function. */
/* #undef HAVE_GSS_ENCAPSULATE_TOKEN */
/* Define to 1 if you have the `gss_get_name_attribute' function. */
/* #undef HAVE_GSS_GET_NAME_ATTRIBUTE */
/* Define to 1 if you have the `gss_oid_equal' function. */
/* #undef HAVE_GSS_OID_EQUAL */
/* Define to 1 if you have the `inet_aton' function. */
#define HAVE_INET_ATON 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `jrand48' function. */
#define HAVE_JRAND48 1
/* Do we have Kerberos 4 Support? */
/* #undef HAVE_KRB */
/* Define to 1 if you have the `krb_get_err_text' function. */
/* #undef HAVE_KRB_GET_ERR_TEXT */
/* Define to 1 if you have the <lber.h> header file. */
/* #undef HAVE_LBER_H */
/* Define to 1 if you have the <ldap.h> header file. */
/* #undef HAVE_LDAP_H */
/* Define to 1 if you have the `resolv' library (-lresolv). */
#define HAVE_LIBRESOLV 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mkdir' function. */
#define HAVE_MKDIR 1
/* Do we have mysql support? */
/* #undef HAVE_MYSQL */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Do we have OpenSSL? */
#define HAVE_OPENSSL /**/
/* Use OPIE for server-side OTP? */
/* #undef HAVE_OPIE */
/* Define to 1 if you have the <pam/pam_appl.h> header file. */
/* #undef HAVE_PAM_PAM_APPL_H */
/* Define to 1 if you have the <paths.h> header file. */
#define HAVE_PATHS_H 1
/* Do we have Postgres support? */
/* #undef HAVE_PGSQL */
/* Include Support for pwcheck daemon? */
/* #undef HAVE_PWCHECK */
/* Include support for saslauthd? */
#define HAVE_SASLAUTHD /**/
/* Define to 1 if you have the <security/pam_appl.h> header file. */
#define HAVE_SECURITY_PAM_APPL_H 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Does the system have snprintf()? */
#define HAVE_SNPRINTF /**/
/* Does sockaddr have an sa_len? */
//#define HAVE_SOCKADDR_SA_LEN /**/
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
/* Do we have a socklen_t? */
#define HAVE_SOCKLEN_T /**/
/* Do we have SQLite support? */
/* #undef HAVE_SQLITE */
/* Do we have SQLite3 support? */
/* #undef HAVE_SQLITE3 */
/* Is there an ss_family in sockaddr_storage? */
#define HAVE_SS_FAMILY /**/
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strspn' function. */
#define HAVE_STRSPN 1
/* Define to 1 if you have the `strstr' function. */
#define HAVE_STRSTR 1
/* Define to 1 if you have the `strtol' function. */
#define HAVE_STRTOL 1
/* Do we have struct sockaddr_stroage? */
#define HAVE_STRUCT_SOCKADDR_STORAGE /**/
/* Define to 1 if you have the <sysexits.h> header file. */
#define HAVE_SYSEXITS_H 1
/* Define to 1 if you have the `syslog' function. */
#define HAVE_SYSLOG 1
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <varargs.h> header file. */
/* #undef HAVE_VARARGS_H */
/* Does the system have vsnprintf()? */
#define HAVE_VSNPRINTF /**/
/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__ 1
/* Should we keep handle to Berkeley DB open in SASLDB plugin? */
/* #undef KEEP_DB_OPEN */
/* Ignore IP Address in Kerberos 4 tickets? */
/* #undef KRB4_IGNORE_IP_ADDRESS */
/* Name of package */
#define PACKAGE "cyrus-sasl"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Where do we look for Courier authdaemond's socket? */
#define PATH_AUTHDAEMON_SOCKET "/dev/null"
/* Where do we look for saslauthd's socket? */
#define PATH_SASLAUTHD_RUNDIR "/var/state/saslauthd"
/* Runtime plugin location */
#define PLUGINDIR "/usr/lib/sasl2"
/* Force a preferred mechanism */
/* #undef PREFER_MECH */
/* Location of pwcheck socket */
/* #undef PWCHECKDIR */
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Use BerkeleyDB for SASLdb */
/* #undef SASL_BERKELEYDB */
/* Path to default SASLdb database */
#define SASL_DB_PATH "/etc/sasldb2"
/* File to use for source of randomness */
#define SASL_DEV_RANDOM "/dev/random"
/* Use GDBM for SASLdb */
/* #undef SASL_GDBM */
/* Use NDBM for SASLdb */
#define SASL_NDBM /**/
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 8
/* Link ANONYMOUS Staticly */
#define STATIC_ANONYMOUS /**/
/* Link CRAM-MD5 Staticly */
#define STATIC_CRAMMD5 /**/
/* Link DIGEST-MD5 Staticly */
#define STATIC_DIGESTMD5 /**/
/* Link GSSAPI Staticly */
#define STATIC_GSSAPIV2 /**/
/* User KERBEROS_V4 Staticly */
/* #undef STATIC_KERBEROS4 */
/* Link ldapdb plugin Staticly */
/* #undef STATIC_LDAPDB */
/* Link LOGIN Staticly */
/* #undef STATIC_LOGIN */
/* Link NTLM Staticly */
/* #undef STATIC_NTLM */
/* Link OTP Staticly */
#define STATIC_OTP /**/
/* Link PASSDSS Staticly */
/* #undef STATIC_PASSDSS */
/* Link PLAIN Staticly */
#define STATIC_PLAIN /**/
/* Link SASLdb Staticly */
#define STATIC_SASLDB /**/
/* Link SCRAM Staticly */
#define STATIC_SCRAM /**/
/* Link SQL plugin staticly */
/* #undef STATIC_SQL */
/* Link SRP Staticly */
/* #undef STATIC_SRP */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Should we try to dlopen() plugins while staticly compiled? */
/* #undef TRY_DLOPEN_WHEN_STATIC */
/* use the doors IPC API for saslauthd? */
/* #undef USE_DOORS */
/* Version number of package */
#define VERSION "2.1.25"
/* Use DES */
#define WITH_DES /**/
/* Linking against dmalloc? */
/* #undef WITH_DMALLOC */
/* Use internal RC4 implementation? */
#define WITH_RC4 /**/
/* Use OpenSSL DES Implementation */
#define WITH_SSL_DES /**/
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `int' if <sys/types.h> does not define. */
/* #undef mode_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Create a struct iovec if we need one */
#if !defined(_WIN32) && !defined(HAVE_SYS_UIO_H)
/* (win32 is handled in sasl.h) */
struct iovec {
char *iov_base;
long iov_len;
};
#else
#include <sys/types.h>
#include <sys/uio.h>
#endif
/* location of the random number generator */
#ifdef DEV_RANDOM
/* #undef DEV_RANDOM */
#endif
#define DEV_RANDOM SASL_DEV_RANDOM
/* if we've got krb_get_err_txt, we might as well use it;
especially since krb_err_txt isn't in some newer distributions
(MIT Kerb for Mac 4 being a notable example). If we don't have
it, we fall back to the krb_err_txt array */
#ifdef HAVE_KRB_GET_ERR_TEXT
#define get_krb_err_txt krb_get_err_text
#else
#define get_krb_err_txt(X) (krb_err_txt[(X)])
#endif
/* Make Solaris happy... */
#ifndef __EXTENSIONS__
#define __EXTENSIONS__
#endif
/* Make Linux happy... */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifndef HAVE___ATTRIBUTE__
/* Can't use attributes... */
#define __attribute__(foo)
#endif
#define SASL_PATH_ENV_VAR "SASL_PATH"
#define SASL_CONF_PATH_ENV_VAR "SASL_CONF_PATH"
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#ifndef WIN32
# include <netdb.h>
# ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# endif
#else /* WIN32 */
# include <winsock2.h>
#endif /* WIN32 */
#include <string.h>
#include <netinet/in.h>
#ifndef HAVE_SOCKLEN_T
typedef unsigned int socklen_t;
#endif /* HAVE_SOCKLEN_T */
#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
#define _SS_MAXSIZE 128 /* Implementation specific max size */
#define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr))
struct sockaddr_storage {
struct sockaddr ss_sa;
char __ss_pad2[_SS_PADSIZE];
};
# define ss_family ss_sa.sa_family
#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
#ifndef AF_INET6
/* Define it to something that should never appear */
#define AF_INET6 AF_MAX
#endif
#ifndef HAVE_GETADDRINFO
#define getaddrinfo sasl_getaddrinfo
#define freeaddrinfo sasl_freeaddrinfo
#define gai_strerror sasl_gai_strerror
#endif
#ifndef HAVE_GETNAMEINFO
#define getnameinfo sasl_getnameinfo
#endif
#if !defined(HAVE_GETNAMEINFO) || !defined(HAVE_GETADDRINFO)
#include "gai.h"
#endif
#ifndef AI_NUMERICHOST /* support glibc 2.0.x */
#define AI_NUMERICHOST 4
#define NI_NUMERICHOST 2
#define NI_NAMEREQD 4
#define NI_NUMERICSERV 8
#endif
/* Defined in RFC 1035. max strlen is only 253 due to length bytes. */
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 255
#endif
// #ifndef HAVE_SYSEXITS_H
// #include "exits.h"
// #else
// #include "sysexits.h"
// #endif
/* Get the correct time.h */
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#ifndef HIER_DELIMITER
#define HIER_DELIMITER '/'
#endif
#endif /* CONFIG_H */

+ 56
- 0
build-android/dependencies/cyrus-sasl/build-android/jni/Android.mk View File

@ -0,0 +1,56 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
src_files = \
lib/auxprop.c \
lib/canonusr.c \
lib/checkpw.c \
lib/client.c \
lib/common.c \
lib/config.c \
lib/external.c \
lib/getsubopt.c \
lib/md5.c \
lib/saslutil.c \
lib/server.c \
lib/snprintf.c \
plugins/anonymous.c \
plugins/anonymous_init.c \
plugins/cram.c \
plugins/crammd5_init.c \
plugins/digestmd5.c \
plugins/digestmd5_init.c \
plugins/login.c \
plugins/login_init.c \
plugins/ntlm.c \
plugins/ntlm_init.c \
plugins/otp.c \
plugins/otp_init.c \
plugins/passdss.c \
plugins/passdss_init.c \
plugins/plain.c \
plugins/plain_init.c \
plugins/plugin_common.c \
plugins/sasldb.c \
plugins/sasldb_init.c \
plugins/scram.c \
plugins/scram_init.c \
plugins/sql.c \
plugins/sql_init.c \
plugins/srp.c \
plugins/srp_init.c
src_dir := $(LOCAL_PATH)/../..
LOCAL_MODULE := sasl2
ifeq ($(OPENSSL_PATH),)
$(error OPENSSL_PATH must be set)
endif
NDK_TOOLCHAIN_VERSION := clang
LOCAL_C_INCLUDES += $(src_dir) $(src_dir)/include $(src_dir)/plugins \
$(src_dir)/build-android/include $(OPENSSL_PATH)/include
LOCAL_SRC_FILES := $(addprefix $(src_dir)/, $(src_files))
include $(BUILD_STATIC_LIBRARY)

+ 72
- 0
build-android/dependencies/cyrus-sasl/build.sh View File

@ -0,0 +1,72 @@
#!/bin/sh
version=2.1.25
build_version=1
ARCHIVE=cyrus-sasl-$version
ANDROID_PLATFORM=android-21
openssl_build_version=1
archs="armeabi armeabi-v7a x86 x86_64"
package_name=cyrus-sasl-android
if test "x$ANDROID_NDK" = x ; then
echo should set ANDROID_NDK before running this script.
exit 1
fi
ARCHIVE_NAME=$ARCHIVE.tar.gz
ARCHIVE_PATCH=$ARCHIVE.patch
current_dir="`pwd`"
package_dir="$current_dir/../../../build-mac/dependencies/packages"
if [ ! -e "$package_dir/$ARCHIVE_NAME" ]; then
echo "Missing archive $ARCHIVE"
exit 1
fi
if test ! -f "$current_dir/../openssl/openssl-$openssl_build_version.zip" ; then
echo Building OpenSSL first
cd "$current_dir/../openssl"
./build.sh
fi
function build {
rm -rf "$current_dir/src"
mkdir -p "$current_dir/src"
cd "$current_dir/src"
tar xzf "$package_dir/$ARCHIVE_NAME"
if [ $? != 0 ]; then
echo "Unable to decompress $ARCHIVE_NAME"
exit 1
fi
if test ! -f "$current_dir/$package_name-$build_version/include/sasl/sasl.h" ; then
mkdir -p "$current_dir/$package_name-$build_version"
mkdir -p "$current_dir/$package_name-$build_version/include/sasl"
public_headers="hmac-md5.h md5.h md5global.h sasl.h saslplug.h saslutil.h prop.h"
cd "$current_dir/src/$ARCHIVE/include"
cp -R $public_headers "$current_dir/$package_name-$build_version/include/sasl"
fi
cd "$current_dir/src"
unzip -q "$current_dir/../openssl/openssl-$openssl_build_version.zip"
cp -R "$current_dir/build-android" "$current_dir/src/$ARCHIVE"
cd "$current_dir/src/$ARCHIVE/build-android/jni"
$ANDROID_NDK/ndk-build TARGET_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI \
OPENSSL_PATH="$current_dir/src/openssl-android-$openssl_build_version"
mkdir -p "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
cp "$current_dir/src/$ARCHIVE/build-android/obj/local/$TARGET_ARCH_ABI/libsasl2.a" "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
rm -rf "$current_dir/src"
}
# Start building.
for arch in $archs ; do
TARGET_ARCH_ABI=$arch
build
done
cd "$current_dir"
zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"
rm -rf "$package_name-$build_version"

+ 108
- 0
build-android/dependencies/openssl/build.sh View File

@ -0,0 +1,108 @@
#!/bin/sh
build_version=1
version=1.0.1j
android_platform=android-21
package_name=openssl-android
if test "x$ANDROID_NDK" = x ; then
echo should set ANDROID_NDK before running this script.
exit 1
fi
if test ! -f packages/openssl-$version.tar.gz; then
mkdir -p packages
cd packages
curl -O https://www.openssl.org/source/openssl-$version.tar.gz
cd ..
fi
function build_x86_64 {
toolchain=x86_64-4.9
toolchain_name=x86_64-linux-android
arch_cflags=""
arch_ldflags=""
arch_dir_name="x86_64"
openssl_configure_mode="linux-x86_64"
build
}
function build_armeabi {
toolchain=arm-linux-androideabi-4.9
toolchain_name=arm-linux-androideabi
arch_cflags="-mthumb"
arch_ldflags=""
arch_dir_name="armeabi"
openssl_configure_mode="android"
build
}
function build_x86 {
toolchain=x86-4.9
toolchain_name=i686-linux-android
arch_cflags="-march=i686 -msse3 -mstackrealign -mfpmath=sse"
arch_ldflags=""
arch_dir_name="x86"
openssl_configure_mode="android-x86"
build
}
function build_armeabi_v7a {
toolchain=arm-linux-androideabi-4.9
toolchain_name=arm-linux-androideabi
arch_cflags="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16"
arch_ldflags="-march=armv7-a -Wl,--fix-cortex-a8"
arch_dir_name="armeabi-v7a"
openssl_configure_mode="android-armv7"
build
}
function build {
rm -rf "$current_dir/src"
mkdir -p "$current_dir/src"
cd "$current_dir/src"
tar xzf "$current_dir/packages/openssl-$version.tar.gz"
cd openssl-$version
toolchain_path="`pwd`/$toolchain_name"
$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --platform=$android_platform --toolchain=$toolchain --install-dir="$toolchain_path"
toolchain_bin_path="$toolchain_path/bin"
export TOOL=arm-linux-androideabi
export ndk_toolchain_base_name="$toolchain_bin_path/$toolchain_name"
export CC=$ndk_toolchain_base_name-gcc
export CXX=$ndk_toolchain_base_name-g++
export LINK=${CXX}
export LD=$ndk_toolchain_base_name-ld
export AR=$ndk_toolchain_base_name-ar
export RANLIB=$ndk_toolchain_base_name-ranlib
export STRIP=$ndk_toolchain_base_name-strip
export CPPFLAGS="$arch_cflags -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export CXXFLAGS="$arch_cflags -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions "
export CFLAGS="$arch_cflags -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export LDFLAGS="$arch_ldflags"
./Configure "$openssl_configure_mode"
make
mkdir -p "$current_dir/$package_name-$build_version"
mkdir -p "$current_dir/$package_name-$build_version/libs/$arch_dir_name"
cp -r include "$current_dir/$package_name-$build_version"
cp libcrypto.a libssl.a "$current_dir/$package_name-$build_version/libs/$arch_dir_name"
cd "$current_dir"
rm -rf src
}
# start building.
current_dir="`pwd`"
build_armeabi
build_armeabi_v7a
build_x86
build_x86_64
cd "$current_dir"
zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"
rm -rf "$package_name-$build_version"

+ 180
- 0
build-android/include/config.h View File

@ -0,0 +1,180 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Check for Linux's /usr/include/features.h
*/
#ifdef _FEATURES_H
# error config.h must be first file included
#endif
/* Define to detected Berkeley DB major version number */
#define DBVERS 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* Define to use curl */
/* #undef HAVE_CURL */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to use expat */
/* #undef HAVE_EXPAT */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to use getopt_long */
#define HAVE_GETOPT_LONG 1
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define if you have the iconv() function. */
#define HAVE_ICONV 1
/* prototype of iconv() has const parameters */
/* #undef HAVE_ICONV_PROTO_CONST */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to enable IPv6 support. */
#define HAVE_IPV6 1
/* Define to 1 if you have the `lockfile' library (-llockfile). */
/* #undef HAVE_LIBLOCKFILE */
/* Define to 1 if you have the `nsl' library (-lnsl). */
/* #undef HAVE_LIBNSL */
/* Define to 1 if you have the `socket' library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Defined if we run on a W32 API based system */
/* #undef HAVE_MINGW32_SYSTEM */
/* Define to 1 if you have a working `mmap' system call. */
#define HAVE_MMAP 1
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <pthread.h> header file. */
#define HAVE_PTHREAD_H 1
/* Define to use setenv */
#define HAVE_SETENV 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <winsock2.h> header file. */
/* #undef HAVE_WINSOCK2_H */
/* Enable classes using zlib compression. */
#define HAVE_ZLIB 1
/* Define to include multithreading support */
#define LIBETPAN_REENTRANT 1
/* Define this to the version of libEtPan */
#define LIBETPAN_VERSION "1.2-dev-20141203"
/* Define this to the major version of libEtPan */
#define LIBETPAN_VERSION_MAJOR 1
/* Define this to the minor version of libEtPan */
#define LIBETPAN_VERSION_MINOR 2
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "libetpan"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "libetpan-devel@lists.sourceforge.net"
/* Define to the full name of this package. */
#define PACKAGE_NAME "libetpan"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libetpan 1.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libetpan"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.2"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to be lazy on protocol syntax */
#define UNSTRICT_SYNTAX 1
/* Define to use GnuTLS */
/* #undef USE_GNUTLS */
/* Define to use SASL */
#define USE_SASL 1
/* Define to use OpenSSL */
#define USE_SSL 1
/* Version number of package */
#define VERSION "1.2"
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif

+ 125
- 0
build-android/jni/Android.mk View File

@ -0,0 +1,125 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
src_files = \
./src/data-types/base64.c \
./src/data-types/carray.c \
./src/data-types/charconv.c \
./src/data-types/chash.c \
./src/data-types/clist.c \
./src/data-types/connect.c \
./src/data-types/mail_cache_db.c \
./src/data-types/maillock.c \
./src/data-types/mailsasl.c \
./src/data-types/mailsem.c \
./src/data-types/mailstream.c \
./src/data-types/mailstream_cancel.c \
./src/data-types/mailstream_cfstream.c \
./src/data-types/mailstream_compress.c \
./src/data-types/mailstream_helper.c \
./src/data-types/mailstream_low.c \
./src/data-types/mailstream_socket.c \
./src/data-types/mailstream_ssl.c \
./src/data-types/md5.c \
./src/data-types/mmapstring.c \
./src/data-types/timeutils.c \
./src/low-level/imap/acl.c \
./src/low-level/imap/acl_parser.c \
./src/low-level/imap/acl_sender.c \
./src/low-level/imap/acl_types.c \
./src/low-level/imap/annotatemore.c \
./src/low-level/imap/annotatemore_parser.c \
./src/low-level/imap/annotatemore_sender.c \
./src/low-level/imap/annotatemore_types.c \
./src/low-level/imap/condstore.c \
./src/low-level/imap/condstore_types.c \
./src/low-level/imap/enable.c \
./src/low-level/imap/idle.c \
./src/low-level/imap/mailimap.c \
./src/low-level/imap/mailimap_compress.c \
./src/low-level/imap/mailimap_extension.c \
./src/low-level/imap/mailimap_helper.c \
./src/low-level/imap/mailimap_id.c \
./src/low-level/imap/mailimap_id_parser.c \
./src/low-level/imap/mailimap_id_sender.c \
./src/low-level/imap/mailimap_id_types.c \
./src/low-level/imap/mailimap_keywords.c \
./src/low-level/imap/mailimap_oauth2.c \
./src/low-level/imap/mailimap_parser.c \
./src/low-level/imap/mailimap_print.c \
./src/low-level/imap/mailimap_sender.c \
./src/low-level/imap/mailimap_socket.c \
./src/low-level/imap/mailimap_sort.c \
./src/low-level/imap/mailimap_sort_types.c \
./src/low-level/imap/mailimap_ssl.c \
./src/low-level/imap/mailimap_types.c \
./src/low-level/imap/mailimap_types_helper.c \
./src/low-level/imap/namespace.c \
./src/low-level/imap/namespace_parser.c \
./src/low-level/imap/namespace_sender.c \
./src/low-level/imap/namespace_types.c \
./src/low-level/imap/qresync.c \
./src/low-level/imap/qresync_types.c \
./src/low-level/imap/quota.c \
./src/low-level/imap/quota_parser.c \
./src/low-level/imap/quota_sender.c \
./src/low-level/imap/quota_types.c \
./src/low-level/imap/uidplus.c \
./src/low-level/imap/uidplus_parser.c \
./src/low-level/imap/uidplus_sender.c \
./src/low-level/imap/uidplus_types.c \
./src/low-level/imap/xgmlabels.c \
./src/low-level/imap/xgmmsgid.c \
./src/low-level/imap/xgmthrid.c \
./src/low-level/imap/xlist.c \
./src/low-level/imf/mailimf.c \
./src/low-level/imf/mailimf_types.c \
./src/low-level/imf/mailimf_types_helper.c \
./src/low-level/imf/mailimf_write_file.c \
./src/low-level/imf/mailimf_write_generic.c \
./src/low-level/imf/mailimf_write_mem.c \
./src/low-level/mime/mailmime.c \
./src/low-level/mime/mailmime_content.c \
./src/low-level/mime/mailmime_decode.c \
./src/low-level/mime/mailmime_disposition.c \
./src/low-level/mime/mailmime_types.c \
./src/low-level/mime/mailmime_types_helper.c \
./src/low-level/mime/mailmime_write_file.c \
./src/low-level/mime/mailmime_write_generic.c \
./src/low-level/mime/mailmime_write_mem.c \
./src/low-level/nntp/newsnntp.c \
./src/low-level/nntp/newsnntp_socket.c \
./src/low-level/nntp/newsnntp_ssl.c \
./src/low-level/pop3/mailpop3.c \
./src/low-level/pop3/mailpop3_helper.c \
./src/low-level/pop3/mailpop3_socket.c \
./src/low-level/pop3/mailpop3_ssl.c \
./src/low-level/smtp/mailsmtp.c \
./src/low-level/smtp/mailsmtp_helper.c \
./src/low-level/smtp/mailsmtp_oauth2.c \
./src/low-level/smtp/mailsmtp_socket.c \
./src/low-level/smtp/mailsmtp_ssl.c \
./src/main/libetpan_version.c
NDK_TOOLCHAIN_VERSION := clang
LOCAL_MODULE := etpan
LOCAL_SRC_FILES := $(addprefix ../../, $(src_files))
#LOCAL_LDLIBS += -L$(ANDROID_NDK)/sources/cxx-stl/llvm-libc++/libs/$(TARGET_ARCH_ABI)
LOCAL_CFLAGS += -DHAVE_SYS_MMAN_H=1 -DUSE_SSL=1
c_includes = \
src \
src/data-types \
src/low-level \
src/low-level/imap \
src/low-level/imf \
src/low-level/mime \
src/low-level/nntp \
src/low-level/pop3 \
src/low-level/smtp \
src/main
LOCAL_C_INCLUDES = $(addprefix ../../, $(c_includes)) \
$(LOCAL_PATH)/../include $(LOCAL_PATH)/../include/libetpan \
$(OPENSSL_PATH)/include $(CYRUS_SASL_PATH)/include
include $(BUILD_STATIC_LIBRARY)

Loading…
Cancel
Save