1# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS.  All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9{
10  'includes': [ '../build/common.gypi', ],
11  'conditions': [
12    ['os_posix == 1 and OS != "mac" and OS != "ios"', {
13      'conditions': [
14        ['sysroot!=""', {
15          'variables': {
16            'pkg-config': '../../../build/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)"',
17          },
18        }, {
19          'variables': {
20            'pkg-config': 'pkg-config'
21          },
22        }],
23      ],
24    }],
25  ],
26  'targets': [
27    {
28      'target_name': 'webrtc_base',
29      'type': 'static_library',
30      'defines': [
31        'FEATURE_ENABLE_SSL',
32        'GTEST_RELATIVE_PATH',
33        'LOGGING=1',
34        'USE_WEBRTC_DEV_BRANCH',
35      ],
36      'sources': [
37        'asyncfile.cc',
38        'asyncfile.h',
39        'asynchttprequest.cc',
40        'asynchttprequest.h',
41        'asyncinvoker.cc',
42        'asyncinvoker.h',
43        'asyncinvoker-inl.h',
44        'asyncpacketsocket.h',
45        'asyncresolverinterface.h',
46        'asyncsocket.cc',
47        'asyncsocket.h',
48        'asynctcpsocket.cc',
49        'asynctcpsocket.h',
50        'asyncudpsocket.cc',
51        'asyncudpsocket.h',
52        'atomicops.h',
53        'autodetectproxy.cc',
54        'autodetectproxy.h',
55        'bandwidthsmoother.cc',
56        'bandwidthsmoother.h',
57        'base64.cc',
58        'base64.h',
59        'basicdefs.h',
60        'basictypes.h',
61        'bind.h',
62        'bind.h.pump',
63        'buffer.h',
64        'bytebuffer.cc',
65        'bytebuffer.h',
66        'byteorder.h',
67        'callback.h',
68        'callback.h.pump',
69        'checks.cc',
70        'checks.h',
71        'common.cc',
72        'common.h',
73        'constructormagic.h',
74        'cpumonitor.cc',
75        'cpumonitor.h',
76        'crc32.cc',
77        'crc32.h',
78        'criticalsection.h',
79        'cryptstring.h',
80        'dbus.cc',
81        'dbus.h',
82        'diskcache.cc',
83        'diskcache.h',
84        'diskcache_win32.cc',
85        'diskcache_win32.h',
86        'event.cc',
87        'event.h',
88        'filelock.cc',
89        'filelock.h',
90        'fileutils.cc',
91        'fileutils.h',
92        'fileutils_mock.h',
93        'firewallsocketserver.cc',
94        'firewallsocketserver.h',
95        'flags.cc',
96        'flags.h',
97        'gunit_prod.h',
98        'helpers.cc',
99        'helpers.h',
100        'httpbase.cc',
101        'httpbase.h',
102        'httpclient.cc',
103        'httpclient.h',
104        'httpcommon-inl.h',
105        'httpcommon.cc',
106        'httpcommon.h',
107        'httprequest.cc',
108        'httprequest.h',
109        'httpserver.cc',
110        'httpserver.h',
111        'ifaddrs-android.cc',
112        'ifaddrs-android.h',
113        'iosfilesystem.mm',
114        'ipaddress.cc',
115        'ipaddress.h',
116        'json.cc',
117        'json.h',
118        'latebindingsymboltable.cc',
119        'latebindingsymboltable.cc.def',
120        'latebindingsymboltable.h',
121        'latebindingsymboltable.h.def',
122        'libdbusglibsymboltable.cc',
123        'libdbusglibsymboltable.h',
124        'linux.cc',
125        'linux.h',
126        'linuxfdwalk.c',
127        'linuxfdwalk.h',
128        'linuxwindowpicker.cc',
129        'linuxwindowpicker.h',
130        'linked_ptr.h',
131        'logging.cc',
132        'logging.h',
133        'macasyncsocket.cc',
134        'macasyncsocket.h',
135        'maccocoasocketserver.h',
136        'maccocoasocketserver.mm',
137        'maccocoathreadhelper.h',
138        'maccocoathreadhelper.mm',
139        'macconversion.cc',
140        'macconversion.h',
141        'macsocketserver.cc',
142        'macsocketserver.h',
143        'macutils.cc',
144        'macutils.h',
145        'macwindowpicker.cc',
146        'macwindowpicker.h',
147        'mathutils.h',
148        'md5.cc',
149        'md5.h',
150        'md5digest.h',
151        'messagedigest.cc',
152        'messagedigest.h',
153        'messagehandler.cc',
154        'messagehandler.h',
155        'messagequeue.cc',
156        'messagequeue.h',
157        'multipart.cc',
158        'multipart.h',
159        'natserver.cc',
160        'natserver.h',
161        'natsocketfactory.cc',
162        'natsocketfactory.h',
163        'nattypes.cc',
164        'nattypes.h',
165        'nethelpers.cc',
166        'nethelpers.h',
167        'network.cc',
168        'network.h',
169        'nssidentity.cc',
170        'nssidentity.h',
171        'nssstreamadapter.cc',
172        'nssstreamadapter.h',
173        'nullsocketserver.h',
174        'openssl.h',
175        'openssladapter.cc',
176        'openssladapter.h',
177        'openssldigest.cc',
178        'openssldigest.h',
179        'opensslidentity.cc',
180        'opensslidentity.h',
181        'opensslstreamadapter.cc',
182        'opensslstreamadapter.h',
183        'optionsfile.cc',
184        'optionsfile.h',
185        'pathutils.cc',
186        'pathutils.h',
187        'physicalsocketserver.cc',
188        'physicalsocketserver.h',
189        'posix.cc',
190        'posix.h',
191        'profiler.cc',
192        'profiler.h',
193        'proxydetect.cc',
194        'proxydetect.h',
195        'proxyinfo.cc',
196        'proxyinfo.h',
197        'proxyserver.cc',
198        'proxyserver.h',
199        'ratelimiter.cc',
200        'ratelimiter.h',
201        'ratetracker.cc',
202        'ratetracker.h',
203        'refcount.h',
204        'referencecountedsingletonfactory.h',
205        'rollingaccumulator.h',
206        'safe_conversions.h',
207        'safe_conversions_impl.h',
208        'schanneladapter.cc',
209        'schanneladapter.h',
210        'scoped_autorelease_pool.h',
211        'scoped_autorelease_pool.mm',
212        'scoped_ptr.h',
213        'scoped_ref_ptr.h',
214        'scopedptrcollection.h',
215        'sec_buffer.h',
216        'sha1.cc',
217        'sha1.h',
218        'sha1digest.h',
219        'sharedexclusivelock.cc',
220        'sharedexclusivelock.h',
221        'signalthread.cc',
222        'signalthread.h',
223        'sigslot.h',
224        'sigslotrepeater.h',
225        'socket.h',
226        'socketadapters.cc',
227        'socketadapters.h',
228        'socketaddress.cc',
229        'socketaddress.h',
230        'socketaddresspair.cc',
231        'socketaddresspair.h',
232        'socketfactory.h',
233        'socketpool.cc',
234        'socketpool.h',
235        'socketserver.h',
236        'socketstream.cc',
237        'socketstream.h',
238        'ssladapter.cc',
239        'ssladapter.h',
240        'sslconfig.h',
241        'sslfingerprint.cc',
242        'sslfingerprint.h',
243        'sslidentity.cc',
244        'sslidentity.h',
245        'sslroots.h',
246        'sslsocketfactory.cc',
247        'sslsocketfactory.h',
248        'sslstreamadapter.cc',
249        'sslstreamadapter.h',
250        'sslstreamadapterhelper.cc',
251        'sslstreamadapterhelper.h',
252        'stream.cc',
253        'stream.h',
254        'stringdigest.h',
255        'stringencode.cc',
256        'stringencode.h',
257        'stringutils.cc',
258        'stringutils.h',
259        'systeminfo.cc',
260        'systeminfo.h',
261        'task.cc',
262        'task.h',
263        'taskparent.cc',
264        'taskparent.h',
265        'taskrunner.cc',
266        'taskrunner.h',
267        'testclient.cc',
268        'testclient.h',
269        'thread.cc',
270        'thread.h',
271        'thread_checker.h',
272        'thread_checker_impl.cc',
273        'thread_checker_impl.h',
274        'timeutils.cc',
275        'timeutils.h',
276        'timing.cc',
277        'timing.h',
278        'transformadapter.cc',
279        'transformadapter.h',
280        'unixfilesystem.cc',
281        'unixfilesystem.h',
282        'urlencode.cc',
283        'urlencode.h',
284        'versionparsing.cc',
285        'versionparsing.h',
286        'virtualsocketserver.cc',
287        'virtualsocketserver.h',
288        'win32.cc',
289        'win32.h',
290        'win32filesystem.cc',
291        'win32filesystem.h',
292        'win32regkey.cc',
293        'win32regkey.h',
294        'win32securityerrors.cc',
295        'win32socketinit.cc',
296        'win32socketinit.h',
297        'win32socketserver.cc',
298        'win32socketserver.h',
299        'win32window.cc',
300        'win32window.h',
301        'win32windowpicker.cc',
302        'win32windowpicker.h',
303        'window.h',
304        'windowpicker.h',
305        'windowpickerfactory.h',
306        'winfirewall.cc',
307        'winfirewall.h',
308        'winping.cc',
309        'winping.h',
310        'worker.cc',
311        'worker.h',
312        '../overrides/webrtc/base/basictypes.h',
313        '../overrides/webrtc/base/constructormagic.h',
314        '../overrides/webrtc/base/logging.cc',
315        '../overrides/webrtc/base/logging.h',
316        '../overrides/webrtc/base/win32socketinit.cc',
317      ],
318      # TODO(henrike): issue 3307, make webrtc_base build without disabling
319      # these flags.
320      'cflags!': [
321        '-Wextra',
322        '-Wall',
323      ],
324      'cflags_cc!': [
325        '-Wnon-virtual-dtor',
326      ],
327      'direct_dependent_settings': {
328        'cflags_cc!': [
329          '-Wnon-virtual-dtor',
330        ],
331        'defines': [
332          'FEATURE_ENABLE_SSL',
333          'GTEST_RELATIVE_PATH',
334        ],
335      },
336      'include_dirs': [
337        '../../third_party/jsoncpp/overrides/include',
338        '../../third_party/jsoncpp/source/include',
339      ],
340      'conditions': [
341        ['build_with_chromium==1', {
342          'include_dirs': [
343            '../overrides',
344            '../../openssl/openssl/include',
345          ],
346          'sources!': [
347            'asyncinvoker.cc',
348            'asyncinvoker.h',
349            'asyncinvoker-inl.h',
350            'asyncresolverinterface.h',
351            'atomicops.h',
352            'bandwidthsmoother.cc',
353            'bandwidthsmoother.h',
354            'basictypes.h',
355            'bind.h',
356            'bind.h.pump',
357            'buffer.h',
358            'callback.h',
359            'callback.h.pump',
360            'constructormagic.h',
361            'dbus.cc',
362            'dbus.h',
363            'diskcache_win32.cc',
364            'diskcache_win32.h',
365            'filelock.cc',
366            'filelock.h',
367            'fileutils_mock.h',
368            'genericslot.h',
369            'genericslot.h.pump',
370            'httpserver.cc',
371            'httpserver.h',
372            'json.cc',
373            'json.h',
374            'latebindingsymboltable.cc',
375            'latebindingsymboltable.cc.def',
376            'latebindingsymboltable.h',
377            'latebindingsymboltable.h.def',
378            'libdbusglibsymboltable.cc',
379            'libdbusglibsymboltable.h',
380            'linuxfdwalk.c',
381            'linuxfdwalk.h',
382            'linuxwindowpicker.cc',
383            'linuxwindowpicker.h',
384            'logging.cc',
385            'logging.h',
386            'macasyncsocket.cc',
387            'macasyncsocket.h',
388            'maccocoasocketserver.h',
389            'maccocoasocketserver.mm',
390            'macsocketserver.cc',
391            'macsocketserver.h',
392            'macwindowpicker.cc',
393            'macwindowpicker.h',
394            'mathutils.h',
395            'multipart.cc',
396            'multipart.h',
397            'natserver.cc',
398            'natserver.h',
399            'natsocketfactory.cc',
400            'natsocketfactory.h',
401            'nattypes.cc',
402            'nattypes.h',
403            'openssl.h',
404            'optionsfile.cc',
405            'optionsfile.h',
406            'posix.cc',
407            'posix.h',
408            'profiler.cc',
409            'profiler.h',
410            'proxyserver.cc',
411            'proxyserver.h',
412            'refcount.h',
413            'referencecountedsingletonfactory.h',
414            'rollingaccumulator.h',
415            'safe_conversions.h',
416            'safe_conversions_impl.h',
417            'scopedptrcollection.h',
418            'scoped_ref_ptr.h',
419            'sec_buffer.h',
420            'sharedexclusivelock.cc',
421            'sharedexclusivelock.h',
422            'sslconfig.h',
423            'sslroots.h',
424            'stringdigest.h',
425            'testbase64.h',
426            'testclient.cc',
427            'testclient.h',
428            'transformadapter.cc',
429            'transformadapter.h',
430            'versionparsing.cc',
431            'versionparsing.h',
432            'virtualsocketserver.cc',
433            'virtualsocketserver.h',
434            'win32regkey.cc',
435            'win32regkey.h',
436            'win32socketinit.cc',
437            'win32socketinit.h',
438            'win32socketserver.cc',
439            'win32socketserver.h',
440            'window.h',
441            'windowpickerfactory.h',
442            'windowpicker.h',
443          ],
444          'defines': [
445            'NO_MAIN_THREAD_WRAPPING',
446            'SSL_USE_NSS',
447          ],
448          'direct_dependent_settings': {
449            'defines': [
450              'NO_MAIN_THREAD_WRAPPING',
451              'SSL_USE_NSS',
452            ],
453          },
454        }, {
455          'conditions': [
456            ['build_json==1', {
457              'dependencies': [
458                '<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
459              ],
460            }, {
461              'include_dirs': [
462                '<(json_root)',
463              ],
464              'defines': [
465                # When defined changes the include path for json.h to where it
466                # is expected to be when building json outside of the standalone
467                # build.
468                'WEBRTC_EXTERNAL_JSON',
469              ],
470            }],
471          ],
472          'sources!': [
473            '../overrides/webrtc/base/basictypes.h',
474            '../overrides/webrtc/base/constructormagic.h',
475            '../overrides/webrtc/base/win32socketinit.cc',
476            '../overrides/webrtc/base/logging.cc',
477            '../overrides/webrtc/base/logging.h',
478          ],
479        }],
480        ['use_openssl==1', {
481          'defines': [
482            'SSL_USE_OPENSSL',
483            'HAVE_OPENSSL_SSL_H',
484          ],
485          'direct_dependent_settings': {
486            'defines': [
487              'SSL_USE_OPENSSL',
488              'HAVE_OPENSSL_SSL_H',
489            ],
490          },
491          'conditions': [
492            ['build_ssl==1', {
493              'dependencies': [
494                '<(DEPTH)/third_party/openssl/openssl.gyp:openssl',
495              ],
496            }, {
497              'include_dirs': [
498                '<(ssl_root)',
499              ],
500            }],
501          ],
502        }, {
503          'defines': [
504            'SSL_USE_NSS',
505            'HAVE_NSS_SSL_H',
506            'SSL_USE_NSS_RNG',
507          ],
508          'direct_dependent_settings': {
509            'defines': [
510              'SSL_USE_NSS',
511              'HAVE_NSS_SSL_H',
512              'SSL_USE_NSS_RNG',
513            ],
514          },
515        }],
516        ['OS == "android"', {
517          'defines': [
518            'HAVE_OPENSSL_SSL_H'
519          ],
520          'direct_dependent_settings': {
521            'defines': [
522              'HAVE_OPENSSL_SSL_H'
523            ],
524          },
525          'link_settings': {
526            'libraries': [
527              '-llog',
528              '-lGLESv2',
529            ],
530          },
531        }, {
532          'defines': [
533            'HAVE_NSS_SSL_H'
534            'SSL_USE_NSS_RNG',
535          ],
536          'direct_dependent_settings': {
537            'defines': [
538              'HAVE_NSS_SSL_H'
539              'SSL_USE_NSS_RNG',
540            ],
541          },
542          'sources!': [
543            'ifaddrs-android.cc',
544            'ifaddrs-android.h',
545          ],
546        }],
547        ['OS=="ios"', {
548          'all_dependent_settings': {
549            'xcode_settings': {
550              'OTHER_LDFLAGS': [
551                '-framework Foundation',
552                '-framework Security',
553                '-framework SystemConfiguration',
554                '-framework UIKit',
555              ],
556            },
557          },
558           'conditions': [
559            ['build_ssl==1', {
560              'dependencies': [
561                '<(DEPTH)/net/third_party/nss/ssl.gyp:libssl',
562              ]
563            }, {
564              'include_dirs': [
565                '<(ssl_root)',
566              ],
567            }],
568          ],
569        }],
570        ['OS=="linux"', {
571          'link_settings': {
572            'libraries': [
573              '-lcrypto',
574              '-ldl',
575              '-lrt',
576              '-lXext',
577              '-lX11',
578              '-lXcomposite',
579              '-lXrender',
580              '<!@(<(pkg-config) --libs-only-l nss | sed -e "s/-lssl3//")',
581            ],
582          },
583          'cflags': [
584            '<!@(<(pkg-config) --cflags nss)',
585          ],
586          'ldflags': [
587            '<!@(<(pkg-config) --libs-only-L --libs-only-other nss)',
588          ],
589        }, {
590          'sources!': [
591            'dbus.cc',
592            'dbus.h',
593            'libdbusglibsymboltable.cc',
594            'libdbusglibsymboltable.h',
595            'linuxfdwalk.c',
596            'linuxwindowpicker.cc',
597            'linuxwindowpicker.h',
598          ],
599        }],
600        ['OS=="mac"', {
601          'link_settings': {
602            'libraries': [
603              '$(SDKROOT)/usr/lib/libcrypto.dylib',
604              '$(SDKROOT)/usr/lib/libssl.dylib',
605            ],
606          },
607          'all_dependent_settings': {
608            'link_settings': {
609              'xcode_settings': {
610                'OTHER_LDFLAGS': [
611                  '-framework Cocoa',
612                  '-framework Foundation',
613                  '-framework IOKit',
614                  '-framework Security',
615                  '-framework SystemConfiguration',
616                ],
617              },
618            },
619          },
620          'conditions': [
621            ['target_arch=="ia32"', {
622              'all_dependent_settings': {
623                'link_settings': {
624                  'xcode_settings': {
625                    'OTHER_LDFLAGS': [
626                      '-framework Carbon',
627                    ],
628                  },
629                },
630              },
631            }],
632          ],
633        }, {
634          'sources!': [
635            'macasyncsocket.cc',
636            'macasyncsocket.h',
637            'maccocoasocketserver.h',
638            'maccocoasocketserver.mm',
639            'macconversion.cc',
640            'macconversion.h',
641            'macsocketserver.cc',
642            'macsocketserver.h',
643            'macutils.cc',
644            'macutils.h',
645            'macwindowpicker.cc',
646            'macwindowpicker.h',
647          ],
648        }],
649        ['OS=="win"', {
650          'link_settings': {
651            'libraries': [
652              '-lcrypt32.lib',
653              '-liphlpapi.lib',
654              '-lsecur32.lib',
655            ],
656          },
657          # Suppress warnings about WIN32_LEAN_AND_MEAN.
658          'msvs_disabled_warnings': [4005, 4703],
659          'defines': [
660            '_CRT_NONSTDC_NO_DEPRECATE',
661          ],
662        }, {
663          'sources/': [
664            ['exclude', 'win32[a-z0-9]*\\.(h|cc)$'],
665          ],
666          'sources!': [
667              'schanneladapter.cc',
668              'schanneladapter.h',
669              'winping.cc',
670              'winping.h',
671              'winfirewall.cc',
672              'winfirewall.h',
673            ],
674        }],
675        ['os_posix==0', {
676          'sources!': [
677            'latebindingsymboltable.cc',
678            'latebindingsymboltable.h',
679            'posix.cc',
680            'posix.h',
681            'unixfilesystem.cc',
682            'unixfilesystem.h',
683          ],
684        }, {
685          'configurations': {
686            'Debug_Base': {
687              'defines': [
688                # Chromium's build/common.gypi defines this for all posix
689                # _except_ for ios & mac.  We want it there as well, e.g.
690                # because ASSERT and friends trigger off of it.
691                '_DEBUG',
692              ],
693            },
694          }
695        }],
696        ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', {
697          'defines': [
698            'CARBON_DEPRECATED=YES',
699          ],
700        }],
701        ['OS!="ios" and OS!="mac"', {
702          'sources!': [
703            'scoped_autorelease_pool.mm',
704          ],
705        }],
706        ['OS=="ios" or os_posix==0', {
707          'sources!': [
708            'openssl.h',
709            'openssladapter.cc',
710            'openssladapter.h',
711            'openssldigest.cc',
712            'openssldigest.h',
713            'opensslidentity.cc',
714            'opensslidentity.h',
715            'opensslstreamadapter.cc',
716            'opensslstreamadapter.h',
717          ],
718        }],
719        ['OS!="linux" and OS!="android"', {
720          'sources!': [
721            'linux.cc',
722            'linux.h',
723          ],
724        }],
725        ['OS == "mac" or OS == "ios" or OS == "win"', {
726          'conditions': [
727            ['build_ssl==1', {
728              'dependencies': [
729                '<(DEPTH)/net/third_party/nss/ssl.gyp:libssl',
730                '<(DEPTH)/third_party/nss/nss.gyp:nspr',
731                '<(DEPTH)/third_party/nss/nss.gyp:nss',
732              ],
733            }, {
734              'include_dirs': [
735                '<(ssl_root)',
736              ],
737            }],
738          ],
739        }],
740        ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
741          'conditions': [
742            ['build_ssl==1', {
743              'dependencies': [
744                '<(DEPTH)/build/linux/system.gyp:ssl',
745              ],
746            }, {
747              'include_dirs': [
748                '<(ssl_root)',
749              ],
750            }],
751          ],
752        }],
753      ],
754    },
755  ],
756}
757