This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCsub
256 lines (220 loc) · 6.8 KB
/
SCsub
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
#!/usr/bin/env python
Import('env')
from config import get_defines
env_module = env.Clone()
# Thirdparty source files
thirdparty_dir = 'thirdparty/'
pjlib_dir = thirdparty_dir + 'pjlib/src/pj/'
pjlib_util_dir = thirdparty_dir + 'pjlib-util/src/pjlib-util/'
pjnath_dir = thirdparty_dir + 'pjnath/src/pjnath/'
env_module.Prepend(CPPPATH=[thirdparty_dir + 'pjlib/include/'])
env_module.Prepend(CPPPATH=[thirdparty_dir + 'pjlib-util/include/'])
env_module.Prepend(CPPPATH=[thirdparty_dir + 'pjnath/include/'])
env_thirdparty = env_module.Clone()
# PJLIB (dependency of PJNATH)
pjlib_sources = [
# Allegedly platform-independent sources
# Sync with pjlib/build/Makefile
# Move these per platform if getting compile errors or unresolved symbols
'activesock.c',
'addr_resolv_sock.c',
'array.c',
'config.c',
'ctype.c',
'errno.c',
'except.c',
'fifobuf.c',
'file_io_ansi.c',
'ioqueue_select.c',
'ip_helper_generic.c',
'list.c',
'log.c',
'hash.c',
'ioqueue_epoll.c',
'lock.c',
'os_timestamp_common.c',
'os_time_common.c',
'log_writer_stdout.c',
'os_info.c',
'os_timestamp_posix.c',
'pool_policy_malloc.c',
'rand.c',
'pool.c',
'rbtree.c',
'pool_buf.c',
'sock_common.c',
'sock_qos_common.c',
'sock_qos_dummy.c',
'sock_select.c',
'pool_caching.c',
'pool_dbg.c',
'ssl_sock_common.c',
'ssl_sock_dump.c',
'ssl_sock_ossl.c',
'ssl_sock_gtls.c',
'string.c',
'symbols.c',
'types.c',
'timer.c',
# Included per platform but kept for reference:
# 'guid.c',
# 'guid_simple.c',
# 'guid_uuid.c',
# Compat
'compat/string_compat.c',
# 'compat/sigjmp.c',
# 'compat/string.c',
]
pjlib_sources = [pjlib_dir + file for file in pjlib_sources]
# PJLIB UTILS (dependency of PJNATH)
pjlib_util_sources = [
'base64.c',
'cli.c',
'cli_console.c',
'cli_telnet.c',
'crc32.c',
'dns.c',
'dns_dump.c',
'dns_server.c',
'errno.c',
'getopt.c',
'hmac_md5.c',
'hmac_sha1.c',
'http_client.c',
'json.c',
'md5.c',
'pcap.c',
'resolver.c',
# 'resolver_wrap.cpp', # https://trac.pjsip.org/repos/ticket/886
'scanner.c',
# 'scanner_cis_bitwise.c', # THIS FILE IS INCLUDED BY scanner.c.
# 'scanner_cis_uint.c', # THIS FILE IS INCLUDED BY scanner.c.
'sha1.c',
'srv_resolver.c',
'string.c',
'stun_simple.c',
'stun_simple_client.c',
'symbols.c',
'xml.c',
# 'xml_wrap.cpp', # https://trac.pjsip.org/repos/ticket/886
]
pjlib_util_sources = [pjlib_util_dir + file for file in pjlib_util_sources]
# PJNATH
pjnath_sources = [
'errno.c',
'ice_session.c',
'ice_strans.c',
'nat_detect.c',
'stun_auth.c',
'stun_msg.c',
'stun_msg_dump.c',
'stun_session.c',
'stun_sock.c',
'stun_transaction.c',
'turn_session.c',
'turn_sock.c',
]
pjnath_sources = [pjnath_dir + file for file in pjnath_sources]
#===============================================================================
# Platform specific setup
#===============================================================================
if env["platform"] == "windows": # note: fails compiling with MinGW
pjlib_sources.remove(pjlib_dir + 'ip_helper_generic.c') # exclude
pjlib_sources.remove(pjlib_dir + 'os_timestamp_posix.c') # exclude
pjlib_sources.remove(pjlib_dir + 'ioqueue_epoll.c') # exclude
pjlib_sources.remove(pjlib_dir + 'file_io_ansi.c') # exclude
# 'ssl_sock_imp_common.c',
pjlib_windows_sources = [
'file_access_win32.c',
'file_io_win32.c',
'guid_win32.c',
# 'ioqueue_winnt.c', // commented upstream
'ip_helper_win32.c',
'os_core_win32.c',
'os_error_win32.c',
'os_timestamp_win32.c',
'os_time_win32.c',
'sock_qos_wm.c',
'unicode_win32.c',
'sock_bsd.c',
'sock_qos_bsd.c',
]
pjlib_sources += [pjlib_dir + file for file in pjlib_windows_sources]
elif env["platform"] == "uwp": # NOT TESTED
pjlib_uwp_sources = [
'ioqueue_uwp.cpp',
# 'ip_helper_winphone8.c',
'sock_uwp.cpp',
'guid.c',
]
pjlib_sources += [pjlib_dir + file for file in pjlib_uwp_sources]
elif env["platform"] == "x11": # Linux
pjlib_x11_sources = [
'file_access_unistd.c',
'os_core_unix.c',
'os_error_unix.c',
'os_time_unix.c',
'guid_simple.c',
'os_timestamp_posix.c',
# ifeq (epoll,$(LINUX_POLL))
'ioqueue_epoll.c',
# else
# 'ioqueue_select.c'
# Exclusively for the Linux Kernel (?)
# 'extra-exports.c',
# 'log_writer_printk.c',
# 'pool_policy_kmalloc.c',
# BSD
# 'os_time_bsd.c',
'sock_bsd.c',
# 'sock_qos_bsd.c',
]
pjlib_sources += [pjlib_dir + file for file in pjlib_x11_sources]
elif env["platform"] == "osx": # MacOS # NOT TESTED
pjlib_osx_sources = [
'os_core_darwin.m',
'sock_qos_darwin.c',
'ssl_sock_darwin.c',
'guid_simple.c',
'os_timestamp_posix.c',
]
pjlib_sources += [pjlib_dir + file for file in pjlib_osx_sources]
elif env["platform"] == "iphone": # iOS # NOT TESTED
pjlib_iphone_sources = [
'os_core_darwin.m',
'os_info_iphone.m',
'guid.c',
]
pjlib_sources += [pjlib_dir + file for file in pjlib_iphone_sources]
elif env["platform"] == "android":
pjlib_android_sources = [
'guid_android.c',
'sock_bsd.c',
'os_core_unix',
'os_error_unix.c',
'os_time_unix.c',
'guid_simple.c',
'os_timestamp_posix.c',
# Might not have the library:
# 'guid_uuid.c',
# 'guid_simple.c',
]
pjlib_sources += [pjlib_dir + file for file in pjlib_android_sources]
# Configure preprocessor defines per platform
env_thirdparty.Append(CPPDEFINES=get_defines(env))
env_module.Append(CPPDEFINES=get_defines(env)) # may need to force some defines
#===============================================================================
# Done, add sources now
env_thirdparty.add_source_files(env.modules_sources, pjlib_sources)
env_thirdparty.add_source_files(env.modules_sources, pjlib_util_sources)
env_thirdparty.add_source_files(env.modules_sources, pjnath_sources)
env_thirdparty.disable_warnings()
# Optional arguments passed via command line.
# Possibly, you might need to add missing PJ_* preprocessor defines this way
# but likely they should be added in config.py: get_defines() callback instead.
for key, value in ARGLIST:
if key == 'define':
env_module.Append(CPPDEFINES=[value])
# Add module sources
env_module.add_source_files(env.modules_sources, '*.cpp') # pjnath_wrap.cpp etc.
Export('env_module')