Bug 1257104 - Move --enable-eme to moz.configure draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 16 Mar 2016 17:52:20 +0900
changeset 341070 9ba23bd552821a9b83719965160c1acd96c273c3
parent 341069 3278fc47a15f8ac20a83567fb7841d318b2aff23
child 516321 e7565d8c7c0105a1ec3b9a65c0068b5c4cd02b87
push id13127
push userbmo:mh+mozilla@glandium.org
push dateWed, 16 Mar 2016 12:32:02 +0000
bugs1257104
milestone48.0a1
Bug 1257104 - Move --enable-eme to moz.configure
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
@@ -205,8 +205,31 @@ def fmp4(value, target, wmf, applemedia)
     if value.origin == 'default':
         # target.os == 'Android' includes all B2G versions
         value = wmf or applemedia or target.os == 'Android'
     if value:
         set_config('MOZ_FMP4', '1')
         set_define('MOZ_FMP4', '1')
         add_old_configure_assignment('MOZ_FMP4', '1')
     return bool(value)
+
+
+# EME Support
+# ==============================================================
+option('--enable-eme', nargs='*', choices=('adobe',),
+       help='Enable support for Encrypted Media Extensions')
+
+@depends('--enable-eme', fmp4)
+def eme(value, fmp4):
+    if value.origin == 'default':
+        value = value or fmp4
+    if value and not fmp4:
+        error('Encrypted Media Extension support requires '
+              'Fragmented MP4 support')
+    if value:
+        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', [] if value in (True, False) else list(value))
+    return bool(value)