moz.build (9454B)
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- 2 # vim: set filetype=python: 3 # This Source Code Form is subject to the terms of the Mozilla Public 4 # License, v. 2.0. If a copy of the MPL was not distributed with this 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7 if CONFIG["MOZ_FOLD_LIBS"]: 8 Library("nspr4") 9 else: 10 SharedLibrary("nspr4") 11 12 # We allow warnings for third-party code that can be updated from upstream. 13 # TODO: fix NSPR warnings and remove this 14 AllowCompilerWarnings() 15 16 OS_LIBS += CONFIG["DL_LIBS"] 17 18 # for gethostbyname_r 19 OS_LIBS += CONFIG["C_R_LIBS"] 20 21 # for socket 22 OS_LIBS += CONFIG["SOCKET_LIBS"] 23 24 DEFINES["_NSPR_BUILD_"] = True 25 if CONFIG["OS_ARCH"] == "Linux": 26 OS_LIBS += CONFIG["REALTIME_LIBS"] 27 DEFINES["LINUX"] = True 28 DEFINES["HAVE_FCNTL_FILE_LOCKING"] = True 29 DEFINES["HAVE_POINTER_LOCALTIME_R"] = True 30 DEFINES["_GNU_SOURCE"] = True 31 SOURCES += ["/nsprpub/pr/src/md/unix/linux.c"] 32 if CONFIG["TARGET_CPU"] == "x86_64": 33 SOURCES += ["/nsprpub/pr/src/md/unix/os_Linux_x86_64.s"] 34 elif CONFIG["TARGET_CPU"] == "x86": 35 DEFINES["i386"] = True 36 SOURCES += ["/nsprpub/pr/src/md/unix/os_Linux_x86.s"] 37 elif CONFIG["TARGET_CPU"] == "ppc": 38 SOURCES += ["/nsprpub/pr/src/md/unix/os_Linux_ppc.s"] 39 elif CONFIG["OS_TARGET"] in ("FreeBSD", "OpenBSD", "NetBSD"): 40 DEFINES["HAVE_BSD_FLOCK"] = True 41 DEFINES["HAVE_SOCKLEN_T"] = True 42 DEFINES["HAVE_POINTER_LOCALTIME_R"] = True 43 DEFINES[CONFIG["OS_TARGET"].upper()] = True 44 SOURCES += ["/nsprpub/pr/src/md/unix/%s.c" % CONFIG["OS_TARGET"].lower()] 45 elif CONFIG["OS_TARGET"] == "Darwin": 46 OS_LIBS += ["-framework CoreServices"] 47 # See also IncreaseDescriptorLimits in toolkit/xre/nsAppRunner.cpp 48 DEFINES["FD_SETSIZE"] = 4096 49 DEFINES["_DARWIN_UNLIMITED_SELECT"] = True 50 DEFINES["HAS_CONNECTX"] = True 51 DEFINES["DARWIN"] = True 52 DEFINES["HAVE_BSD_FLOCK"] = True 53 DEFINES["HAVE_SOCKLEN_T"] = True 54 DEFINES["HAVE_POINTER_LOCALTIME_R"] = True 55 SOURCES += [ 56 "/nsprpub/pr/src/md/unix/darwin.c", 57 "/nsprpub/pr/src/md/unix/os_Darwin.s", 58 ] 59 DEFINES["HAVE_CRT_EXTERNS_H"] = True 60 elif CONFIG["OS_TARGET"] == "SunOS": 61 DEFINES["HAVE_FCNTL_FILE_LOCKING"] = True 62 DEFINES["HAVE_SOCKLEN_T"] = True 63 DEFINES["_PR_HAVE_OFF64_T"] = True 64 DEFINES["_PR_INET6"] = True 65 DEFINES["SOLARIS"] = True 66 SOURCES += ["/nsprpub/pr/src/md/unix/solaris.c"] 67 if CONFIG["TARGET_CPU"] == "x86_64": 68 SOURCES += ["/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s"] 69 elif CONFIG["TARGET_CPU"] == "x86": 70 SOURCES += ["/nsprpub/pr/src/md/unix/os_SunOS_x86.s"] 71 elif CONFIG["TARGET_CPU"] == "sparc64": 72 ASFLAGS += ["-x", "assembler-with-cpp", "-D_ASM"] 73 SOURCES += ["/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s"] 74 elif CONFIG["OS_TARGET"] == "WINNT": 75 OS_LIBS += [ 76 "advapi32", 77 "wsock32", 78 "ws2_32", 79 "mswsock", 80 "winmm", 81 ] 82 DEFINES["XP_PC"] = True 83 DEFINES["WIN32"] = True 84 # For historical reasons we use the WIN95 NSPR target instead of 85 # WINNT. 86 DEFINES["WIN95"] = True 87 DEFINES["WINNT"] = False 88 DEFINES["_PR_GLOBAL_THREADS_ONLY"] = True 89 if not CONFIG["DEBUG"]: 90 DEFINES["DO_NOT_WAIT_FOR_CONNECT_OVERLAPPED_OPERATIONS"] = True 91 if CONFIG["TARGET_CPU"] == "x86_64": 92 DEFINES["_AMD64_"] = True 93 elif CONFIG["TARGET_CPU"] == "x86": 94 DEFINES["_X86_"] = True 95 elif CONFIG["TARGET_CPU"] == "aarch64": 96 DEFINES["_ARM64_"] = True 97 else: 98 error("Unsupported TARGET_CPU value: %s" % CONFIG["TARGET_CPU"]) 99 else: 100 error( 101 'Not a supported OS_TARGET for NSPR in moz.build: "%s". Use --with-system-nspr' 102 % CONFIG["OS_TARGET"] 103 ) 104 105 106 LOCAL_INCLUDES += [ 107 "/config/external/nspr", 108 "/nsprpub/pr/include", 109 "/nsprpub/pr/include/private", 110 ] 111 112 SOURCES += [ 113 "/nsprpub/pr/src/io/prpolevt.c", # conflicting definition of PRFilePrivate 114 "/nsprpub/pr/src/misc/praton.c", # duplicate definition of index_hex 115 ] 116 117 UNIFIED_SOURCES += [ 118 "/nsprpub/pr/src/io/prfdcach.c", 119 "/nsprpub/pr/src/io/priometh.c", 120 "/nsprpub/pr/src/io/pripv6.c", 121 "/nsprpub/pr/src/io/prlayer.c", 122 "/nsprpub/pr/src/io/prlog.c", 123 "/nsprpub/pr/src/io/prmapopt.c", 124 "/nsprpub/pr/src/io/prmmap.c", 125 "/nsprpub/pr/src/io/prmwait.c", 126 "/nsprpub/pr/src/io/prprf.c", 127 "/nsprpub/pr/src/io/prscanf.c", 128 "/nsprpub/pr/src/io/prstdio.c", 129 "/nsprpub/pr/src/linking/prlink.c", 130 "/nsprpub/pr/src/malloc/prmalloc.c", 131 "/nsprpub/pr/src/malloc/prmem.c", 132 "/nsprpub/pr/src/md/prosdep.c", 133 "/nsprpub/pr/src/memory/prseg.c", 134 "/nsprpub/pr/src/memory/prshma.c", 135 "/nsprpub/pr/src/misc/pratom.c", 136 "/nsprpub/pr/src/misc/prdtoa.c", 137 "/nsprpub/pr/src/misc/prenv.c", 138 "/nsprpub/pr/src/misc/prerr.c", 139 "/nsprpub/pr/src/misc/prerror.c", 140 "/nsprpub/pr/src/misc/prerrortable.c", 141 "/nsprpub/pr/src/misc/prinit.c", 142 "/nsprpub/pr/src/misc/prinrval.c", 143 "/nsprpub/pr/src/misc/pripc.c", 144 "/nsprpub/pr/src/misc/prlog2.c", 145 "/nsprpub/pr/src/misc/prnetdb.c", 146 "/nsprpub/pr/src/misc/prrng.c", 147 "/nsprpub/pr/src/misc/prsystem.c", 148 "/nsprpub/pr/src/misc/prtime.c", 149 "/nsprpub/pr/src/misc/prtpool.c", 150 "/nsprpub/pr/src/threads/prcmon.c", 151 "/nsprpub/pr/src/threads/prrwlock.c", 152 "/nsprpub/pr/src/threads/prtpd.c", 153 ] 154 155 if CONFIG["OS_TARGET"] != "WINNT": 156 DEFINES["_PR_PTHREADS"] = True 157 UNIFIED_SOURCES += [ 158 "/nsprpub/pr/src/md/unix/unix.c", 159 "/nsprpub/pr/src/md/unix/unix_errors.c", 160 "/nsprpub/pr/src/md/unix/uxproces.c", 161 "/nsprpub/pr/src/md/unix/uxrng.c", 162 "/nsprpub/pr/src/md/unix/uxshm.c", 163 "/nsprpub/pr/src/pthreads/ptio.c", 164 "/nsprpub/pr/src/pthreads/ptmisc.c", 165 "/nsprpub/pr/src/pthreads/ptsynch.c", 166 "/nsprpub/pr/src/pthreads/ptthread.c", 167 ] 168 else: 169 SOURCES += [ 170 # ntinrval.c needs windows.h without WIN32_LEAN_AND_MEAN, so it can't be 171 # unified after any file that pulled in windows.h in lean-and-mean mode. 172 "/nsprpub/pr/src/md/windows/ntinrval.c", 173 # w32poll.c needs a custom value of FD_SETSIZE for winsock.h. 174 "/nsprpub/pr/src/md/windows/w32poll.c", 175 # w95sock.c needs winsock2.h which conflicts with winsock.h. 176 "/nsprpub/pr/src/md/windows/w95sock.c", 177 ] 178 UNIFIED_SOURCES += [ 179 "/nsprpub/pr/src/io/prdir.c", 180 "/nsprpub/pr/src/io/prfile.c", 181 "/nsprpub/pr/src/io/prio.c", 182 "/nsprpub/pr/src/io/prsocket.c", 183 "/nsprpub/pr/src/md/windows/ntgc.c", 184 "/nsprpub/pr/src/md/windows/ntmisc.c", 185 "/nsprpub/pr/src/md/windows/ntsec.c", 186 "/nsprpub/pr/src/md/windows/ntsem.c", 187 "/nsprpub/pr/src/md/windows/w32ipcsem.c", 188 "/nsprpub/pr/src/md/windows/w32rng.c", 189 "/nsprpub/pr/src/md/windows/w32shm.c", 190 "/nsprpub/pr/src/md/windows/w95cv.c", 191 "/nsprpub/pr/src/md/windows/w95dllmain.c", 192 "/nsprpub/pr/src/md/windows/w95io.c", 193 "/nsprpub/pr/src/md/windows/w95thred.c", 194 "/nsprpub/pr/src/md/windows/win32_errors.c", 195 "/nsprpub/pr/src/misc/pripcsem.c", 196 "/nsprpub/pr/src/threads/combined/prucpu.c", 197 "/nsprpub/pr/src/threads/combined/prucv.c", 198 "/nsprpub/pr/src/threads/combined/prulock.c", 199 "/nsprpub/pr/src/threads/combined/prustack.c", 200 "/nsprpub/pr/src/threads/combined/pruthr.c", 201 "/nsprpub/pr/src/threads/prcthr.c", 202 "/nsprpub/pr/src/threads/prdump.c", 203 "/nsprpub/pr/src/threads/prmon.c", 204 "/nsprpub/pr/src/threads/prsem.c", 205 ] 206 207 EXPORTS.nspr += [ 208 "/nsprpub/pr/include/nspr.h", 209 "/nsprpub/pr/include/pratom.h", 210 "/nsprpub/pr/include/prbit.h", 211 "/nsprpub/pr/include/prclist.h", 212 "/nsprpub/pr/include/prcmon.h", 213 "/nsprpub/pr/include/prcvar.h", 214 "/nsprpub/pr/include/prdtoa.h", 215 "/nsprpub/pr/include/prenv.h", 216 "/nsprpub/pr/include/prerr.h", 217 "/nsprpub/pr/include/prerror.h", 218 "/nsprpub/pr/include/prinet.h", 219 "/nsprpub/pr/include/prinit.h", 220 "/nsprpub/pr/include/prinrval.h", 221 "/nsprpub/pr/include/prio.h", 222 "/nsprpub/pr/include/pripcsem.h", 223 "/nsprpub/pr/include/prlink.h", 224 "/nsprpub/pr/include/prlock.h", 225 "/nsprpub/pr/include/prlog.h", 226 "/nsprpub/pr/include/prlong.h", 227 "/nsprpub/pr/include/prmem.h", 228 "/nsprpub/pr/include/prmon.h", 229 "/nsprpub/pr/include/prmwait.h", 230 "/nsprpub/pr/include/prnetdb.h", 231 "/nsprpub/pr/include/prpdce.h", 232 "/nsprpub/pr/include/prprf.h", 233 "/nsprpub/pr/include/prproces.h", 234 "/nsprpub/pr/include/prrng.h", 235 "/nsprpub/pr/include/prrwlock.h", 236 "/nsprpub/pr/include/prshm.h", 237 "/nsprpub/pr/include/prshma.h", 238 "/nsprpub/pr/include/prsystem.h", 239 "/nsprpub/pr/include/prthread.h", 240 "/nsprpub/pr/include/prtime.h", 241 "/nsprpub/pr/include/prtpool.h", 242 "/nsprpub/pr/include/prtrace.h", 243 "/nsprpub/pr/include/prtypes.h", 244 "/nsprpub/pr/include/prvrsion.h", 245 ] 246 247 EXPORTS.nspr.md += [ 248 "/nsprpub/pr/include/md/_darwin.cfg", 249 "/nsprpub/pr/include/md/_freebsd.cfg", 250 "/nsprpub/pr/include/md/_linux.cfg", 251 "/nsprpub/pr/include/md/_netbsd.cfg", 252 "/nsprpub/pr/include/md/_openbsd.cfg", 253 "/nsprpub/pr/include/md/_solaris.cfg", 254 "/nsprpub/pr/include/md/_win95.cfg", 255 ] 256 257 EXPORTS.nspr.private += [ 258 "/nsprpub/pr/include/private/pprio.h", 259 "/nsprpub/pr/include/private/pprthred.h", 260 "/nsprpub/pr/include/private/prpriv.h", 261 ]