Bug 1257104 - Move --enable-eme to moz.configure. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 16 Mar 2016 17:52:20 +0900
changeset 289160 3e0a7ab70f87494a33d0f8a5fa4d823f1eb5398d
parent 289159 9496c850df7fb0b1d9f0a35dc185119ff10784e3
child 289161 744e0f1f8d9bfc486d4bfa7f38b03e68f5cbe473
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1257104
milestone48.0a1
Bug 1257104 - Move --enable-eme to moz.configure. r=ted
build/moz.configure/old.configure
old-configure.in
toolkit/moz.configure
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -191,17 +191,16 @@ def old_configure_options(*options):
     '--enable-debug',
     '--enable-debug-js-modules',
     '--enable-debug-symbols',
     '--enable-directshow',
     '--enable-dmd',
     '--enable-dtrace',
     '--enable-dump-painting',
     '--enable-elf-hack',
-    '--enable-eme',
     '--enable-extensions',
     '--enable-faststripe',
     '--enable-feeds',
     '--enable-gamepad',
     '--enable-gc-trace',
     '--enable-gconf',
     '--enable-gczeal',
     '--enable-gio',
--- a/old-configure.in
+++ b/old-configure.in
@@ -4351,46 +4351,16 @@ if test x"$MOZ_WIDGET_TOOLKIT" = x"gonk"
     if test "$ANDROID_VERSION" -ge "18"; then
         MOZ_GONK_MEDIACODEC=1
         AC_SUBST(MOZ_GONK_MEDIACODEC)
     fi
 fi
 
 
 dnl ========================================================
-dnl = EME support
-dnl ========================================================
-
-MOZ_ARG_ENABLE_STRING(eme,
-[  --enable-eme[=adobe]  Enable support for Encrypted Media Extensions  ],
-    MOZ_EME_ARGS=$enableval)
-
-if test "$MOZ_EME_ARGS"; then
-    if test "$MOZ_EME_ARGS" = "no"; then
-        dnl EME explicitly disabled with --disable-eme
-        MOZ_EME=
-    elif test "$MOZ_EME_ARGS" = "yes"; then
-        dnl EME explicitly enabled with --enable-eme
-        MOZ_EME=1
-    else
-        dnl EME explicitly enabled with --enable-eme=<args>
-        MOZ_EME=1
-        MOZ_EME_MODULES=`echo $MOZ_EME_ARGS | sed -e 's/,/ /g'`
-    fi
-fi
-
-AC_SUBST_SET(MOZ_EME_MODULES)
-if test -n "$MOZ_EME"; then
-    if test -z "$MOZ_FMP4"; then
-        AC_MSG_ERROR([Encrypted Media Extension support requires Fragmented MP4 support])
-    fi
-    AC_DEFINE(MOZ_EME)
-fi
-
-dnl ========================================================
 dnl = Enable media plugin support
 dnl ========================================================
 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
   dnl Enable support on android by default
   MOZ_ANDROID_OMX=1
 fi
 
 MOZ_ARG_ENABLE_BOOL(android-omx,
@@ -7932,17 +7902,16 @@ AC_SUBST(MSMANIFEST_TOOL)
 AC_SUBST(NS_ENABLE_TSF)
 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
 
 AC_SUBST(MOZ_VORBIS)
 AC_SUBST(MOZ_TREMOR)
 AC_SUBST(MOZ_FFVPX)
 AC_SUBST_LIST(FFVPX_ASFLAGS)
-AC_SUBST(MOZ_EME)
 AC_SUBST(MOZ_DIRECTSHOW)
 AC_SUBST(MOZ_ANDROID_OMX)
 AC_SUBST(MOZ_OMX_PLUGIN)
 AC_SUBST(MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE)
 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
 AC_SUBST(VPX_USE_YASM)
 AC_SUBST_LIST(VPX_ASFLAGS)
 AC_SUBST(VPX_AS_CONVERSION)
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -209,8 +209,32 @@ def fmp4(value, target, wmf, applemedia)
     if value.origin == 'default':
         # target.os == 'Android' includes all B2G versions
         enabled = wmf or applemedia or target.os == 'Android'
     if enabled:
         set_config('MOZ_FMP4', '1')
         set_define('MOZ_FMP4', '1')
         add_old_configure_assignment('MOZ_FMP4', '1')
     return enabled
+
+
+# EME Support
+# ==============================================================
+option('--enable-eme', nargs='*', choices=('adobe',),
+       help='Enable support for Encrypted Media Extensions')
+
+@depends('--enable-eme', fmp4)
+def eme(value, fmp4):
+    enabled = bool(value)
+    if value.origin == 'default':
+        enabled = enabled or fmp4
+    if enabled and not fmp4:
+        error('Encrypted Media Extension support requires '
+              'Fragmented MP4 support')
+    if enabled:
+        set_config('MOZ_EME', '1')
+        set_define('MOZ_EME', '1')
+    # Theoretically, we could pass `value` directly when it is a
+    # PositiveOptionValue, but somehow, the JSON serialization in configure.py
+    # outputs inconsistent data in some cases when we do (a closing bracket
+    # without an opening one).
+    set_config('MOZ_EME_MODULES', list(value) if value else [])
+    return enabled