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/.
8 @depends(build_project)
9 def js_standalone(build_project):
10 if build_project == "js":
15 # ==============================================================
20 help="Used for e.g. the binary program file name. If not set, "
21 "defaults to a lowercase form of MOZ_APP_BASENAME.",
25 @depends("--with-app-name", js_standalone, moz_app_basename)
26 def moz_app_name(value, js_standalone, moz_app_basename):
31 return moz_app_basename.lower()
34 set_config("MOZ_APP_NAME", moz_app_name)
36 # SmooshMonkey (new frontend)
37 # ==================================================
39 # Define here in order to use the option from bindgen.configure.
43 help="Enable SmooshMonkey (new JS engine frontend)",
47 @depends("--enable-smoosh")
48 def enable_smoosh(value):
53 set_config("JS_ENABLE_SMOOSH", enable_smoosh)
54 set_define("JS_ENABLE_SMOOSH", enable_smoosh)
56 include("../build/moz.configure/nspr.configure", when="--enable-compile-environment")
57 include("../build/moz.configure/rust.configure", when="--enable-compile-environment")
58 include("../build/moz.configure/bindgen.configure", when="--enable-compile-environment")
60 set_config("JS_STANDALONE", js_standalone)
61 set_define("JS_STANDALONE", js_standalone)
62 add_old_configure_assignment("JS_STANDALONE", js_standalone)
64 "--enable-js-shell", default=js_standalone, help="{Build|Do not build} the JS shell"
68 @depends("--enable-js-shell")
69 def js_disable_shell(value):
74 set_config("JS_DISABLE_SHELL", js_disable_shell)
76 set_define("JS_64BIT", depends(target)(lambda t: t.bitness == 64 or None))
78 set_define("JS_PUNBOX64", depends(target)(lambda t: t.bitness == 64 or None))
79 set_define("JS_NUNBOX32", depends(target)(lambda t: t.bitness == 32 or None))
82 # SpiderMonkey as a shared library, and how its symbols are exported
83 # ==================================================================
85 "--disable-shared-js",
87 help="{Create|Do not create} a shared library",
91 "--disable-export-js",
93 help="{Mark|Do not mark} JS symbols as DLL exported/visible",
97 @depends("--disable-shared-js", "--disable-export-js", when=js_standalone)
98 def shared_js(shared_js, export_js):
101 die("Must export JS symbols when building a shared library.")
105 set_config("JS_SHARED_LIBRARY", shared_js)
106 add_old_configure_assignment("JS_SHARED_LIBRARY", shared_js)
109 @depends(shared_js, "--disable-export-js", when=js_standalone)
110 def exportable_js_api(shared_js, export_js):
111 if not shared_js and export_js:
115 set_define("STATIC_EXPORTABLE_JS_API", exportable_js_api)
118 @depends(shared_js, exportable_js_api)
119 def static_js_api(shared_js, export_js):
120 if not shared_js and not export_js:
124 set_define("STATIC_JS_API", static_js_api)
128 def static_js(value):
133 set_define("MOZ_STATIC_JS", static_js)
136 option(env="NO_RUST_PANIC_HOOK", when=js_standalone, help="Disable rust panic hook")
138 set_define("NO_RUST_PANIC_HOOK", True, when="NO_RUST_PANIC_HOOK")
142 # =======================================================
144 def jit_default(target):
145 if target.cpu in ("x86", "x86_64", "arm", "aarch64", "mips32", "mips64"):
150 option("--enable-jit", default=jit_default, help="{Enable|Disable} use of the JITs")
153 @deprecated_option("--enable-ion")
154 def report_deprecated(value):
156 die("--enable-ion is deprecated, use --enable-jit instead")
158 die("--disable-ion is deprecated, use --disable-jit instead")
161 # JIT code simulator for cross compiles
162 # =======================================================
164 "--enable-simulator",
165 choices=("arm", "arm64", "mips32", "mips64"),
167 help="Enable a JIT code simulator for the specified architecture",
171 @depends("--enable-jit", "--enable-simulator", target, "--help")
172 def simulator(jit_enabled, simulator_enabled, target, _):
173 if not jit_enabled or not simulator_enabled:
176 sim_cpu = simulator_enabled[0]
178 if sim_cpu in ("arm", "mips32"):
179 if target.cpu != "x86":
180 die("The %s simulator only works on x86." % sim_cpu)
182 if sim_cpu in ("arm64", "mips64"):
183 if target.cpu != "x86_64":
184 die("The %s simulator only works on x86-64." % sim_cpu)
186 return namespace(**{sim_cpu: True})
189 set_config("JS_SIMULATOR", depends_if(simulator)(lambda x: True))
190 set_config("JS_SIMULATOR_ARM", simulator.arm)
191 set_config("JS_SIMULATOR_ARM64", simulator.arm64)
192 set_config("JS_SIMULATOR_MIPS32", simulator.mips32)
193 set_config("JS_SIMULATOR_MIPS64", simulator.mips64)
194 set_define("JS_SIMULATOR", depends_if(simulator)(lambda x: True))
195 set_define("JS_SIMULATOR_ARM", simulator.arm)
196 set_define("JS_SIMULATOR_ARM64", simulator.arm64)
197 set_define("JS_SIMULATOR_MIPS32", simulator.mips32)
198 set_define("JS_SIMULATOR_MIPS64", simulator.mips64)
201 @depends("--enable-jit", simulator, target)
202 def jit_codegen(jit_enabled, simulator, target):
204 return namespace(none=True)
209 if target.cpu == "aarch64":
210 return namespace(arm64=True)
211 elif target.cpu == "x86_64":
212 return namespace(x64=True)
214 return namespace(**{str(target.cpu): True})
217 set_config("JS_CODEGEN_NONE", jit_codegen.none)
218 set_config("JS_CODEGEN_ARM", jit_codegen.arm)
219 set_config("JS_CODEGEN_ARM64", jit_codegen.arm64)
220 set_config("JS_CODEGEN_MIPS32", jit_codegen.mips32)
221 set_config("JS_CODEGEN_MIPS64", jit_codegen.mips64)
222 set_config("JS_CODEGEN_X86", jit_codegen.x86)
223 set_config("JS_CODEGEN_X64", jit_codegen.x64)
224 set_define("JS_CODEGEN_NONE", jit_codegen.none)
225 set_define("JS_CODEGEN_ARM", jit_codegen.arm)
226 set_define("JS_CODEGEN_ARM64", jit_codegen.arm64)
227 set_define("JS_CODEGEN_MIPS32", jit_codegen.mips32)
228 set_define("JS_CODEGEN_MIPS64", jit_codegen.mips64)
229 set_define("JS_CODEGEN_X86", jit_codegen.x86)
230 set_define("JS_CODEGEN_X64", jit_codegen.x64)
233 # =======================================================
235 "--enable-instruments",
236 env="MOZ_INSTRUMENTS",
237 help="Enable instruments remote profiling",
241 @depends("--enable-instruments", target)
242 def instruments(value, target):
243 if value and target.os != "OSX":
244 die("--enable-instruments cannot be used when targeting %s", target.os)
249 set_config("MOZ_INSTRUMENTS", instruments)
250 set_define("MOZ_INSTRUMENTS", instruments)
251 add_old_configure_assignment("MOZ_INSTRUMENTS", instruments)
252 imply_option("--enable-profiling", instruments, reason="--enable-instruments")
254 option("--enable-callgrind", env="MOZ_CALLGRIND", help="Enable callgrind profiling")
257 @depends("--enable-callgrind")
258 def callgrind(value):
263 set_define("MOZ_CALLGRIND", callgrind)
264 imply_option("--enable-profiling", callgrind)
268 def enable_profiling(milestone):
269 return milestone.is_nightly
273 "--enable-profiling",
275 default=enable_profiling,
276 help="{Set|Do not set} compile flags necessary for using sampling "
277 "profilers (e.g. shark, perf)",
281 @depends("--enable-profiling")
282 def profiling(value):
287 add_old_configure_assignment("MOZ_PROFILING", profiling)
289 with only_when("--enable-compile-environment"):
290 imply_option("--enable-frame-pointers", True, when=profiling)
293 @depends(profiling, target)
294 def imply_vtune(value, target):
295 ok_cpu = target.cpu in ["x86", "x86_64"]
296 ok_kernel = target.kernel == "WINNT" or (
297 target.kernel == "Linux" and target.os == "GNU"
300 if value and ok_cpu and ok_kernel:
304 set_config("MOZ_PROFILING", profiling)
305 set_define("MOZ_PROFILING", profiling)
306 imply_option("--enable-vtune", imply_vtune, reason="--enable-profiling")
309 option("--enable-vtune", env="MOZ_VTUNE", help="Enable VTune profiling")
312 @depends("--enable-vtune")
318 set_config("MOZ_VTUNE", vtune)
319 set_define("MOZ_VTUNE", vtune)
323 "--enable-gc-probes",
325 help="Turn on probes for allocation and finalization",
329 @depends("--enable-gc-probes")
330 def gc_probes(value):
335 set_define("JS_GC_PROBES", gc_probes)
340 default=depends(when=moz_debug)(lambda: True),
341 help="{Enable|Disable} zealous GCing",
344 set_define("JS_GC_ZEAL", depends_if("--enable-gczeal")(lambda _: True))
347 # Use a smaller chunk size for GC chunks
348 # ========================================================
349 # Use large (1MB) chunks by default. This option can be used to give
350 # smaller (currently 256K) chunks.
352 "--enable-small-chunk-size",
353 help="Allocate memory for JS GC things in smaller chunks",
357 "JS_GC_SMALL_CHUNK_SIZE", depends(when="--enable-small-chunk-size")(lambda: True)
362 # =======================================================
364 def default_trace_logging(milestone):
365 return milestone.is_nightly
369 "--enable-trace-logging",
370 default=default_trace_logging,
371 help="{Enable|Disable} trace logging",
374 set_config("ENABLE_TRACE_LOGGING", depends_if("--enable-trace-logging")(lambda x: True))
375 set_define("JS_TRACE_LOGGING", depends_if("--enable-trace-logging")(lambda x: True))
378 # Enable breakpoint for artificial OOMs
379 # =======================================================
381 "--enable-oom-breakpoint", help="Enable a breakpoint function for artificial OOMs"
384 set_define("JS_OOM_BREAKPOINT", depends_if("--enable-oom-breakpoint")(lambda _: True))
387 option("--enable-perf", env="JS_ION_PERF", help="Enable Linux perf integration")
390 @depends("--enable-perf")
396 set_define("JS_ION_PERF", ion_perf)
401 default=depends(when=moz_debug)(lambda: True),
402 help="{Enable|Disable} the Jit spew and IONFLAGS environment " "variable",
405 set_define("JS_JITSPEW", depends_if("--enable-jitspew")(lambda _: True))
406 set_config("JS_JITSPEW", depends_if("--enable-jitspew")(lambda _: True))
408 # Also enable the structured spewer
409 set_define("JS_STRUCTURED_SPEW", depends_if("--enable-jitspew")(lambda _: True))
410 set_config("JS_STRUCTURED_SPEW", depends_if("--enable-jitspew")(lambda _: True))
413 @depends("--enable-jit", "--enable-jitspew", simulator, target, moz_debug)
414 def jit_disasm_arm(jit_enabled, spew, simulator, target, debug):
418 if simulator and (debug or spew):
419 if getattr(simulator, "arm", None):
422 if target.cpu == "arm" and (debug or spew):
426 set_config("JS_DISASM_ARM", jit_disasm_arm)
427 set_define("JS_DISASM_ARM", jit_disasm_arm)
430 @depends("--enable-jit", "--enable-jitspew", simulator, target, moz_debug)
431 def jit_disasm_arm64(jit_enabled, spew, simulator, target, debug):
435 if simulator and (debug or spew):
436 if getattr(simulator, "arm64", None):
439 if target.cpu == "aarch64" and (debug or spew):
443 set_config("JS_DISASM_ARM64", jit_disasm_arm64)
444 set_define("JS_DISASM_ARM64", jit_disasm_arm64)
446 # When enabled, masm will generate assumeUnreachable calls that act as
447 # assertions in the generated code. This option is worth disabling when you
448 # have to track mutated values through the generated code, to avoid constantly
449 # dumping registers on and off the stack.
451 "--enable-masm-verbose",
452 default=depends(when=moz_debug)(lambda: True),
453 help="{Enable|Disable} MacroAssembler verbosity of generated code.",
455 set_define("JS_MASM_VERBOSE", depends_if("--enable-masm-verbose")(lambda _: True))
456 set_config("JS_MASM_VERBOSE", depends_if("--enable-masm-verbose")(lambda _: True))
460 "--enable-more-deterministic",
461 env="JS_MORE_DETERMINISTIC",
462 help="Enable changes that make the shell more deterministic",
466 @depends("--enable-more-deterministic")
467 def more_deterministic(value):
472 set_define("JS_MORE_DETERMINISTIC", more_deterministic)
476 # =======================================================
477 @depends(js_standalone)
478 def ctypes_default(js_standalone):
479 return not js_standalone
482 option("--enable-ctypes", default=ctypes_default, help="{Enable|Disable} js-ctypes")
484 build_ctypes = depends_if("--enable-ctypes")(lambda _: True)
486 set_config("BUILD_CTYPES", build_ctypes)
487 set_define("BUILD_CTYPES", build_ctypes)
489 set_config("JS_HAS_CTYPES", build_ctypes)
490 set_define("JS_HAS_CTYPES", build_ctypes)
493 @depends("--enable-ctypes", "--enable-compile-environment")
494 def ctypes_and_compile_environment(ctypes, compile_environment):
495 return ctypes and compile_environment
498 include("ffi.configure", when=ctypes_and_compile_environment)
501 # Enable pipeline operator
502 # ===================================================
503 option("--enable-pipeline-operator", default=False, help="Enable pipeline operator")
506 @depends("--enable-pipeline-operator")
507 def enable_pipeline_operator(value):
512 set_config("ENABLE_PIPELINE_OPERATOR", enable_pipeline_operator)
513 set_define("ENABLE_PIPELINE_OPERATOR", enable_pipeline_operator)
516 # SIMD acceleration for encoding_rs
517 # ==============================================================
520 "--enable-rust-simd", env="MOZ_RUST_SIMD", help="Enable explicit SIMD in Rust code."
524 @depends("--enable-rust-simd", target)
525 def rust_simd(value, target):
526 # As of 2019-09-17, the simd-accel feature of encoding_rs has not
527 # been properly set up outside aarch64, armv7, x86 and x86_64.
528 if target.cpu in ("aarch64", "arm", "x86", "x86_64") and value:
532 set_config("MOZ_RUST_SIMD", rust_simd)
533 set_define("MOZ_RUST_SIMD", rust_simd)
536 # Support for wasm code generation with Cranelift
537 # ==============================================================
541 milestone.is_nightly,
543 "--enable-simulator",
547 def cranelift_default(is_nightly, jit_enabled, simulator, target, is_windows):
548 if is_nightly and jit_enabled and not is_windows:
549 if target.cpu == "aarch64":
551 if simulator and simulator[0] == "arm64":
556 "--enable-cranelift",
557 default=cranelift_default,
558 help="{Enable|Disable} Cranelift code generator for wasm",
561 set_config("ENABLE_WASM_CRANELIFT", depends_if("--enable-cranelift")(lambda x: True))
562 set_define("ENABLE_WASM_CRANELIFT", depends_if("--enable-cranelift")(lambda x: True))
564 # Telemetry to measure compile time and generated-code runtime
565 # ============================================================
568 "--enable-spidermonkey-telemetry",
569 default=milestone.is_nightly,
570 help="{Enable|Disable} performance telemetry for SpiderMonkey (e.g. compile and run times)",
574 "ENABLE_SPIDERMONKEY_TELEMETRY",
575 depends_if("--enable-spidermonkey-telemetry")(lambda x: True),
578 # Support for debugging code generated by wasm backends
579 # =====================================================
582 "--enable-wasm-codegen-debug",
583 default=depends(when=moz_debug)(lambda: True),
584 help="{Enable|Disable} debugging for wasm codegen",
588 "WASM_CODEGEN_DEBUG", depends_if("--enable-wasm-codegen-debug")(lambda x: True)
591 "WASM_CODEGEN_DEBUG", depends_if("--enable-wasm-codegen-debug")(lambda x: True)
594 # Support for WebAssembly reference types.
595 # =====================================================
597 option("--disable-wasm-reftypes", help="Disable WebAssembly reference types")
600 @depends("--disable-wasm-reftypes")
601 def enable_wasm_reftypes(value):
606 set_config("ENABLE_WASM_REFTYPES", enable_wasm_reftypes)
607 set_define("ENABLE_WASM_REFTYPES", enable_wasm_reftypes)
609 # Support for WebAssembly function-references.
610 # ===========================
613 @depends(milestone.is_nightly, "--disable-wasm-reftypes")
614 def default_wasm_function_references(is_nightly, reftypes):
615 if is_nightly and reftypes:
620 "--enable-wasm-function-references",
621 default=default_wasm_function_references,
622 help="{Enable|Disable} WebAssembly function-references",
626 @depends("--enable-wasm-function-references", "--disable-wasm-reftypes")
627 def wasm_function_references(value, reftypes):
635 "--enable-wasm-function-references only possible without --disable-wasm-reftypes"
639 set_config("ENABLE_WASM_FUNCTION_REFERENCES", wasm_function_references)
640 set_define("ENABLE_WASM_FUNCTION_REFERENCES", wasm_function_references)
642 # Support for WebAssembly GC.
643 # ===========================
646 @depends(milestone.is_nightly, "--enable-wasm-function-references")
647 def default_wasm_gc(is_nightly, function_references):
648 if is_nightly and function_references:
653 "--enable-wasm-gc", default=default_wasm_gc, help="{Enable|Disable} WebAssembly GC"
657 @depends("--enable-wasm-gc", "--enable-wasm-function-references")
658 def wasm_gc(value, function_references):
662 if function_references:
665 die("--enable-wasm-gc only possible with --enable-wasm-function-references")
668 set_config("ENABLE_WASM_GC", wasm_gc)
669 set_define("ENABLE_WASM_GC", wasm_gc)
672 # Support for WebAssembly private ref types.
673 # Prevent (ref T) types from being exposed to JS content so that wasm need do
674 # no typechecking at the JS/wasm boundary
675 # ===========================================================================
678 @depends(milestone.is_nightly, "--enable-wasm-gc")
679 def default_wasm_private_reftypes(is_nightly, gc):
680 if gc and is_nightly:
685 "--enable-wasm-private-reftypes",
686 default=default_wasm_private_reftypes,
687 help="{Enable|Disable} WebAssembly private reference types",
691 "WASM_PRIVATE_REFTYPES",
692 depends_if("--enable-wasm-private-reftypes")(lambda x: True),
695 "WASM_PRIVATE_REFTYPES",
696 depends_if("--enable-wasm-private-reftypes")(lambda x: True),
700 # Support for the WebAssembly multi-value proposal.
701 # Do not remove until Cranelift supports multi-value.
702 # =====================================================
705 "--disable-wasm-multi-value",
706 help="Disable WebAssembly multi-value blocks and function calls",
710 @depends("--disable-wasm-multi-value")
711 def enable_wasm_multi_value(value):
716 set_config("ENABLE_WASM_MULTI_VALUE", enable_wasm_multi_value)
717 set_define("ENABLE_WASM_MULTI_VALUE", enable_wasm_multi_value)
720 # Support for WebAssembly shared memory and atomics.
722 # This affects the JS shell only and here to allow the use of
723 # Cranelift in the shell. Once Cranelift supports shared memory
724 # and atomics it can go away.
725 # =====================================================
728 "--disable-shared-memory", help="Disable JS/WebAssembly shared memory and atomics"
732 @depends("--disable-shared-memory")
733 def enable_shared_memory(value):
738 set_config("ENABLE_SHARED_MEMORY", enable_shared_memory)
739 set_define("ENABLE_SHARED_MEMORY", enable_shared_memory)
742 # Support for WebAssembly SIMD
743 # =====================================================
746 @depends("--enable-jit", "--enable-simulator", target)
747 def default_wasm_simd(jit_enabled, simulator, target):
748 if not jit_enabled or simulator:
751 if target.cpu in ("x86_64", "x86", "aarch64"):
756 "--enable-wasm-simd",
757 default=default_wasm_simd,
758 help="{Enable|Disable} WebAssembly SIMD",
762 @depends("--enable-wasm-simd", "--enable-jit", "--enable-simulator", target)
763 def wasm_simd(value, jit_enabled, simulator, target):
767 if jit_enabled and not simulator:
768 if target.cpu in ("x86_64", "x86", "aarch64"):
771 if jit_enabled and simulator and simulator[0] == "arm64":
774 die("--enable-wasm-simd only possible when targeting the x86_64/x86/arm64 jits")
777 set_config("ENABLE_WASM_SIMD", wasm_simd)
778 set_define("ENABLE_WASM_SIMD", wasm_simd)
780 # Experimental SIMD opcodes are Nightly-only by default
783 @depends(milestone.is_nightly, "--enable-wasm-simd")
784 def default_wasm_simd_experimental(is_nightly, wasm_simd):
785 if is_nightly and wasm_simd:
790 "--enable-wasm-simd-experimental",
791 default=default_wasm_simd_experimental,
792 help="{Enable|Disable} WebAssembly SIMD experimental opcodes",
796 @depends("--enable-wasm-simd-experimental", "--enable-wasm-simd")
797 def wasm_simd_experimental(value, wasm_simd):
804 die("--enable-wasm-simd-experimental only possible with --enable-wasm-simd")
807 set_config("ENABLE_WASM_SIMD_EXPERIMENTAL", wasm_simd_experimental)
808 set_define("ENABLE_WASM_SIMD_EXPERIMENTAL", wasm_simd_experimental)
810 # Options for generating the shell as a script
811 # ============================================
812 option("--with-qemu-exe", nargs=1, help="Use path as an arm emulator on host platforms")
813 set_config("QEMU_EXE", depends_if("--with-qemu-exe")(lambda x: x))
818 default=depends(target.alias)(lambda x: "/usr/%s" % x),
819 help="Use dir as the location for arm libraries",
821 set_config("CROSS_LIB", depends_if("--with-cross-lib")(lambda x: x))
823 # Enable static checking using sixgill
824 # ====================================
826 option("--with-sixgill", nargs=1, help="Enable static checking of code using sixgill")
829 @depends_if("--with-sixgill")
832 for f in ("bin/xdbfind", "gcc/xgill.so", "scripts/wrap_gcc/g++"):
833 if not os.path.exists(os.path.join(value[0], f)):
834 die("The sixgill plugin and binaries are not at the specified path")
838 set_config("SIXGILL_PATH", sixgill)
841 # Support for readline
842 # =====================================================
843 @depends("--enable-js-shell", target_is_windows, compile_environment)
844 def editline(js_shell, is_windows, compile_environment):
845 return js_shell and not is_windows and compile_environment
849 "--enable-readline", help="Link js shell to system readline library", when=editline
852 has_readline = check_symbol(
854 flags=["-lreadline"],
855 when="--enable-readline",
856 onerror=lambda: die("No system readline library found"),
859 set_config("EDITLINE_LIBS", ["-lreadline"], when=has_readline)
862 @depends("--enable-readline", editline, when=editline)
863 def bundled_editline(readline, editline):
864 return editline and not readline
867 set_config("JS_BUNDLED_EDITLINE", bundled_editline)
869 set_define("EDITLINE", True, when=editline)
876 "--with-jitreport-granularity",
878 choices=("0", "1", "2", "3"),
879 help="Default granularity at which to report JIT code to external tools "
880 "(0 - no info, 1 - code ranges for while functions only, "
881 "2 - per-line information, 3 - per-op information)",
885 "JS_DEFAULT_JITREPORT_GRANULARITY",
886 depends_if("--with-jitreport-granularity")(lambda value: value[0]),
890 # ECMAScript Internationalization API Support (uses ICU)
891 # ======================================================
892 option("--with-system-icu", help="Use system ICU")
894 system_icu = pkg_check_modules("MOZ_ICU", "icu-i18n >= 67.1", when="--with-system-icu")
896 set_config("MOZ_SYSTEM_ICU", True, when=system_icu)
897 set_define("MOZ_SYSTEM_ICU", True, when=system_icu)
899 option("--without-intl-api", help="Disable ECMAScript Internationalization API")
902 @depends("--with-intl-api", js_standalone)
903 def check_intl_api(enabled, js_standalone):
904 if not enabled and not js_standalone:
905 die("--without-intl-api is not supported")
908 set_config("JS_HAS_INTL_API", True, when="--with-intl-api")
909 set_define("JS_HAS_INTL_API", True, when="--with-intl-api")
912 @depends(check_build_environment, when="--with-intl-api")
913 @imports(_from="__builtin__", _import="open")
914 @imports(_from="__builtin__", _import="ValueError")
915 def icu_version(build_env):
917 build_env.topsrcdir, "intl", "icu", "source", "common", "unicode", "uvernum.h"
919 with open(path, encoding="utf-8") as fh:
921 if line.startswith("#define"):
922 define = line.split(None, 3)
923 if len(define) == 3 and define[1] == "U_ICU_VERSION_MAJOR_NUM":
925 return str(int(define[2]))
928 die("Cannot determine ICU version number from uvernum.h header file")
931 set_config("MOZ_ICU_VERSION", icu_version)
933 # Source files that use ICU should have control over which parts of the ICU
934 # namespace they want to use.
935 set_define("U_USING_ICU_NAMESPACE", "0", when="--with-intl-api")
937 # We build ICU as a static library.
938 set_define("U_STATIC_IMPLEMENTATION", True, when=depends(system_icu)(lambda x: not x))
941 @depends(yasm, gnu_as, target, compile_environment)
942 def can_build_data_file(yasm, gnu_as, target, compile_environment):
943 if not compile_environment or (
944 target.kernel == "WINNT" and target.cpu == "aarch64"
947 if not yasm and not gnu_as:
949 "Building ICU requires either yasm or a GNU assembler. If you do not have "
950 "either of those available for this platform you must use --without-intl-api"
954 # Initial support for WebAssembly JS-API Type Reflections
955 # =======================================================
958 @depends(milestone.is_nightly)
959 def default_wasm_type_reflections(is_nightly):
964 "--enable-wasm-type-reflections",
965 default=default_wasm_type_reflections,
966 help="{Enable|Disable} type reflection in WASM JS-API",
970 "ENABLE_WASM_TYPE_REFLECTIONS",
971 depends_if("--enable-wasm-type-reflections")(lambda x: True),
974 "ENABLE_WASM_TYPE_REFLECTIONS",
975 depends_if("--enable-wasm-type-reflections")(lambda x: True),