tinydtls: fix and activate android debug.c build
authorHauke Mehrtens <hauke.mehrtens@lantiq.com>
Mon, 28 Sep 2015 09:02:53 +0000 (11:02 +0200)
committerSachin Agrawal <sachin.agrawal@intel.com>
Thu, 1 Oct 2015 23:52:49 +0000 (23:52 +0000)
This patch activates the build of debug.c on android and also fixes one
build issue with this code in android.

in_port_t is not defined in <netinet/in.h> in the android NDK, use
"unsigned short int" instead because this is also used by sin_port in
the Android NDK.
There is already a bug for Android open to fix this problem in Android
here: https://code.google.com/p/android/issues/detail?id=80713

With this change the tinydtls debug.c file compiles for me for Android.

Change-Id: Id03a319768357ea1bef3f86ac2342e61e2b26b79
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3195
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
extlibs/tinydtls/SConscript
extlibs/tinydtls/debug.c

index 7ca5ae2..1f3c2a7 100644 (file)
@@ -61,7 +61,7 @@ tinydtls_src = [
 env.AppendUnique(TINYDTLS_SRC = tinydtls_src)
 
 if not env.get('RELEASE'):
-       if(target_os) not in ['android', 'arduino']:
+       if(target_os) not in ['arduino']:
                env.AppendUnique(TINYDTLS_SRC = ['debug.c'])
        else:
                env.AppendUnique(CPPDEFINES = ['NDEBUG'])
index 2726833..589c091 100644 (file)
@@ -134,7 +134,11 @@ static size_t
 dsrv_print_addr(const session_t *addr, char *buf, size_t len) {
 #ifdef HAVE_ARPA_INET_H
   const void *addrptr = NULL;
+#ifdef __ANDROID__
+  unsigned short int port;
+#else
   in_port_t port;
+#endif
   char *p = buf;
 
   switch (addr->addr.sa.sa_family) {