Bug 1528884 - Change how --enable-eme is handled. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 19 Feb 2019 09:49:25 +0900
changeset 504521 43965f6107dcdd7051afae588ebe0c3b12612ec8
parent 504520 8cee31ba5c4b32813f05c30a2490c811ee026c91
child 504522 0f039962b79367f49c84aa3541e42107d22fafdb
push idunknown
push userunknown
push dateunknown
reviewersted
bugs1528884, 1300654
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1528884 - Change how --enable-eme is handled. r=ted It used to be that --enable-eme on its own had some effect, but that's not the case anymore. The only thing it does as of bug 1300654 is to switch the defaults in the Firefox configuration. Reflect that in how we handle --enable-eme. Differential Revision: https://phabricator.services.mozilla.com/D20270
toolkit/moz.configure
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -495,57 +495,54 @@ def openmax(value):
     if enabled:
         return True
 
 set_config('MOZ_OMX', openmax)
 set_define('MOZ_OMX', openmax)
 
 # EME Support
 # ==============================================================
-# Widevine is enabled by default in desktop browser builds.
-@depends(build_project)
-def eme_default(build_project):
-    if build_project == 'browser':
-        return 'widevine'
-
-option('--enable-eme',
-       nargs='*',
-       choices=('widevine',),
-       default=eme_default,
-       help='{Enable|Disable} support for Encrypted Media Extensions')
-
-@depends('--enable-eme', target)
-def enable_eme(value, target):
-    # Widevine EME by default enabled on desktop Windows, MacOS and Linux,
-    # x86 and x64 builds.
+@depends(target)
+def eme_choices(target):
     if (target.kernel in ('Darwin', 'WINNT', 'Linux') and
         target.os not in ('Android', 'iOS') and
         target.cpu in ('x86', 'x86_64')):
-        return value
-    elif value and value.origin != 'default':
-        die('%s is not supported on %s' % (value.format('--enable-eme'), target.alias))
-    # Return the same type of OptionValue (Positive or Negative), with an empty tuple.
-    return value.__class__(())
+        return ('widevine',)
+
+
+# Widevine is enabled by default in desktop browser builds.
+@depends(build_project, eme_choices)
+def eme_default(build_project, choices):
+    if build_project == 'browser':
+        return choices
+
 
-@depends(enable_eme, fmp4)
-def eme(value, fmp4):
-    enabled = bool(value)
-    if value.origin == 'default':
-        enabled = enabled or fmp4
-    if enabled and not fmp4:
+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')
-    if enabled:
-        return True
+
 
-@depends(enable_eme)
+@depends('--enable-eme', when=eme_choices)
 def eme_modules(value):
     return value
 
-set_config('MOZ_EME_MODULES', eme_modules)
+
+# Fallback to an empty list when eme_choices is empty, setting eme_modules to
+# None.
+set_config('MOZ_EME_MODULES', eme_modules | dependable([]))
 
 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')