aboutsummaryrefslogtreecommitdiff
path: root/mail/thunderbird/files/patch-bug807492
blob: f486428a2a4d52887d914209a8e2b6112cbd8ff5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
JJdiff --git configure.in configure.in
index c167461..8346c11 100644
--- mozilla/configure.in
+++ mozilla/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
--- mozilla/media/mtransport/objs.mk
+++ mozilla/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
--- mozilla/media/mtransport/test/Makefile.in
+++ mozilla/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
--- mozilla/media/mtransport/third_party/nICEr/nicer.gyp
+++ mozilla/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
--- mozilla/media/mtransport/third_party/nICEr/src/stun/addrs.c
+++ mozilla/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 <syslog.h>
 /* Work around an Android NDK < r8c bug */
 #undef __unused
 #include <linux/sysctl.h>
 #endif
 #include <net/if.h>
 #ifndef LINUX
+#if !defined(__OpenBSD__) && !defined(__NetBSD__)
 #include <net/if_var.h>
+#endif
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #include <sys/sockio.h>
 #else
 #include <linux/if.h>
 #endif
 #include <net/route.h>
 
@@ -75,17 +77,17 @@ static char *RCSSTRING __UNUSED__="$Id: addrs.c,v 1.2 2008/04/28 18:21:30 ekr Ex
 #include <netdb.h>
 #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
--- mozilla/media/mtransport/third_party/nICEr/src/stun/stun.h
+++ mozilla/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 <winsock2.h>
 #else
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <net/if.h>
 #ifndef LINUX
+#if !defined(__OpenBSD__) && !defined(__NetBSD__)
 #include <net/if_var.h>
+#endif
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #endif
+#ifndef BSD
 #include <net/route.h>
+#endif
 #include <netinet/in.h>
 #ifndef LINUX
 #include <netinet/in_var.h>
 #endif
 #include <arpa/inet.h>
 #include <netdb.h>
 #endif
 #include <time.h>
diff --git media/mtransport/third_party/nICEr/src/util/mbslen.c media/mtransport/third_party/nICEr/src/util/mbslen.c
index cc260b7..66af2d7 100644
--- mozilla/media/mtransport/third_party/nICEr/src/util/mbslen.c
+++ mozilla/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 <errno.h>
 #include <csi_platform.h>
 
 #include <assert.h>
 #include <locale.h>
 #include <stdlib.h>
 #include <wchar.h>
-#ifdef DARWIN
+
+#ifdef __FreeBSD__
+#include <osreldate.h>
+# if __FreeBSD_version > 900505
+#  define HAVE_XLOCALE
+# endif
+#endif
+
+#ifdef HAVE_XLOCALE
 #include <xlocale.h>
-#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
--- mozilla/media/mtransport/third_party/nrappkit/nrappkit.gyp
+++ mozilla/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
--- mozilla/media/mtransport/third_party/nrappkit/src/log/r_log.c
+++ mozilla/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 <string.h>
+#include <errno.h>
 #ifndef _MSC_VER
 #include <strings.h>
 #include <syslog.h>
 #endif
 #include <registry.h>
 #include <time.h>
 
 
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
--- mozilla/media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
+++ mozilla/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 <stddef.h>
 #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
--- mozilla/media/mtransport/third_party/nrappkit/src/util/util.c
+++ mozilla/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 <sys/uio.h>
 #include <pwd.h>
 #include <dirent.h>
 #endif
 #include <string.h>
+#include <errno.h>
 #include <ctype.h>
 #include <sys/stat.h>
 #ifdef OPENSSL
 #include <openssl/evp.h>
 #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
--- mozilla/media/webrtc/signaling/signaling.gyp
+++ mozilla/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
--- mozilla/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c
+++ mozilla/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
--- mozilla/media/webrtc/signaling/test/Makefile.in
+++ mozilla/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
--- mozilla/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
+++ mozilla/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