moz.build (10341B)
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 include("js-config.mozbuild") 8 include("js-cxxflags.mozbuild") 9 10 # Directory metadata 11 component_engine = ("Core", "JavaScript Engine") 12 component_gc = ("Core", "JavaScript: GC") 13 component_intl = ("Core", "JavaScript: Internationalization API") 14 component_jit = ("Core", "JavaScript Engine: JIT") 15 component_stl = ("Core", "JavaScript: Standard Library") 16 component_wasm = ("Core", "Javascript: Web Assembly") 17 18 FILES_PER_UNIFIED_FILE = 6 19 20 # Prevent redefining FILES_PER_UNIFIED_FILE in each sub-directory of js. This 21 # will not escape this directory. 22 export("FILES_PER_UNIFIED_FILE") 23 24 with Files("*"): 25 BUG_COMPONENT = component_engine 26 27 with Files("wasm/**"): 28 BUG_COMPONENT = component_wasm 29 with Files("builtin/**"): 30 BUG_COMPONENT = component_stl 31 with Files("ctypes/**"): 32 BUG_COMPONENT = ("Core", "js-ctypes") 33 with Files("gc/**"): 34 BUG_COMPONENT = component_gc 35 with Files("jit/**"): 36 BUG_COMPONENT = component_jit 37 38 # File-specific metadata 39 for gcfile in ["devtools/rootAnalysis", "devtools/gc-ubench", "devtools/gctrace"]: 40 with Files(gcfile): 41 BUG_COMPONENT = component_gc 42 43 for stlfile in ["jsdate.*", "jsnum.*"]: 44 with Files(stlfile): 45 BUG_COMPONENT = component_stl 46 47 with Files("builtin/intl/*"): 48 BUG_COMPONENT = component_intl 49 50 if not CONFIG["JS_DISABLE_SHELL"]: 51 DIRS += [ 52 "rust", 53 "shell", 54 ] 55 56 TEST_DIRS += [ 57 "gdb", 58 "jsapi-tests", 59 "tests", 60 ] 61 62 if CONFIG["FUZZING_INTERFACES"]: 63 TEST_DIRS += [ 64 "fuzz-tests", 65 ] 66 67 LegacyTest( 68 f"%{CONFIG['PYTHON3']}", 69 "/config/check_js_msg_encoding.py", 70 depends=["/config/check_js_msg_encoding.py"], 71 ) 72 73 if CONFIG["FUZZING_JS_FUZZILLI"]: 74 # When building for Fuzzilli, we instrument everything with standard 75 # trace-pc instrumentation. 76 include("/tools/fuzzing/libfuzzer-config.mozbuild") 77 78 CONFIGURE_DEFINE_FILES += [ 79 "js-confdefs.h", 80 ] 81 82 CONFIGURE_DEFINE_FILES += [ 83 "js-config.h", 84 ] 85 86 # Changes to internal header files, used externally, massively slow down 87 # browser builds. Don't add new files here unless you know what you're 88 # doing! 89 EXPORTS += [ 90 "!js-config.h", 91 "jsapi.h", 92 "jsfriendapi.h", 93 "jspubtd.h", 94 "jstypes.h", 95 ] 96 97 EXPORTS.js += [ 98 "!../public/PrefsGenerated.h", 99 "../public/AllocationLogging.h", 100 "../public/AllocationRecording.h", 101 "../public/AllocPolicy.h", 102 "../public/Array.h", 103 "../public/ArrayBuffer.h", 104 "../public/ArrayBufferMaybeShared.h", 105 "../public/BigInt.h", 106 "../public/BuildId.h", 107 "../public/CallAndConstruct.h", 108 "../public/CallArgs.h", 109 "../public/CallNonGenericMethod.h", 110 "../public/CharacterEncoding.h", 111 "../public/Class.h", 112 "../public/ColumnNumber.h", 113 "../public/ComparisonOperators.h", 114 "../public/CompilationAndEvaluation.h", 115 "../public/CompileOptions.h", 116 "../public/Context.h", 117 "../public/ContextOptions.h", 118 "../public/Conversions.h", 119 "../public/Date.h", 120 "../public/Debug.h", 121 "../public/DOMEventDispatch.h", 122 "../public/EnvironmentChain.h", 123 "../public/Equality.h", 124 "../public/ErrorInterceptor.h", 125 "../public/ErrorReport.h", 126 "../public/Exception.h", 127 "../public/ForOfIterator.h", 128 "../public/GCAnnotations.h", 129 "../public/GCAPI.h", 130 "../public/GCHashTable.h", 131 "../public/GCPolicyAPI.h", 132 "../public/GCTypeMacros.h", 133 "../public/GCVariant.h", 134 "../public/GCVector.h", 135 "../public/GlobalObject.h", 136 "../public/HashTable.h", 137 "../public/HeapAPI.h", 138 "../public/HelperThreadAPI.h", 139 "../public/Id.h", 140 "../public/Initialization.h", 141 "../public/Interrupt.h", 142 "../public/Iterator.h", 143 "../public/JSON.h", 144 "../public/LocaleSensitive.h", 145 "../public/MapAndSet.h", 146 "../public/MemoryCallbacks.h", 147 "../public/MemoryFunctions.h", 148 "../public/MemoryMetrics.h", 149 "../public/Modules.h", 150 "../public/NativeStackLimits.h", 151 "../public/Object.h", 152 "../public/ObjectWithStashedPointer.h", 153 "../public/Prefs.h", 154 "../public/Principals.h", 155 "../public/Printer.h", 156 "../public/Printf.h", 157 "../public/ProfilingCategory.h", 158 "../public/ProfilingFrameIterator.h", 159 "../public/ProfilingSources.h", 160 "../public/ProfilingStack.h", 161 "../public/Promise.h", 162 "../public/PropertyAndElement.h", 163 "../public/PropertyDescriptor.h", 164 "../public/PropertySpec.h", 165 "../public/ProtoKey.h", 166 "../public/Proxy.h", 167 "../public/Realm.h", 168 "../public/RealmIterators.h", 169 "../public/RealmOptions.h", 170 "../public/RefCounted.h", 171 "../public/RegExp.h", 172 "../public/RegExpFlags.h", 173 "../public/Result.h", 174 "../public/RootingAPI.h", 175 "../public/SavedFrameAPI.h", 176 "../public/ScalarType.h", 177 "../public/ScriptPrivate.h", 178 "../public/ShadowRealmCallbacks.h", 179 "../public/SharedArrayBuffer.h", 180 "../public/SliceBudget.h", 181 "../public/SourceText.h", 182 "../public/StableStringChars.h", 183 "../public/Stack.h", 184 "../public/StreamConsumer.h", 185 "../public/String.h", 186 "../public/StructuredClone.h", 187 "../public/SweepingAPI.h", 188 "../public/Symbol.h", 189 "../public/TelemetryTimers.h", 190 "../public/TraceKind.h", 191 "../public/TracingAPI.h", 192 "../public/Transcoding.h", 193 "../public/TypeDecls.h", 194 "../public/UbiNode.h", 195 "../public/UbiNodeBreadthFirst.h", 196 "../public/UbiNodeCensus.h", 197 "../public/UbiNodeDominatorTree.h", 198 "../public/UbiNodePostOrder.h", 199 "../public/UbiNodeShortestPaths.h", 200 "../public/UbiNodeUtils.h", 201 "../public/UniquePtr.h", 202 "../public/Utility.h", 203 "../public/Value.h", 204 "../public/ValueArray.h", 205 "../public/Vector.h", 206 "../public/WaitCallbacks.h", 207 "../public/Warnings.h", 208 "../public/WasmFeatures.h", 209 "../public/WasmModule.h", 210 "../public/WeakMap.h", 211 "../public/WeakMapPtr.h", 212 "../public/Wrapper.h", 213 "../public/WrapperCallbacks.h", 214 "../public/Zone.h", 215 ] 216 217 # Public APIs that are experimental: the precise contour of the APIs may still 218 # change, but they're at least plausible first passes at designing something. 219 # We expose them as-is, buyer beware. 220 EXPORTS.js.experimental += [ 221 "../public/experimental/BindingAllocs.h", 222 "../public/experimental/CodeCoverage.h", 223 "../public/experimental/CompileScript.h", 224 "../public/experimental/CTypes.h", 225 "../public/experimental/Intl.h", 226 "../public/experimental/JitInfo.h", 227 "../public/experimental/JSStencil.h", 228 "../public/experimental/LoggingInterface.h", 229 "../public/experimental/PCCountProfiling.h", 230 "../public/experimental/SourceHook.h", 231 "../public/experimental/TypedData.h", 232 ] 233 234 # Friend APIs are APIs that either basically SpiderMonkey-internal, or their 235 # contours are gross and terrible -- but the functionality is too important to 236 # some embedder (often, Gecko) to just not expose anything or to agonize through 237 # a clean design. Use this only if you absolutely must, and feel free to 238 # propose clean APIs to replace what's here! 239 EXPORTS.js.friend += [ 240 "../public/friend/DOMProxy.h", 241 "../public/friend/DumpFunctions.h", 242 "../public/friend/ErrorMessages.h", 243 "../public/friend/ErrorNumbers.msg", 244 "../public/friend/JSMEnvironment.h", 245 "../public/friend/MicroTask.h", 246 "../public/friend/PerformanceHint.h", 247 "../public/friend/StackLimits.h", 248 "../public/friend/UsageStatistics.h", 249 "../public/friend/WindowProxy.h", 250 "../public/friend/XrayJitInfo.h", 251 ] 252 253 # "Shadow" API defines the internal layout of public JSAPI types like |JSObject| 254 # and |JSString|, so that other *inline* public functions can efficiently access 255 # their internal fields. 256 # 257 # Embedders must never include these headers themselves or use their contents. 258 # These internal layout details are publicly exposed for access *only* so that 259 # other public API definitions may use them. 260 # 261 # When adding new shadow structure definitions (or new fields/static constants 262 # to existing structures) for access by inline methods, make sure to add static 263 # asserts to the original header file to ensure that offsets and duplicated 264 # constants are consistent. (Long term, it might be worth figuring out some way 265 # to back actual implementations *with* these shadow definitions to eliminate 266 # this requirement.) 267 EXPORTS.js.shadow += [ 268 "../public/shadow/Function.h", 269 "../public/shadow/Object.h", 270 "../public/shadow/Realm.h", 271 "../public/shadow/Shape.h", 272 "../public/shadow/String.h", 273 "../public/shadow/Symbol.h", 274 "../public/shadow/Zone.h", 275 ] 276 277 UNIFIED_SOURCES += [ 278 "jsapi.cpp", 279 "jsdate.cpp", 280 "jsexn.cpp", 281 "jsfriendapi.cpp", 282 "jsnum.cpp", 283 ] 284 285 # jsmath.cpp cannot be built in unified mode because it needs to re-#define the 286 # RtlGenRandom declaration's calling convention in <ntsecapi.h> on Windows. 287 SOURCES += [ 288 "jsmath.cpp", 289 ] 290 291 if CONFIG["MOZ_INSTRUMENTS"]: 292 OS_LIBS += ["-framework CoreFoundation"] 293 SOURCES += [ 294 "devtools/Instruments.cpp", 295 ] 296 297 DIRS += [ 298 "build", 299 "builtin", 300 "debugger", 301 "ds", 302 "frontend", 303 "gc", 304 "irregexp", 305 "jit", 306 "proxy", 307 "threading", 308 "util", 309 "vm", 310 "wasm", 311 "xsum", 312 ] 313 314 if CONFIG["JS_HAS_CTYPES"]: 315 DIRS += ["ctypes"] 316 317 if CONFIG["MOZ_VTUNE"]: 318 DIRS += ["vtune"] 319 320 if CONFIG["JS_HAS_INTL_API"]: 321 DIRS += ["builtin/intl", "builtin/temporal"] 322 323 CXXFLAGS += CONFIG["MOZ_ZLIB_CFLAGS"] 324 325 # Bug 1722102 - This should never be enabled in Release without explicit 326 # security and SpiderMonkey review. 327 # See https://bugzilla.mozilla.org/show_bug.cgi?id=1722102#c16 328 if CONFIG["ENABLE_WASM_MOZ_INTGEMM"]: 329 DIRS += ["intgemm"] 330 331 if CONFIG["JS_JITSPEW"]: 332 DIRS += ["zydis"] 333 334 FINAL_LIBRARY = "js" 335 336 GeneratedFile( 337 "../public/PrefsGenerated.h", 338 script="GeneratePrefs.py", 339 entry_point="generate_prefs_header", 340 inputs=["../../modules/libpref/init/StaticPrefList.yaml"], 341 ) 342 343 if CONFIG["JS_HAS_INTL_API"]: 344 if CONFIG["JS_STANDALONE"]: 345 DIRS += [ 346 "../../intl/bidi", 347 "../../intl/components", 348 ] 349 350 USE_LIBS += ["intlcomponents"]