Bug 1349912 Do not use win32 local includes for libstagefright on MinGW build
This duplicates all the win32 includes except pthread.h into a new directory
for MinGW. MinGW needs all the same dummy includes _except_ it needs its
own pthread.h for winpthreads.
MozReview-Commit-ID: AlIvHhFoSIS
--- a/media/libstagefright/moz.build
+++ b/media/libstagefright/moz.build
@@ -16,17 +16,20 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CO
if CONFIG['OS_TARGET'] == 'WINNT':
if CONFIG['_MSC_VER']:
DEFINES['ssize_t'] = 'intptr_t'
DEFINES['off64_t'] = 'int64_t'
DEFINES['strcasecmp'] = 'stricmp'
DEFINES['strncasecmp'] = 'strnicmp'
DEFINES['HAVE_MS_C_RUNTIME'] = True
DEFINES['__PRETTY_FUNCTION__'] = '__FUNCTION__'
- LOCAL_INCLUDES += [ 'ports/win32/include' ]
+ if CONFIG['CC_TYPE'] == 'gcc':
+ LOCAL_INCLUDES += [ 'ports/mingw32/include' ]
+ else:
+ LOCAL_INCLUDES += [ 'ports/win32/include' ]
elif CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['HAVE_SYS_UIO_H'] = True
DEFINES['off64_t'] = 'off_t'
LOCAL_INCLUDES += [ 'ports/darwin/include' ]
elif CONFIG['OS_TARGET'] in ('DragonFly', 'FreeBSD', 'OpenBSD', 'NetBSD',
'GNU/kFreeBSD'):
if CONFIG['OS_TARGET'] != 'NetBSD':
DEFINES['ENODATA'] = '-0x80000003'
new file mode 100644
--- /dev/null
+++ b/media/libstagefright/ports/mingw32/include/arpa/inet.h
@@ -0,0 +1,9 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+#ifndef INET_H_
+#define INET_H_
+
+#include <netinet/in.h>
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/libstagefright/ports/mingw32/include/byteswap.h
@@ -0,0 +1,10 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+#ifndef BYTESWAP_H_
+#define BYTESWAP_H_
+
+#include <stdlib.h>
+#define bswap_16 _byteswap_ushort
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/libstagefright/ports/mingw32/include/netinet/in.h
@@ -0,0 +1,39 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+#ifndef IN_H_
+#define IN_H_
+
+#include <stdint.h>
+
+#if defined(_M_IX86) || defined(_M_AMD64)
+
+static uint32_t
+ntohl(uint32_t x)
+{
+ return x << 24 | (x << 8 & 0xff0000) | (x >> 8 & 0xff00) | x >> 24;
+}
+
+static uint16_t
+ntohs(uint16_t x)
+{
+ return x << 8 | x >> 8;
+}
+
+static uint32_t
+htonl(uint32_t x)
+{
+ return x << 24 | (x << 8 & 0xff0000) | (x >> 8 & 0xff00) | x >> 24;
+}
+
+static uint16_t
+htons(uint16_t x)
+{
+ return x << 8 | x >> 8;
+}
+
+#else
+#error Unsupported architecture
+#endif
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/libstagefright/ports/mingw32/include/sys/cdefs.h
@@ -0,0 +1,1 @@
+// Intentionally left blank
new file mode 100644
--- /dev/null
+++ b/media/libstagefright/ports/mingw32/include/sys/time.h
@@ -0,0 +1,9 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+#ifndef TIME_H_
+#define TIME_H_
+
+#include <time.h>
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/libstagefright/ports/mingw32/include/unistd.h
@@ -0,0 +1,1 @@
+// Intentionally left blank