summaryrefslogtreecommitdiffstats
path: root/config/external/nspr/pr/moz.build
blob: 1fd9257d718c72e9ea954ca87f77c762906e5085 (plain)
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
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

if CONFIG['MOZ_FOLD_LIBS']:
    Library('nspr4')
else:
    SharedLibrary('nspr4')

# We allow warnings for third-party code that can be updated from upstream.
# TODO: fix NSPR warnings and remove this
AllowCompilerWarnings()

DEFINES['_NSPR_BUILD_'] = True
if CONFIG['OS_ARCH'] == 'Linux':
    OS_LIBS += CONFIG['REALTIME_LIBS']
    DEFINES.update(
        LINUX=True,
        HAVE_FCNTL_FILE_LOCKING=True,
        HAVE_POINTER_LOCALTIME_R=True,
        _GNU_SOURCE=True,
    )
    SOURCES += ['/nsprpub/pr/src/md/unix/linux.c']
    if CONFIG['CPU_ARCH'] == 'x86_64':
        SOURCES += ['/nsprpub/pr/src/md/unix/os_Linux_x86_64.s']
    elif CONFIG['CPU_ARCH'] == 'x86':
        DEFINES['i386'] = True
        SOURCES += ['/nsprpub/pr/src/md/unix/os_Linux_x86.s']
    elif CONFIG['CPU_ARCH'] == 'ppc':
        SOURCES += ['/nsprpub/pr/src/md/unix/os_Linux_ppc.s']
elif CONFIG['OS_TARGET'] in ('FreeBSD', 'OpenBSD', 'NetBSD'):
    DEFINES.update(
        HAVE_BSD_FLOCK=True,
        HAVE_SOCKLEN_T=True,
        HAVE_POINTER_LOCALTIME_R=True,
    )
    DEFINES[CONFIG['OS_TARGET'].upper()] = True
    SOURCES += ['/nsprpub/pr/src/md/unix/%s.c' % CONFIG['OS_TARGET'].lower()]
elif CONFIG['OS_TARGET'] == 'Darwin':
    OS_LIBS += ['-framework CoreServices']
    DEFINES['FD_SETSIZE'] = 10240
    DEFINES['_DARWIN_UNLIMITED_SELECT'] = True
    if not CONFIG['HOST_MAJOR_VERSION']:
        DEFINES.update(
            HAS_CONNECTX=True,
        )
    elif CONFIG['HOST_MAJOR_VERSION'] >= '15':
        DEFINES.update(
            HAS_CONNECTX=True,
        )
    DEFINES.update(
        DARWIN=True,
        HAVE_BSD_FLOCK=True,
        HAVE_SOCKLEN_T=True,
        HAVE_POINTER_LOCALTIME_R=True,
    )
    SOURCES += [
        '/nsprpub/pr/src/md/unix/darwin.c',
        '/nsprpub/pr/src/md/unix/os_Darwin.s',
    ]
    if not CONFIG['MOZ_IOS']:
        DEFINES['HAVE_CRT_EXTERNS_H'] = True
elif CONFIG['OS_TARGET'] == 'SunOS':
    DEFINES.update(
        HAVE_FCNTL_FILE_LOCKING=True,
        HAVE_SOCKLEN_T=True,
        _PR_HAVE_OFF64_T=True,
        _PR_INET6=True,
    )
    DEFINES['SOLARIS'] = True
    SOURCES += ['/nsprpub/pr/src/md/unix/solaris.c']
    if CONFIG['CPU_ARCH'] == 'x86_64':
        SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s']
    elif CONFIG['CPU_ARCH'] == 'x86':
        SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_x86.s']
elif CONFIG['OS_TARGET'] == 'WINNT':
    OS_LIBS += [
        'advapi32',
        'ws2_32',
        'mswsock',
        'winmm',
    ]
    DEFINES.update(
        XP_PC=True,
        WIN32=True,
        # For historical reasons we use the WIN95 NSPR target instead of
        # WINNT.
        WIN95=True,
        WINNT=False,
        _PR_GLOBAL_THREADS_ONLY=True,
    )
    if not CONFIG['DEBUG']:
      DEFINES['DO_NOT_WAIT_FOR_CONNECT_OVERLAPPED_OPERATIONS'] = True
    if CONFIG['CPU_ARCH'] == 'x86_64':
        DEFINES['_AMD64_'] = True
    else:
        DEFINES['_X86_'] = True
else:
    error('Not a supported OS_TARGET for NSPR in moz.build: "%s". Use --with-system-nspr' % CONFIG['OS_TARGET'])


LOCAL_INCLUDES += [
    '/config/external/nspr',
    '/nsprpub/pr/include',
    '/nsprpub/pr/include/private',
]

SOURCES += [
    '/nsprpub/pr/src/io/prfdcach.c',
    '/nsprpub/pr/src/io/priometh.c',
    '/nsprpub/pr/src/io/pripv6.c',
    '/nsprpub/pr/src/io/prlayer.c',
    '/nsprpub/pr/src/io/prlog.c',
    '/nsprpub/pr/src/io/prmapopt.c',
    '/nsprpub/pr/src/io/prmmap.c',
    '/nsprpub/pr/src/io/prmwait.c',
    '/nsprpub/pr/src/io/prpolevt.c',
    '/nsprpub/pr/src/io/prprf.c',
    '/nsprpub/pr/src/io/prscanf.c',
    '/nsprpub/pr/src/io/prstdio.c',
    '/nsprpub/pr/src/linking/prlink.c',
    '/nsprpub/pr/src/malloc/prmalloc.c',
    '/nsprpub/pr/src/malloc/prmem.c',
    '/nsprpub/pr/src/md/prosdep.c',
    '/nsprpub/pr/src/memory/prseg.c',
    '/nsprpub/pr/src/memory/prshm.c',
    '/nsprpub/pr/src/memory/prshma.c',
    '/nsprpub/pr/src/misc/pralarm.c',
    '/nsprpub/pr/src/misc/pratom.c',
    '/nsprpub/pr/src/misc/praton.c',
    '/nsprpub/pr/src/misc/prcountr.c',
    '/nsprpub/pr/src/misc/prdtoa.c',
    '/nsprpub/pr/src/misc/prenv.c',
    '/nsprpub/pr/src/misc/prerr.c',
    '/nsprpub/pr/src/misc/prerror.c',
    '/nsprpub/pr/src/misc/prerrortable.c',
    '/nsprpub/pr/src/misc/prinit.c',
    '/nsprpub/pr/src/misc/prinrval.c',
    '/nsprpub/pr/src/misc/pripc.c',
    '/nsprpub/pr/src/misc/prlog2.c',
    '/nsprpub/pr/src/misc/prlong.c',
    '/nsprpub/pr/src/misc/prnetdb.c',
    '/nsprpub/pr/src/misc/prolock.c',
    '/nsprpub/pr/src/misc/prrng.c',
    '/nsprpub/pr/src/misc/prsystem.c',
    '/nsprpub/pr/src/misc/prthinfo.c',
    '/nsprpub/pr/src/misc/prtime.c',
    '/nsprpub/pr/src/misc/prtpool.c',
    '/nsprpub/pr/src/misc/prtrace.c',
    '/nsprpub/pr/src/threads/prcmon.c',
    '/nsprpub/pr/src/threads/prrwlock.c',
    '/nsprpub/pr/src/threads/prtpd.c',
]

if CONFIG['OS_TARGET'] != 'WINNT':
    DEFINES['_PR_PTHREADS'] = True
    SOURCES += [
        '/nsprpub/pr/src/md/unix/unix.c',
        '/nsprpub/pr/src/md/unix/unix_errors.c',
        '/nsprpub/pr/src/md/unix/uxproces.c',
        '/nsprpub/pr/src/md/unix/uxrng.c',
        '/nsprpub/pr/src/md/unix/uxshm.c',
        '/nsprpub/pr/src/md/unix/uxwrap.c',
        '/nsprpub/pr/src/pthreads/ptio.c',
        '/nsprpub/pr/src/pthreads/ptmisc.c',
        '/nsprpub/pr/src/pthreads/ptsynch.c',
        '/nsprpub/pr/src/pthreads/ptthread.c',
    ]
else:
    SOURCES += [
        '/nsprpub/pr/src/io/prdir.c',
        '/nsprpub/pr/src/io/prfile.c',
        '/nsprpub/pr/src/io/prio.c',
        '/nsprpub/pr/src/io/prsocket.c',
        '/nsprpub/pr/src/md/windows/ntgc.c',
        '/nsprpub/pr/src/md/windows/ntinrval.c',
        '/nsprpub/pr/src/md/windows/ntmisc.c',
        '/nsprpub/pr/src/md/windows/ntsec.c',
        '/nsprpub/pr/src/md/windows/ntsem.c',
        '/nsprpub/pr/src/md/windows/w32ipcsem.c',
        '/nsprpub/pr/src/md/windows/w32poll.c',
        '/nsprpub/pr/src/md/windows/w32rng.c',
        '/nsprpub/pr/src/md/windows/w32shm.c',
        '/nsprpub/pr/src/md/windows/w95cv.c',
        '/nsprpub/pr/src/md/windows/w95dllmain.c',
        '/nsprpub/pr/src/md/windows/w95io.c',
        '/nsprpub/pr/src/md/windows/w95sock.c',
        '/nsprpub/pr/src/md/windows/w95thred.c',
        '/nsprpub/pr/src/md/windows/win32_errors.c',
        '/nsprpub/pr/src/misc/pripcsem.c',
        '/nsprpub/pr/src/threads/combined/prucpu.c',
        '/nsprpub/pr/src/threads/combined/prucv.c',
        '/nsprpub/pr/src/threads/combined/prulock.c',
        '/nsprpub/pr/src/threads/combined/prustack.c',
        '/nsprpub/pr/src/threads/combined/pruthr.c',
        '/nsprpub/pr/src/threads/prcthr.c',
        '/nsprpub/pr/src/threads/prdump.c',
        '/nsprpub/pr/src/threads/prmon.c',
        '/nsprpub/pr/src/threads/prsem.c',
    ]

EXPORTS.nspr += [
    '/nsprpub/pr/include/nspr.h',
    '/nsprpub/pr/include/pratom.h',
    '/nsprpub/pr/include/prbit.h',
    '/nsprpub/pr/include/prclist.h',
    '/nsprpub/pr/include/prcmon.h',
    '/nsprpub/pr/include/prcountr.h',
    '/nsprpub/pr/include/prcvar.h',
    '/nsprpub/pr/include/prdtoa.h',
    '/nsprpub/pr/include/prenv.h',
    '/nsprpub/pr/include/prerr.h',
    '/nsprpub/pr/include/prerror.h',
    '/nsprpub/pr/include/prinet.h',
    '/nsprpub/pr/include/prinit.h',
    '/nsprpub/pr/include/prinrval.h',
    '/nsprpub/pr/include/prio.h',
    '/nsprpub/pr/include/pripcsem.h',
    '/nsprpub/pr/include/prlink.h',
    '/nsprpub/pr/include/prlock.h',
    '/nsprpub/pr/include/prlog.h',
    '/nsprpub/pr/include/prlong.h',
    '/nsprpub/pr/include/prmem.h',
    '/nsprpub/pr/include/prmon.h',
    '/nsprpub/pr/include/prmwait.h',
    '/nsprpub/pr/include/prnetdb.h',
    '/nsprpub/pr/include/prolock.h',
    '/nsprpub/pr/include/prpdce.h',
    '/nsprpub/pr/include/prprf.h',
    '/nsprpub/pr/include/prproces.h',
    '/nsprpub/pr/include/prrng.h',
    '/nsprpub/pr/include/prrwlock.h',
    '/nsprpub/pr/include/prshm.h',
    '/nsprpub/pr/include/prshma.h',
    '/nsprpub/pr/include/prsystem.h',
    '/nsprpub/pr/include/prthread.h',
    '/nsprpub/pr/include/prtime.h',
    '/nsprpub/pr/include/prtpool.h',
    '/nsprpub/pr/include/prtrace.h',
    '/nsprpub/pr/include/prtypes.h',
    '/nsprpub/pr/include/prvrsion.h',
    '/nsprpub/pr/include/prwin16.h',
]

EXPORTS.nspr.md += [
    '/nsprpub/pr/include/md/_darwin.cfg',
    '/nsprpub/pr/include/md/_freebsd.cfg',
    '/nsprpub/pr/include/md/_linux.cfg',
    '/nsprpub/pr/include/md/_netbsd.cfg',
    '/nsprpub/pr/include/md/_openbsd.cfg',
    '/nsprpub/pr/include/md/_solaris.cfg',
    '/nsprpub/pr/include/md/_win95.cfg',
]

EXPORTS.nspr.private += [
    '/nsprpub/pr/include/private/pprio.h',
    '/nsprpub/pr/include/private/pprthred.h',
    '/nsprpub/pr/include/private/prpriv.h',
]