]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Support Android 5.1
authorBen Efrati <ben1189@gmail.com>
Tue, 22 Mar 2016 09:05:53 +0000 (11:05 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 23 Mar 2016 10:53:21 +0000 (11:53 +0100)
Fix some compilation error when compiling with android-21.

Makefile
src/compat.h
src/tvheadend.h

index 1e12a60846d4d06cb73a491f044bf19260a77aae..97f7ae9b4fd5855fd7db583565d328839c730b4c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ CFLAGS  += -fms-extensions -funsigned-char -fno-strict-aliasing
 CFLAGS  += -D_FILE_OFFSET_BITS=64
 CFLAGS  += -I${BUILDDIR} -I${ROOTDIR}/src -I${ROOTDIR}
 ifeq ($(CONFIG_ANDROID),yes)
-LDFLAGS += -ldl -lm
+LDFLAGS += -ldl -lm -fPIE -pie
 else
 LDFLAGS += -ldl -lpthread -lm
 endif
index 61027de27798106391a3f7971beac490ea719e00..34312207b440863b538998029b073484cbc77ac1 100644 (file)
 #define COMPAT_H
 
 #if ENABLE_ANDROID
+#ifndef strdupa
+#define strdupa(s)                                                            \
+    ({                                                                        \
+      const char *__old = (s);                                                \
+      size_t __len = strlen(__old) + 1;                                       \
+      char *__new = (char *) alloca(__len);                                   \
+      (char *) memcpy(__new, __old, __len);                                   \
+    })
+#endif
+#ifndef index
+#define index(...) strchr(__VA_ARGS__)
+#endif
 #define S_IEXEC S_IXUSR
 #define epoll_create1(EPOLL_CLOEXEC) epoll_create(n)
 #define inotify_init1(IN_CLOEXEC) inotify_init()
 #include <time64.h>
 // 32-bit Android has only timegm64() and not timegm().
 // We replicate the behaviour of timegm() when the result overflows time_t.
-static inline time_t timegm(struct tm* const t);
-time_t timegm(struct tm* const t) {
-  // time_t is signed on Android.
-  static const time_t kTimeMax = ~(1L << (sizeof(time_t) * CHAR_BIT - 1));
-  static const time_t kTimeMin = (1L << (sizeof(time_t) * CHAR_BIT - 1));
-  time64_t result = timegm64(t);
-  if (result < kTimeMin || result > kTimeMax)
-    return -1;
-  return result;
-}
 
 #define        IPTOS_DSCP_MASK         0xfc
 #define        IPTOS_DSCP(x)           ((x) & IPTOS_DSCP_MASK)
index 8c067ed2733ad0c141bc94996601bbe5c221a45d..1f3747e9832de8c769125e1cd54862ba32661188 100644 (file)
 #include <limits.h>
 #if ENABLE_LOCKOWNER || ENABLE_ANDROID
 #include <sys/syscall.h>
-#if ENABLE_ANDROID
-#ifndef strdupa
-#define strdupa(s)                                                            \
-    ({                                                                        \
-      const char *__old = (s);                                                \
-      size_t __len = strlen(__old) + 1;                                       \
-      char *__new = (char *) alloca(__len);                                   \
-      (char *) memcpy(__new, __old, __len);                                   \
-    })
-#endif
-#endif
 #endif
 #include "queue.h"
 #include "hts_strtab.h"