JJdiff --git configure.in configure.in index c167461..8346c11 100644 --- configure.in +++ configure.in @@ -5246,17 +5246,17 @@ if test "$NS_PRINTING"; then AC_DEFINE(NS_PRINT_PREVIEW) fi dnl Turn off webrtc for OS's we don't handle yet, but allow dnl --enable-webrtc to override. Can disable for everything in dnl the master list above. if test -n "$MOZ_WEBRTC"; then case "$target" in - *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*) + *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*) dnl Leave enabled ;; *) dnl default to disabled for all others MOZ_WEBRTC= ;; esac fi diff --git media/mtransport/objs.mk media/mtransport/objs.mk index f1fc85f..141e8ca 100644 --- media/mtransport/objs.mk +++ media/mtransport/objs.mk @@ -18,22 +18,26 @@ LOCAL_INCLUDES += \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/util/libekr \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/log \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/registry \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/stats \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/plugin \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/event \ $(NULL) -ifeq ($(OS_TARGET), Darwin) +ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET))) LOCAL_INCLUDES += \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include \ $(NULL) +ifeq ($(OS_TARGET), Darwin) DEFINES += -DDARWIN +else +DEFINES += -DBSD +endif endif ifeq ($(OS_TARGET), Linux) LOCAL_INCLUDES += \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include \ $(NULL) DEFINES += -DLINUX diff --git media/mtransport/test/Makefile.in media/mtransport/test/Makefile.in index c1d5bf4..2ecf2c7 100644 --- media/mtransport/test/Makefile.in +++ media/mtransport/test/Makefile.in @@ -73,22 +73,24 @@ DEFINES += -D__Userspace_os_FreeBSD=1 else #default_fallback; probably doesn't work DEFINES += -D__Userspace_os_$(OS_TARGET)=1 endif endif endif endif -ifeq ($(OS_TARGET), Darwin) +ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET))) LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include +ifeq ($(OS_TARGET), Darwin) DEFINES += \ -DGTEST_USE_OWN_TR1_TUPLE=1 \ $(NULL) endif +endif ifeq ($(OS_TARGET), Linux) LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include endif ifeq ($(OS_TARGET), Android) LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/android/include diff --git media/mtransport/third_party/nICEr/nicer.gyp media/mtransport/third_party/nICEr/nicer.gyp index 0e1f8b4..9a4b995 100644 --- media/mtransport/third_party/nICEr/nicer.gyp +++ media/mtransport/third_party/nICEr/nicer.gyp @@ -126,26 +126,36 @@ 'R_DEFINED_UINT2=uint16_t', 'R_DEFINED_INT4=int32_t', 'R_DEFINED_UINT4=uint32_t', 'R_DEFINED_INT8=int64_t', 'R_DEFINED_UINT8=uint64_t', ], 'conditions' : [ - ## Mac + ## Mac and BSDs [ 'OS == "mac"', { + 'defines' : [ + 'DARWIN', + 'HAVE_XLOCALE', + ], + }], + [ 'os_bsd == 1', { + 'defines' : [ + 'BSD', + ], + }], + [ 'OS == "mac" or os_bsd == 1', { 'cflags_mozilla': [ '-Wall', '-Wno-parentheses', '-Wno-strict-prototypes', '-Wmissing-prototypes', ], 'defines' : [ - 'DARWIN', 'HAVE_LIBM=1', 'HAVE_STRDUP=1', 'HAVE_STRLCPY=1', 'HAVE_SYS_TIME_H=1', 'HAVE_VFPRINTF=1', 'NEW_STDIO' 'RETSIGTYPE=void', 'TIME_WITH_SYS_TIME_H=1', diff --git media/mtransport/third_party/nICEr/src/stun/addrs.c media/mtransport/third_party/nICEr/src/stun/addrs.c index b0b66b2..04fea94 100644 --- media/mtransport/third_party/nICEr/src/stun/addrs.c +++ media/mtransport/third_party/nICEr/src/stun/addrs.c @@ -50,17 +50,19 @@ static char *RCSSTRING __UNUSED__="$Id: addrs.c,v 1.2 2008/04/28 18:21:30 ekr Ex #else #include /* Work around an Android NDK < r8c bug */ #undef __unused #include #endif #include #ifndef LINUX +#if !defined(__OpenBSD__) && !defined(__NetBSD__) #include +#endif #include #include #include #else #include #endif #include @@ -75,17 +77,17 @@ static char *RCSSTRING __UNUSED__="$Id: addrs.c,v 1.2 2008/04/28 18:21:30 ekr Ex #include #endif /* UNIX */ #include "stun.h" #include "addrs.h" -#ifdef DARWIN +#if defined(BSD) || defined(DARWIN) /* * Copyright (c) 1983, 1993 * The Regents of the University of California. 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 @@ -685,17 +687,17 @@ nr_stun_remove_duplicate_addrs(nr_transport_addr addrs[], int remove_loopback, i } int nr_stun_get_addrs(nr_transport_addr addrs[], int maxaddrs, int drop_loopback, int *count) { int _status=0; int i; -#ifdef DARWIN +#if defined(BSD) || defined(DARWIN) _status = stun_get_mib_addrs(addrs, maxaddrs, count); #elif defined(WIN32) _status = stun_get_win32_addrs(addrs, maxaddrs, count); #elif defined(__sparc__) _status = stun_get_sparc_addrs(addrs, maxaddrs, count); #else _status = stun_get_siocgifconf_addrs(addrs, maxaddrs, count); #endif diff --git media/mtransport/third_party/nICEr/src/stun/stun.h media/mtransport/third_party/nICEr/src/stun/stun.h index a3c51f9..eb65ac8 100644 --- media/mtransport/third_party/nICEr/src/stun/stun.h +++ media/mtransport/third_party/nICEr/src/stun/stun.h @@ -36,21 +36,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifdef WIN32 #include #else #include #include #include #ifndef LINUX +#if !defined(__OpenBSD__) && !defined(__NetBSD__) #include +#endif #include #include #endif +#ifndef BSD #include +#endif #include #ifndef LINUX #include #endif #include #include #endif #include diff --git media/mtransport/third_party/nICEr/src/util/mbslen.c media/mtransport/third_party/nICEr/src/util/mbslen.c index cc260b7..66af2d7 100644 --- media/mtransport/third_party/nICEr/src/util/mbslen.c +++ media/mtransport/third_party/nICEr/src/util/mbslen.c @@ -38,50 +38,58 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include #include #include #include -#ifdef DARWIN + +#ifdef __FreeBSD__ +#include +# if __FreeBSD_version > 900505 +# define HAVE_XLOCALE +# endif +#endif + +#ifdef HAVE_XLOCALE #include -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ #include "nr_api.h" #include "mbslen.h" /* get number of characters in a mult-byte character string */ int mbslen(const char *s, size_t *ncharsp) { -#ifdef DARWIN +#ifdef HAVE_XLOCALE static locale_t loc = 0; static int initialized = 0; -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ #ifdef WIN32 char *my_locale=0; unsigned int i; #endif /* WIN32 */ int _status; size_t nbytes; int nchars; mbstate_t mbs; -#ifdef DARWIN +#ifdef HAVE_XLOCALE if (! initialized) { initialized = 1; loc = newlocale(LC_CTYPE_MASK, "UTF-8", LC_GLOBAL_LOCALE); } if (loc == 0) { /* unable to create the UTF-8 locale */ assert(loc != 0); /* should never happen */ -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ #ifdef WIN32 if (!setlocale(LC_CTYPE, 0)) ABORT(R_INTERNAL); if (!(my_locale = r_strdup(setlocale(LC_CTYPE, 0)))) ABORT(R_NO_MEMORY); @@ -94,28 +102,28 @@ mbslen(const char *s, size_t *ncharsp) /* can't count UTF-8 characters with mbrlen if the locale isn't UTF-8 */ /* null-checking setlocale is required because Android */ char *locale = setlocale(LC_CTYPE, 0); /* some systems use "utf8" instead of "UTF-8" like Fedora 17 */ if (!locale || (!strcasestr(locale, "UTF-8") && !strcasestr(locale, "UTF8"))) ABORT(R_NOT_FOUND); #endif -#ifdef DARWIN +#ifdef HAVE_XLOCALE } -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ memset(&mbs, 0, sizeof(mbs)); nchars = 0; -#ifdef DARWIN +#ifdef HAVE_XLOCALE while (*s != '\0' && (nbytes = mbrlen_l(s, strlen(s), &mbs, loc)) != 0) #else while (*s != '\0' && (nbytes = mbrlen(s, strlen(s), &mbs)) != 0) -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ { if (nbytes == (size_t)-1) /* should never happen */ { ABORT(R_INTERNAL); } if (nbytes == (size_t)-2) /* encoding error */ { ABORT(R_BAD_DATA); } diff --git media/mtransport/third_party/nrappkit/nrappkit.gyp media/mtransport/third_party/nrappkit/nrappkit.gyp index 3cc8e1c..74016c6 100644 --- media/mtransport/third_party/nrappkit/nrappkit.gyp +++ media/mtransport/third_party/nrappkit/nrappkit.gyp @@ -142,26 +142,35 @@ 'R_DEFINED_UINT2=uint16_t', 'R_DEFINED_INT4=int32_t', 'R_DEFINED_UINT4=uint32_t', 'R_DEFINED_INT8=int64_t', 'R_DEFINED_UINT8=uint64_t', ], 'conditions' : [ - ## Mac + ## Mac and BSDs [ 'OS == "mac"', { + 'defines' : [ + 'DARWIN', + ], + }], + [ 'os_bsd == 1', { + 'defines' : [ + 'BSD', + ], + }], + [ 'OS == "mac" or os_bsd == 1', { 'cflags_mozilla': [ '-Wall', '-Wno-parentheses', '-Wno-strict-prototypes', '-Wmissing-prototypes', ], 'defines' : [ - 'DARWIN', 'HAVE_LIBM=1', 'HAVE_STRDUP=1', 'HAVE_STRLCPY=1', 'HAVE_SYS_TIME_H=1', 'HAVE_VFPRINTF=1', 'NEW_STDIO' 'RETSIGTYPE=void', 'TIME_WITH_SYS_TIME_H=1', diff --git media/mtransport/third_party/nrappkit/src/log/r_log.c media/mtransport/third_party/nrappkit/src/log/r_log.c index efb7ef2..aebf578 100644 --- media/mtransport/third_party/nrappkit/src/log/r_log.c +++ media/mtransport/third_party/nrappkit/src/log/r_log.c @@ -43,16 +43,17 @@ static char *RCSSTRING __UNUSED__ ="$Id: r_log.c,v 1.10 2008/11/25 22:25:18 adam #ifdef LINUX #define _BSD_SOURCE #endif #include "r_log.h" #include "hex.h" #include +#include #ifndef _MSC_VER #include #include #endif #include #include diff --git media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h index bcb1ec0..bb73591 100644 --- media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h +++ media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h @@ -33,7 +33,7 @@ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ -#ifndef DARWIN +#if !defined(__FreeBSD__) && !defined(DARWIN) #include #define __offsetof offsetof #endif diff --git media/mtransport/third_party/nrappkit/src/util/util.c media/mtransport/third_party/nrappkit/src/util/util.c index a7d4ff1..ff11a60 100644 --- media/mtransport/third_party/nrappkit/src/util/util.c +++ media/mtransport/third_party/nrappkit/src/util/util.c @@ -40,16 +40,17 @@ static char *RCSSTRING __UNUSED__ ="$Id: util.c,v 1.5 2007/11/21 00:09:13 adamcain Exp $"; #ifndef WIN32 #include #include #include #endif #include +#include #include #include #ifdef OPENSSL #include #endif #include "nr_common.h" #include "r_common.h" #include "registry.h" diff --git media/webrtc/signaling/signaling.gyp media/webrtc/signaling/signaling.gyp index 2a91e3d..31de641 100644 --- media/webrtc/signaling/signaling.gyp +++ media/webrtc/signaling/signaling.gyp @@ -212,16 +212,29 @@ 'SIPCC_BUILD', 'HAVE_WINSOCK2_H', 'CPR_STDINT_INCLUDE=\\"mozilla/StandardInteger.h\\"' ], 'cflags_mozilla': [ ], }], + ['os_bsd==1', { + 'include_dirs': [ + ], + 'defines': [ + # avoiding pointless ifdef churn + 'SIP_OS_OSX', + 'OSX', + 'SECLIB_OPENSSL', + ], + + 'cflags_mozilla': [ + ], + }], ['OS=="mac"', { 'include_dirs': [ ], 'defines': [ 'SIP_OS_OSX', 'OSX', '_FORTIFY_SOURCE=2', ], @@ -747,17 +760,17 @@ 'EXTERNAL_TICK_REQUIRED', 'GIPS_VER=3480', ], 'cflags_mozilla': [ ], }], - ['OS=="mac"', { + ['OS=="mac" or os_bsd==1', { 'include_dirs': [ ], 'sources': [ # SIPSTACK './src/sipcc/core/sipstack/sip_platform_task.c', @@ -792,24 +805,23 @@ './src/sipcc/cpr/darwin/cpr_darwin_timers_using_select.c', './src/sipcc/cpr/darwin/cpr_darwin_tst.h', './src/sipcc/cpr/darwin/cpr_darwin_types.h', ], 'defines' : [ 'SIP_OS_OSX', - '_POSIX_SOURCE', + # using BSD extensions, leave _POSIX_SOURCE undefined 'CPR_MEMORY_LITTLE_ENDIAN', 'NO_SOCKET_POLLING', 'USE_TIMER_SELECT_BASED', 'FULL_BUILD', 'STUBBED_OUT', 'USE_PRINTF', - '_DARWIN_C_SOURCE', 'NO_NSPR_10_SUPPORT', ], 'cflags_mozilla': [ ], }], ], diff --git media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c index a7c47e1..4f191de 100644 --- media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c +++ media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c @@ -317,21 +317,25 @@ cprGetMessage (cprMsgQueue_t msgQueue, boolean waitForever, void **ppUserData) { static const char fname[] = "cprGetMessage"; void *buffer = 0; cpr_msg_queue_t *msgq; cpr_msgq_node_t *node; struct timespec timeout; struct timeval tv; +#ifndef __APPLE__ + struct timezone tz; +#else // On the iPhone, there is a DarwinAlias problem with "timezone" struct _timezone { int tz_minuteswest; /* of Greenwich */ int tz_dsttime; /* type of dst correction to apply */ } tz; +#endif /* Initialize ppUserData */ if (ppUserData) { *ppUserData = NULL; } msgq = (cpr_msg_queue_t *) msgQueue; if (msgq == NULL) { diff --git media/webrtc/signaling/test/Makefile.in media/webrtc/signaling/test/Makefile.in index a30e330..cfbd8a3 100644 --- media/webrtc/signaling/test/Makefile.in +++ media/webrtc/signaling/test/Makefile.in @@ -81,17 +81,17 @@ endif ifeq (qt,$(MOZ_WIDGET_TOOLKIT)) LIBS += \ $(XLIBS) \ $(TK_LIBS) \ $(MOZ_PANGO_LIBS) \ $(NULL) endif -ifeq ($(OS_TARGET),Linux) +ifneq (,$(filter Linux DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET))) LIBS += \ $(MOZ_CAIRO_OSLIBS) \ $(NULL) endif ifeq ($(OS_TARGET),Darwin) LIBS += \ -framework AudioToolbox \ diff --git media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py index 338d0b7..2241d41 100644 --- media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py +++ media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py @@ -1,16 +1,17 @@ # Copyright (c) 2012 Mozilla Foundation. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import collections import gyp import gyp.common import sys +import platform import os import re import shlex generator_wants_sorted_dependencies = True generator_default_variables = { } @@ -107,30 +108,44 @@ endif def ensure_directory_exists(path): dir = os.path.dirname(path) if dir and not os.path.exists(dir): os.makedirs(dir) def GetFlavor(params): """Returns |params.flavor| if it's set, the system's default flavor else.""" + system = platform.system().lower() flavors = { - 'win32': 'win', - 'darwin': 'mac', - 'sunos5': 'solaris', - 'freebsd7': 'freebsd', - 'freebsd8': 'freebsd', + 'microsoft': 'win', + 'windows' : 'win', + 'darwin' : 'mac', + 'sunos' : 'solaris', + 'dragonfly': 'bsd', + 'freebsd' : 'bsd', + 'netbsd' : 'bsd', + 'openbsd' : 'bsd', } - flavor = flavors.get(sys.platform, 'linux') - return params.get('flavor', flavor) + + if 'flavor' in params: + return params['flavor'] + if system.startswith('cygwin'): + return 'win' + if system in flavors: + return flavors[system] + + return 'linux' def CalculateVariables(default_variables, params): + flavor = GetFlavor(params) + if flavor == 'bsd': + flavor = platform.system().lower() generator_flags = params.get('generator_flags', {}) - default_variables['OS'] = generator_flags.get('os', GetFlavor(params)) + default_variables['OS'] = generator_flags.get('os', flavor) def CalculateGeneratorInputInfo(params): """Calculate the generator specific info that gets fed to input (called by gyp).""" generator_flags = params.get('generator_flags', {}) if generator_flags.get('adjust_static_libraries', False): global generator_wants_static_library_dependencies_adjusted