usrsctp.gyp revision 58537e28ecd584eab876aee8be7156509866d23a
1# Copyright (c) 2012 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4{
5  'variables': {
6    'libsctp_target_type%': 'static_library',
7  },
8  'target_defaults': {
9    'defines': [
10      'SCTP_PROCESS_LEVEL_LOCKS',
11      'SCTP_SIMPLE_ALLOCATOR',
12      '__Userspace__',
13      # 'SCTP_DEBUG', # Uncomment for SCTP debugging.
14    ],
15    'include_dirs': [
16      'usrsctplib/',
17      'usrsctplib/netinet',
18    ],
19    'direct_dependent_settings': {
20      'include_dirs': [
21        'usrsctplib/',
22        'usrsctplib/netinet',
23      ],
24    },
25    'conditions': [
26      ['use_openssl==1', {
27        'defines': [
28          'SCTP_USE_OPENSSL_SHA1',
29        ],
30        'dependencies': [
31          '<(DEPTH)/third_party/openssl/openssl.gyp:openssl',
32        ],
33      },
34      {  # else use_openssl==0, use NSS.
35        'defines' : [
36          'SCTP_USE_NSS_SHA1',
37        ],
38        'conditions': [
39          ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
40            'dependencies': [  # The system.gyp:ssl dependency includes nss
41              '<(DEPTH)/build/linux/system.gyp:ssl',
42            ],
43          }],
44          ['OS == "mac" or OS == "ios" or OS == "win"', {
45            'dependencies': [
46              '<(DEPTH)/third_party/nss/nss.gyp:nspr',
47              '<(DEPTH)/third_party/nss/nss.gyp:nss',
48            ],
49          }],
50        ],
51      }],
52    ],
53  },
54  'targets': [
55    {
56      'target_name': 'usrsctplib',
57      'type': 'static_library',
58      'sources': [
59        'usrsctplib/netinet/sctp_asconf.c',
60        'usrsctplib/netinet/sctp_asconf.h',
61        'usrsctplib/netinet/sctp_auth.c',
62        'usrsctplib/netinet/sctp_auth.h',
63        'usrsctplib/netinet/sctp_bsd_addr.c',
64        'usrsctplib/netinet/sctp_bsd_addr.h',
65        'usrsctplib/netinet/sctp_callout.c',
66        'usrsctplib/netinet/sctp_callout.h',
67        'usrsctplib/netinet/sctp_cc_functions.c',
68        'usrsctplib/netinet/sctp_constants.h',
69        'usrsctplib/netinet/sctp_crc32.c',
70        'usrsctplib/netinet/sctp_crc32.h',
71        'usrsctplib/netinet/sctp_header.h',
72        'usrsctplib/netinet/sctp_indata.c',
73        'usrsctplib/netinet/sctp_indata.h',
74        'usrsctplib/netinet/sctp_input.c',
75        'usrsctplib/netinet/sctp_input.h',
76        'usrsctplib/netinet/sctp_lock_userspace.h',
77        'usrsctplib/netinet/sctp_os.h',
78        'usrsctplib/netinet/sctp_os_userspace.h',
79        'usrsctplib/netinet/sctp_output.c',
80        'usrsctplib/netinet/sctp_output.h',
81        'usrsctplib/netinet/sctp_pcb.c',
82        'usrsctplib/netinet/sctp_pcb.h',
83        'usrsctplib/netinet/sctp_peeloff.c',
84        'usrsctplib/netinet/sctp_peeloff.h',
85        'usrsctplib/netinet/sctp_sha1.c',
86        'usrsctplib/netinet/sctp_sha1.h',
87        'usrsctplib/netinet/sctp_ss_functions.c',
88        'usrsctplib/netinet/sctp_structs.h',
89        'usrsctplib/netinet/sctp_sysctl.c',
90        'usrsctplib/netinet/sctp_sysctl.h',
91        'usrsctplib/netinet/sctp_timer.c',
92        'usrsctplib/netinet/sctp_timer.h',
93        'usrsctplib/netinet/sctp_uio.h',
94        'usrsctplib/netinet/sctp_userspace.c',
95        'usrsctplib/netinet/sctp_usrreq.c',
96        'usrsctplib/netinet/sctp_var.h',
97        'usrsctplib/netinet/sctputil.c',
98        'usrsctplib/netinet/sctputil.h',
99        'usrsctplib/user_atomic.h',
100        'usrsctplib/user_environment.c',
101        'usrsctplib/user_environment.h',
102        'usrsctplib/user_inpcb.h',
103        'usrsctplib/user_ip6_var.h',
104        'usrsctplib/user_ip_icmp.h',
105        'usrsctplib/user_mbuf.c',
106        'usrsctplib/user_mbuf.h',
107        'usrsctplib/user_queue.h',
108        'usrsctplib/user_recv_thread.c',
109        'usrsctplib/user_recv_thread.h',
110        'usrsctplib/user_route.h',
111        'usrsctplib/user_sctp_timer_iterate.c',
112        'usrsctplib/user_socket.c',
113        'usrsctplib/user_socketvar.h',
114        'usrsctplib/user_uma.h',
115        'usrsctplib/usrsctp.h',
116      ],  # sources
117      'conditions': [
118        ['OS=="linux"', {
119          'defines': [
120            '__Userspace_os_Linux',
121          ],
122          'cflags!': [ '-Werror', '-Wall' ],
123          'cflags': [ '-w' ],
124        }],
125        ['OS=="mac"', {
126          'defines': [
127            'HAVE_SA_LEN',
128            'HAVE_SCONN_LEN',
129            '__APPLE_USE_RFC_2292',
130            '__Userspace_os_Darwin',
131          ],
132          # usrsctp requires that __APPLE__ is undefined for compilation (for
133          # historical reasons). There is a plan to change this, and when it
134          # happens and we re-roll DEPS for usrsctp, we can remove the manual
135          # undefining of __APPLE__.
136          'xcode_settings': {
137            'OTHER_CFLAGS!': [ '-Werror', '-Wall' ],
138            'OTHER_CFLAGS': [ '-U__APPLE__', '-w' ],
139          },
140        }],
141        ['OS=="win"', {
142          'defines': [
143            '__Userspace_os_Windows',
144            # Manually setting WINVER and _WIN32_WINNT is needed because Chrome
145            # sets WINVER to a newer version of  windows. But compiling usrsctp
146            # this way would is incompatible  with windows XP.
147            'WINVER=0x0502',
148            '_WIN32_WINNT=0x0502',
149          ],
150          'cflags!': [ '/W3', '/WX' ],
151          'cflags': [ '/w' ],
152          # TODO(ldixon) : Remove this disabling of warnings by pushing a
153          # fix upstream to usrsctp
154          'msvs_disabled_warnings': [ 4700, 4013, 4018, 4133, 4267 ],
155        }, {  # OS != "win",
156          'defines': [
157            'NON_WINDOWS_DEFINE',
158          ],
159        }],
160      ],  # conditions
161    },  # target usrsctp
162  ],  # targets
163}
164