forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
/
moz.configure
3221 lines (2438 loc) · 93.1 KB
/
moz.configure
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- 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/.
# Set the MOZ_CONFIGURE_OPTIONS variable with all the options that
# were passed somehow (environment, command line, mozconfig)
@dependable
@imports(_from="mozbuild.shellutil", _import="quote")
@imports(_from="mozbuild.util", _import="ensure_unicode")
@imports(_from="mozbuild.util", _import="system_encoding")
@imports("__sandbox__")
def all_configure_options():
result = []
previous = None
for option in __sandbox__._options.values():
# __sandbox__._options contains items for both option.name and
# option.env. But it's also an OrderedDict, meaning both are
# consecutive.
# Also ignore OLD_CONFIGURE and MOZCONFIG because they're not
# interesting.
if option == previous or option.env in ("OLD_CONFIGURE", "MOZCONFIG"):
continue
previous = option
value = __sandbox__._value_for(option)
# We only want options that were explicitly given on the command
# line, the environment, or mozconfig, and that differ from the
# defaults.
if (
value is not None
and value.origin not in ("default", "implied")
and value != option.default
):
result.append(
ensure_unicode(__sandbox__._raw_options[option], system_encoding)
)
# We however always include options that are sent to old configure
# because we don't know their actual defaults. (Keep the conditions
# separate for ease of understanding and ease of removal)
elif (
option.help == "Help missing for old configure options"
and option in __sandbox__._raw_options
):
result.append(
ensure_unicode(__sandbox__._raw_options[option], system_encoding)
)
# We shouldn't need this, but currently, quote will return a byte string
# if result is empty, and that's not wanted here.
if not result:
return ""
return quote(*result)
set_config("MOZ_CONFIGURE_OPTIONS", all_configure_options)
@depends(target)
def fold_libs(target):
return target.os in ("WINNT", "OSX", "Android")
set_config("MOZ_FOLD_LIBS", fold_libs)
# Profiling
# ==============================================================
# Some of the options here imply an option from js/moz.configure,
# so, need to be declared before the include.
option(
"--enable-jprof",
env="MOZ_JPROF",
help="Enable jprof profiling tool (needs mozilla/tools/jprof)",
)
@depends("--enable-jprof")
def jprof(value):
if value:
return True
set_config("MOZ_JPROF", jprof)
set_define("MOZ_JPROF", jprof)
imply_option("--enable-profiling", jprof)
@depends(target)
def gecko_profiler(target):
if target.os == "Android":
return target.cpu in ("aarch64", "arm", "x86", "x86_64")
elif target.kernel == "Linux":
return target.cpu in ("aarch64", "arm", "x86", "x86_64", "mips64")
elif target.kernel == "FreeBSD":
return target.cpu in ("aarch64", "x86_64")
return target.os in ("OSX", "WINNT")
@depends(gecko_profiler)
def gecko_profiler_define(value):
if value:
return True
set_config("MOZ_GECKO_PROFILER", gecko_profiler_define)
set_define("MOZ_GECKO_PROFILER", gecko_profiler_define)
# Whether code to parse ELF binaries should be compiled for the Gecko profiler
# (for symbol table dumping).
@depends(gecko_profiler, target)
def gecko_profiler_parse_elf(value, target):
# Currently we only want to build this code on Linux (including Android) and BSD.
# For Android, this is in order to dump symbols from Android system, where
# on other platforms there exist alternatives that don't require bloating
# up our binary size. For Linux more generally, we use this in profile
# pre-symbolication support, since MozDescribeCodeAddress doesn't do
# anything useful on that platform. (Ideally, we would update
# MozDescribeCodeAddress to call into some Rust crates that parse ELF and
# DWARF data, but build system issues currently prevent Rust from being
# used in mozglue.)
if value and (target.kernel == "Linux" or target.kernel == "FreeBSD"):
return True
set_config("MOZ_GECKO_PROFILER_PARSE_ELF", gecko_profiler_parse_elf)
set_define("MOZ_GECKO_PROFILER_PARSE_ELF", gecko_profiler_parse_elf)
# enable this by default if the profiler is enabled
# Note: also requires jemalloc
set_config("MOZ_PROFILER_MEMORY", gecko_profiler_define)
set_define("MOZ_PROFILER_MEMORY", gecko_profiler_define)
@depends(
"--enable-debug",
milestone,
build_project,
# Artifact builds are included because the downloaded artifacts can
# have DMD enabled.
when=artifact_builds | depends(when="--enable-replace-malloc")(lambda: True),
)
def dmd_default(debug, milestone, build_project):
return bool(build_project == "browser" and (debug or milestone.is_nightly))
option(
"--enable-dmd",
env="MOZ_DMD",
default=dmd_default,
help="{Enable|Disable} Dark Matter Detector (heap profiler). "
"Also enables jemalloc, replace-malloc and profiling",
)
@depends("--enable-dmd")
def dmd(value):
if value:
return True
set_config("MOZ_DMD", dmd)
set_define("MOZ_DMD", dmd)
add_old_configure_assignment("MOZ_DMD", dmd)
imply_option("--enable-profiling", dmd)
imply_option("--enable-jemalloc", dmd, when=compile_environment)
imply_option("--enable-replace-malloc", dmd, when=compile_environment)
# midir-based Web MIDI support
# ==============================================================
@depends(target)
def midir_linux_support(target):
return target.kernel == "Linux" and target.os != "Android"
@depends(target, midir_linux_support)
def midir_support(target, midir_linux_support):
if target.os in ("WINNT", "OSX") or midir_linux_support:
return True
set_config("MOZ_WEBMIDI_MIDIR_IMPL", midir_support)
# Enable various cubeb backends
# ==============================================================
@depends(target)
def audio_backends_default(target):
if target.os == "Android":
return (
"aaudio",
"opensl",
)
elif target.os in ("DragonFly", "FreeBSD", "SunOS"):
return ("oss",)
elif target.os == "OpenBSD":
return ("sndio",)
elif target.os == "OSX":
return ("audiounit",)
elif target.os == "WINNT":
return ("wasapi",)
else:
return ("pulseaudio",)
option(
"--enable-audio-backends",
nargs="+",
choices=(
"aaudio",
"alsa",
"audiounit",
"jack",
"opensl",
"oss",
"pulseaudio",
"sndio",
"wasapi",
),
default=audio_backends_default,
help="{Enable|Disable} various cubeb backends",
)
@depends("--enable-audio-backends", target)
def imply_aaudio(values, target):
if any("aaudio" in value for value in values) and target.os != "Android":
die("Cannot enable AAudio on %s", target.os)
return any("aaudio" in value for value in values) or None
@depends("--enable-audio-backends", target)
def imply_alsa(values, target):
if (
any("alsa" in value for value in values)
and target.kernel != "Linux"
and target.os != "FreeBSD"
):
die("Cannot enable ALSA on %s", target.os)
return any("alsa" in value for value in values) or None
@depends("--enable-audio-backends", target)
def imply_audiounit(values, target):
if (
any("audiounit" in value for value in values)
and target.os != "OSX"
and target.kernel != "Darwin"
):
die("Cannot enable AudioUnit on %s", target.os)
return any("audiounit" in value for value in values) or None
@depends("--enable-audio-backends")
def imply_jack(values):
return any("jack" in value for value in values) or None
@depends("--enable-audio-backends", target)
def imply_opensl(values, target):
if any("opensl" in value for value in values) and target.os != "Android":
die("Cannot enable OpenSL on %s", target.os)
return any("opensl" in value for value in values) or None
@depends("--enable-audio-backends", target)
def imply_oss(values, target):
if any("oss" in value for value in values) and (
target.os == "Android" or target.os == "OSX" or target.os == "WINNT"
):
die("Cannot enable OSS on %s", target.os)
return any("oss" in value for value in values) or None
@depends("--enable-audio-backends", target)
def imply_pulseaudio(values, target):
if any("pulseaudio" in value for value in values) and (
target.os == "Android" or target.os == "OSX" or target.os == "WINNT"
):
die("Cannot enable PulseAudio on %s", target.os)
return any("pulseaudio" in value for value in values) or None
@depends("--enable-audio-backends", target)
def imply_sndio(values, target):
if any("sndio" in value for value in values) and (
target.os == "Android" or target.os == "OSX" or target.os == "WINNT"
):
die("Cannot enable sndio on %s", target.os)
return any("sndio" in value for value in values) or None
@depends("--enable-audio-backends", target)
def imply_wasapi(values, target):
if any("wasapi" in value for value in values) and target.os != "WINNT":
die("Cannot enable WASAPI on %s", target.os)
return any("wasapi" in value for value in values) or None
set_config("MOZ_AAUDIO", imply_aaudio, when="--enable-audio-backends")
imply_option("--enable-alsa", imply_alsa, reason="--enable-audio-backends")
set_config("MOZ_AUDIOUNIT_RUST", imply_audiounit, when="--enable-audio-backends")
imply_option("--enable-jack", imply_jack, reason="--enable-audio-backends")
set_config("MOZ_OPENSL", imply_opensl, when="--enable-audio-backends")
set_config("MOZ_OSS", imply_oss, when="--enable-audio-backends")
imply_option("--enable-pulseaudio", imply_pulseaudio, reason="--enable-audio-backends")
imply_option("--enable-sndio", imply_sndio, reason="--enable-audio-backends")
set_config("MOZ_WASAPI", imply_wasapi, when="--enable-audio-backends")
# ALSA cubeb backend
# ==============================================================
option("--enable-alsa", env="MOZ_ALSA", help="Enable ALSA audio backend.")
@depends("--enable-alsa", midir_linux_support)
def enable_alsa_or_midir_linux_support(alsa_enabled, midir_linux_support):
return alsa_enabled or midir_linux_support
pkg_check_modules("MOZ_ALSA", "alsa", when=enable_alsa_or_midir_linux_support)
set_config("MOZ_ALSA", True, when="--enable-alsa")
# JACK cubeb backend
# ==============================================================
system_lib_option("--enable-jack", env="MOZ_JACK", help="Enable JACK audio backend.")
jack = pkg_check_modules("MOZ_JACK", "jack", when="--enable-jack")
set_config("MOZ_JACK", depends_if(jack)(lambda _: True))
# PulseAudio cubeb backend
# ==============================================================
option(
"--enable-pulseaudio",
env="MOZ_PULSEAUDIO",
help="{Enable|Disable} PulseAudio audio backend.",
)
pulseaudio = pkg_check_modules("MOZ_PULSEAUDIO", "libpulse", when="--enable-pulseaudio")
set_config("MOZ_PULSEAUDIO", depends_if(pulseaudio)(lambda _: True))
# sndio cubeb backend
# ==============================================================
system_lib_option("--enable-sndio", env="MOZ_SNDIO", help="Enable sndio audio backend.")
sndio = pkg_check_modules("MOZ_SNDIO", "sndio", when="--enable-sndio")
set_config("MOZ_SNDIO", depends_if(sndio)(lambda _: True))
# Javascript engine
# ==============================================================
include("../js/moz.configure")
# NodeJS
# ==============================================================
include("../build/moz.configure/node.configure")
# JsonCpp
# ==============================================================
set_define("JSON_USE_EXCEPTION", 0)
# L10N
# ==============================================================
option("--with-l10n-base", nargs=1, env="L10NBASEDIR", help="Path to l10n repositories")
@depends("--with-l10n-base", "MOZ_AUTOMATION", build_environment)
@imports(_from="os.path", _import="isdir")
@imports(_from="os.path", _import="expanduser")
@imports(_from="os", _import="environ")
def l10n_base(value, automation, build_env):
if value:
path = value[0]
if not isdir(path):
die("Invalid value --with-l10n-base, %s doesn't exist", path)
elif automation:
path = os.path.join(build_env.topsrcdir, "../l10n-central")
else:
path = os.path.join(
environ.get(
"MOZBUILD_STATE_PATH", expanduser(os.path.join("~", ".mozbuild"))
),
"l10n-central",
)
return os.path.realpath(os.path.abspath(path))
set_config("L10NBASEDIR", l10n_base)
# Default toolkit
# ==============================================================
@depends(target)
def toolkit_choices(target):
if target.os == "WINNT":
return ("cairo-windows",)
elif target.os == "OSX":
return ("cairo-cocoa",)
elif target.os == "Android":
return ("cairo-android",)
else:
return (
"cairo-gtk3",
"cairo-gtk3-wayland",
"cairo-gtk3-wayland-only",
"cairo-gtk3-x11-wayland",
)
@depends(toolkit_choices)
def toolkit_default(choices):
return choices[0]
option(
"--enable-default-toolkit",
nargs=1,
choices=toolkit_choices,
default=toolkit_default,
help="Select default toolkit",
)
@depends("--enable-default-toolkit")
def full_toolkit(value):
if value:
return value[0]
@depends(full_toolkit)
def toolkit(toolkit):
if toolkit.startswith("cairo-gtk3"):
widget_toolkit = "gtk"
else:
widget_toolkit = toolkit.replace("cairo-", "")
return widget_toolkit
set_config("MOZ_WIDGET_TOOLKIT", toolkit)
add_old_configure_assignment("MOZ_WIDGET_TOOLKIT", toolkit)
@depends(toolkit)
def toolkit_define(toolkit):
if toolkit != "windows":
return "MOZ_WIDGET_%s" % toolkit.upper()
set_define(toolkit_define, True)
@depends(toolkit)
def toolkit_gtk(toolkit):
return toolkit == "gtk"
# Wayland support
# ==============================================================
wayland_headers = pkg_check_modules(
"MOZ_WAYLAND",
"gtk+-wayland-3.0 >= 3.14 xkbcommon >= 0.4.1 libdrm >= 2.4",
allow_missing=depends(full_toolkit)(lambda t: t == "cairo-gtk3"),
when=toolkit_gtk,
)
@depends(wayland_headers, toolkit_gtk, artifact_builds)
def wayland_headers(wayland, toolkit_gtk, artifacts):
if toolkit_gtk and artifacts:
return True
return wayland
set_config("MOZ_WAYLAND", depends_if(wayland_headers)(lambda _: True))
set_define("MOZ_WAYLAND", depends_if(wayland_headers)(lambda _: True))
# GL Provider
# ==============================================================
option("--with-gl-provider", nargs=1, help="Set GL provider backend type")
@depends("--with-gl-provider")
def gl_provider(value):
if value:
return value[0]
@depends(gl_provider)
def gl_provider_define(provider):
if provider:
return "GLContextProvider%s" % provider
set_define("MOZ_GL_PROVIDER", gl_provider_define)
@depends(gl_provider, wayland_headers, toolkit_gtk)
def gl_default_provider(value, wayland, toolkit_gtk):
if value:
return value
elif wayland:
return "EGL"
elif toolkit_gtk:
return "GLX"
set_config("MOZ_GL_PROVIDER", gl_provider)
set_config("MOZ_GL_DEFAULT_PROVIDER", gl_default_provider)
@depends(gl_default_provider)
def gl_provider_define(provider):
if provider:
return "GL_PROVIDER_%s" % provider
set_define(gl_provider_define, True)
# PDF printing
# ==============================================================
@depends(toolkit)
def pdf_printing(toolkit):
if toolkit in ("windows", "gtk", "android"):
return True
set_config("MOZ_PDF_PRINTING", pdf_printing)
set_define("MOZ_PDF_PRINTING", pdf_printing)
# Event loop instrumentation
# ==============================================================
option(env="MOZ_INSTRUMENT_EVENT_LOOP", help="Force-enable event loop instrumentation")
@depends("MOZ_INSTRUMENT_EVENT_LOOP", toolkit)
def instrument_event_loop(value, toolkit):
if value or (
toolkit in ("windows", "gtk", "cocoa", "android") and value.origin == "default"
):
return True
set_config("MOZ_INSTRUMENT_EVENT_LOOP", instrument_event_loop)
set_define("MOZ_INSTRUMENT_EVENT_LOOP", instrument_event_loop)
# Fontconfig Freetype
# ==============================================================
option(env="USE_FC_FREETYPE", help="Force-enable the use of fontconfig freetype")
@depends("USE_FC_FREETYPE", toolkit)
def fc_freetype(value, toolkit):
if value or (toolkit == "gtk" and value.origin == "default"):
return True
add_old_configure_assignment("USE_FC_FREETYPE", fc_freetype)
set_define("USE_FC_FREETYPE", fc_freetype)
# Pango
# ==============================================================
pkg_check_modules("MOZ_PANGO", "pango >= 1.22.0", when=toolkit_gtk)
# Fontconfig
# ==============================================================
fontconfig_info = pkg_check_modules(
"_FONTCONFIG", "fontconfig >= 2.7.0", when=fc_freetype
)
@depends(fc_freetype)
def check_for_freetype2(fc_freetype):
if fc_freetype:
return True
# Check for freetype2. Flags are combined with fontconfig flags.
freetype2_info = pkg_check_modules(
"_FT2", "freetype2 >= 9.10.3", when=check_for_freetype2
)
@depends(fontconfig_info, freetype2_info)
def freetype2_combined_info(fontconfig_info, freetype2_info):
if not freetype2_info:
return
if not fontconfig_info:
return freetype2_info
return namespace(
cflags=freetype2_info.cflags + fontconfig_info.cflags,
libs=freetype2_info.libs + fontconfig_info.libs,
)
set_define("MOZ_HAVE_FREETYPE2", depends_if(freetype2_info)(lambda _: True))
# Apple platform decoder support
# ==============================================================
@depends(toolkit)
def applemedia(toolkit):
if toolkit in ("cocoa", "uikit"):
return True
set_config("MOZ_APPLEMEDIA", applemedia)
set_define("MOZ_APPLEMEDIA", applemedia)
# Windows Media Foundation support
# ==============================================================
option("--disable-wmf", help="Disable support for Windows Media Foundation")
@depends("--disable-wmf", target)
def wmf(value, target):
enabled = bool(value)
if value.origin == "default":
# Enable Windows Media Foundation support by default.
# Note our minimum SDK version is Windows 7 SDK, so we are (currently)
# guaranteed to have a recent-enough SDK to build WMF.
enabled = target.os == "WINNT"
if enabled and target.os != "WINNT":
die("Cannot enable Windows Media Foundation support on %s", target.os)
if enabled:
return True
@depends(c_compiler, when=wmf)
def wmfmediaengine(c_compiler):
return c_compiler and c_compiler.type == "clang-cl"
set_config("MOZ_WMF", wmf)
set_define("MOZ_WMF", wmf)
set_config("MOZ_WMF_MEDIA_ENGINE", True, when=wmfmediaengine)
set_define("MOZ_WMF_MEDIA_ENGINE", True, when=wmfmediaengine)
# FFmpeg H264/AAC Decoding Support
# ==============================================================
option("--disable-ffmpeg", help="Disable FFmpeg for fragmented H264/AAC decoding")
@depends("--disable-ffmpeg", target)
def ffmpeg(value, target):
enabled = bool(value)
if value.origin == "default":
enabled = target.os not in ("Android", "WINNT")
if enabled:
return True
set_config("MOZ_FFMPEG", ffmpeg)
set_define("MOZ_FFMPEG", ffmpeg)
imply_option("--enable-fmp4", ffmpeg, "--enable-ffmpeg")
# AV1 Video Codec Support
# ==============================================================
option("--disable-av1", help="Disable av1 video support")
@depends("--enable-av1")
def av1(value):
if value:
return True
@depends(target, when=av1 & compile_environment)
def dav1d_asm(target):
if target.cpu in ("aarch64", "x86", "x86_64"):
return True
@depends(target, when=av1 & compile_environment)
def dav1d_nasm(target):
if target.cpu in ("x86", "x86_64"):
return namespace(version="2.14", what="AV1")
set_config("MOZ_DAV1D_ASM", dav1d_asm)
set_define("MOZ_DAV1D_ASM", dav1d_asm)
set_config("MOZ_AV1", av1)
set_define("MOZ_AV1", av1)
# JXL Image Codec Support
# ==============================================================
option("--disable-jxl", help="Disable jxl image support")
@depends("--disable-jxl", milestone.is_nightly)
def jxl(value, is_nightly):
if is_nightly and value:
return True
set_config("MOZ_JXL", jxl)
set_define("MOZ_JXL", jxl)
# Built-in fragmented MP4 support.
# ==============================================================
option(
"--disable-fmp4",
env="MOZ_FMP4",
help="Disable support for in built Fragmented MP4 parsing",
)
@depends("--disable-fmp4", target, wmf, applemedia)
def fmp4(value, target, wmf, applemedia):
enabled = bool(value)
if value.origin == "default":
# target.os == 'Android' includes all B2G versions
enabled = wmf or applemedia or target.os == "Android"
if enabled:
return True
set_config("MOZ_FMP4", fmp4)
set_define("MOZ_FMP4", fmp4)
add_old_configure_assignment("MOZ_FMP4", fmp4)
@depends(target)
def sample_type_is_s16(target):
# Use integers over floats for audio on Android regardless of the CPU
# architecture, because audio backends for Android don't support floats.
# We also use integers on ARM because it's more efficient.
if target.os == "Android" or target.cpu == "arm":
return True
@depends(sample_type_is_s16)
def sample_type_is_float(t):
if not t:
return True
set_config("MOZ_SAMPLE_TYPE_S16", sample_type_is_s16)
set_define("MOZ_SAMPLE_TYPE_S16", sample_type_is_s16)
set_config("MOZ_SAMPLE_TYPE_FLOAT32", sample_type_is_float)
set_define("MOZ_SAMPLE_TYPE_FLOAT32", sample_type_is_float)
set_define("MOZ_VORBIS", sample_type_is_float)
set_config("MOZ_VORBIS", sample_type_is_float)
set_define("MOZ_TREMOR", sample_type_is_s16)
set_config("MOZ_TREMOR", sample_type_is_s16)
# OpenMAX IL Decoding Support
# ==============================================================
option("--enable-openmax", help="Enable OpenMAX IL for video/audio decoding")
@depends("--enable-openmax")
def openmax(value):
enabled = bool(value)
if enabled:
return True
set_config("MOZ_OMX", openmax)
set_define("MOZ_OMX", openmax)
# EME Support
# ==============================================================
@depends(target)
def eme_choices(target):
if (
target.kernel in ("WINNT", "Linux")
and target.os != "Android"
and target.cpu in ("x86", "x86_64")
):
return ("widevine",)
if target.kernel == "WINNT" and target.cpu == "aarch64":
return ("widevine",)
if target.os in ("OSX"):
return ("widevine",)
# Widevine is enabled by default in desktop browser builds, except
# on aarch64 Windows.
@depends(build_project, eme_choices, target)
def eme_default(build_project, choices, target):
if build_project == "browser":
if target.kernel != "WINNT" or target.cpu != "aarch64":
return choices
option(
"--enable-eme",
nargs="+",
choices=eme_choices,
default=eme_default,
when=eme_choices,
help="{Enable|Disable} support for Encrypted Media Extensions",
)
@depends("--enable-eme", fmp4, when=eme_choices)
def eme(enabled, fmp4):
if enabled and enabled.origin != "default" and not fmp4:
die("Encrypted Media Extension support requires " "Fragmented MP4 support")
@depends("--enable-eme", when=eme_choices)
def eme_modules(value):
return value
# Fallback to an empty list when eme_choices is empty, setting eme_modules to
# None.
set_config("MOZ_EME_MODULES", eme_modules | dependable([]))
@depends(eme_modules, target, when=eme_modules)
def eme_win32_artifact(modules, target):
if "widevine" in modules and target.kernel == "WINNT" and target.cpu == "aarch64":
return True
set_config("MOZ_EME_WIN32_ARTIFACT", eme_win32_artifact)
option(
name="--enable-chrome-format",
help="Select FORMAT of chrome files during packaging.",
nargs=1,
choices=("omni", "jar", "flat"),
default="omni",
)
@depends("--enable-chrome-format")
def packager_format(value):
return value[0]
set_config("MOZ_PACKAGER_FORMAT", packager_format)
# The packager minifies two different types of files: non-JS (mostly property
# files for l10n), and JS. Setting MOZ_PACKAGER_MINIFY only minifies the
# former. Firefox doesn't yet minify JS, due to concerns about debuggability.
#
# Also, the JS minification setup really only works correctly on Android:
# we need extra setup to use the newly-built shell for Linux and Windows,
# and cross-compilation for macOS requires some extra care.
@depends(target_is_android, "--enable-debug", milestone.is_nightly)
def enable_minify_default(is_android, debug, is_nightly):
if is_android and not debug and not is_nightly:
return ("properties", "js")
return ("properties",)
option(
name="--enable-minify",
help="Select types of files to minify during packaging.",
nargs="*",
choices=("properties", "js"),
default=enable_minify_default,
)
@depends("--enable-minify")
def enable_minify(value):
if "js" in value and "properties" not in value:
die("--enable-minify=js requires --enable-minify=properties.")
return namespace(
properties="properties" in value,
js="js" in value,
)
set_config("MOZ_PACKAGER_MINIFY", True, when=enable_minify.properties)
set_config("MOZ_PACKAGER_MINIFY_JS", True, when=enable_minify.js)
@depends(host, build_project)
def jar_maker_format(host, build_project):
# Multilocales for mobile/android use the same mergedirs for all locales,
# so we can't use symlinks for those builds.
if host.os == "WINNT" or build_project == "mobile/android":
return "flat"
return "symlink"
set_config("MOZ_JAR_MAKER_FILE_FORMAT", jar_maker_format)
@depends(toolkit)
def omnijar_name(toolkit):
# Fennec's static resources live in the assets/ folder of the
# APK. Adding a path to the name here works because we only
# have one omnijar file in the final package (which is not the
# case on desktop).
return "assets/omni.ja" if toolkit == "android" else "omni.ja"
set_config("OMNIJAR_NAME", omnijar_name)
project_flag("MOZ_PLACES", help="Build Places if required", set_as_define=True)
project_flag(
"MOZ_SERVICES_HEALTHREPORT",
help="Build Firefox Health Reporter Service",
set_for_old_configure=True,
set_as_define=True,
)
project_flag(
"MOZ_NORMANDY",
help="Enable Normandy recipe runner",
set_for_old_configure=True,
set_as_define=True,
)
project_flag("MOZ_SERVICES_SYNC", help="Build Sync Services if required")
project_flag(
"MOZ_ANDROID_HISTORY",
help="Enable Android History instead of Places",
set_as_define=True,
)
project_flag(
"MOZ_DEDICATED_PROFILES",
help="Enable dedicated profiles per install",
set_as_define=True,
)
project_flag(
"MOZ_BLOCK_PROFILE_DOWNGRADE",
help="Block users from starting profiles last used by a newer build",
set_as_define=True,
)
@depends("MOZ_PLACES", "MOZ_ANDROID_HISTORY")
def check_places_and_android_history(places, android_history):
if places and android_history:
die("Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.")
option(
env="MOZ_TELEMETRY_REPORTING",
default=mozilla_official,
help="Enable telemetry reporting",
)
set_define("MOZ_TELEMETRY_REPORTING", True, when="MOZ_TELEMETRY_REPORTING")
add_old_configure_assignment(
"MOZ_TELEMETRY_REPORTING", True, when="MOZ_TELEMETRY_REPORTING"
)
@depends("MOZ_TELEMETRY_REPORTING", milestone.is_nightly)
def telemetry_on_by_default(reporting, is_nightly):
return reporting and is_nightly
set_define("MOZ_TELEMETRY_ON_BY_DEFAULT", True, when=telemetry_on_by_default)
# gpsd support
# ==============================================================
system_lib_option("--enable-gpsd", env="MOZ_GPSD", help="Enable gpsd support")
@depends("--enable-gpsd")
def gpsd(value):
return bool(value)
system_gpsd = pkg_check_modules("MOZ_GPSD", "libgps >= 3.11", when=gpsd)
set_config("MOZ_GPSD", depends_if(system_gpsd)(lambda _: True))
# Miscellaneous programs
# ==============================================================
check_prog("TAR", ("gnutar", "gtar", "tar"))
check_prog("UNZIP", ("unzip",))
# Key files
# ==============================================================
include("../build/moz.configure/keyfiles.configure")