Bug 1254906 - Move --disable-shared-js and --disable-export-js to moz.configure. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 09 Mar 2016 17:41:40 +0900
changeset 288189 a69518e297f1f5788fc03ea1c96f92ff2642aee9
parent 288188 488a4c2651474e9a7f2a821b1afcb065f731996d
child 288190 57e084bd99c6c5417260658bb6502f850f14392e
push id30075
push usercbook@mozilla.com
push dateFri, 11 Mar 2016 15:51:11 +0000
treeherdermozilla-central@f907faa919be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1254906
milestone48.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 1254906 - Move --disable-shared-js and --disable-export-js to moz.configure. r=chmanchester
b2g/confvars.sh
b2g/graphene/confvars.sh
browser/confvars.sh
build/moz.configure/old.configure
build/moz.configure/util.configure
embedding/ios/confvars.sh
js/moz.configure
js/src/old-configure.in
mobile/android/b2gdroid/confvars.sh
mobile/android/confvars.sh
old-configure.in
--- a/b2g/confvars.sh
+++ b/b2g/confvars.sh
@@ -20,17 +20,16 @@ MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/bran
 MOZ_SAFE_BROWSING=1
 MOZ_SERVICES_COMMON=1
 
 MOZ_WEBSMS_BACKEND=1
 MOZ_NO_SMART_CARDS=1
 MOZ_APP_STATIC_INI=1
 NSS_DISABLE_DBM=1
 MOZ_NO_EV_CERTS=1
-MOZ_DISABLE_EXPORT_JS=1
 
 MOZ_WEBSPEECH=1
 if test -n "$NIGHTLY_BUILD"; then
 MOZ_WEBSPEECH_MODELS=1
 MOZ_WEBSPEECH_POCKETSPHINX=1
 fi
 MOZ_WEBSPEECH_TEST_BACKEND=1
 
--- a/b2g/graphene/confvars.sh
+++ b/b2g/graphene/confvars.sh
@@ -28,17 +28,16 @@ MOZ_SAFE_BROWSING=1
 MOZ_SERVICES_COMMON=1
 MOZ_CAPTIVEDETECT=1
 
 MOZ_WEBSMS_BACKEND=1
 MOZ_NO_SMART_CARDS=1
 MOZ_APP_STATIC_INI=1
 NSS_NO_LIBPKIX=1
 NSS_DISABLE_DBM=1
-MOZ_DISABLE_EXPORT_JS=1
 
 if test "$OS_TARGET" = "Android"; then
 MOZ_CAPTURE=1
 MOZ_RAW=1
 MOZ_AUDIO_CHANNEL_MANAGER=1
 fi
 
 MOZ_MEDIA_NAVIGATOR=1
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -21,17 +21,16 @@ if test "$OS_ARCH" = "WINNT"; then
     fi
   fi
 fi
 
 # Enable building ./signmar and running libmar signature tests
 MOZ_ENABLE_SIGNMAR=1
 
 MOZ_CHROME_FILE_FORMAT=omni
-MOZ_DISABLE_EXPORT_JS=1
 MOZ_SAFE_BROWSING=1
 MOZ_SERVICES_COMMON=1
 MOZ_SERVICES_CRYPTO=1
 MOZ_SERVICES_HEALTHREPORT=1
 MOZ_SERVICES_SYNC=1
 MOZ_SERVICES_CLOUDSYNC=1
 MOZ_APP_VERSION=$FIREFOX_VERSION
 MOZ_APP_VERSION_DISPLAY=$FIREFOX_VERSION_DISPLAY
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -56,21 +56,23 @@ def autoconf(mozconfig, autoconf):
     set_config('AUTOCONF', autoconf)
     return autoconf
 
 
 option(env='OLD_CONFIGURE', nargs=1, help='Path to the old configure script')
 
 @depends('OLD_CONFIGURE', mozconfig, autoconf, check_build_environment, shell,
          virtualenv_python, compile_environment, build_project,
-         extra_old_configure_args, '--with-external-source-dir')
+         extra_old_configure_args, '--with-external-source-dir',
+         '--enable-shared-js')
 @advanced
 def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,
                       python, compile_env, build_project,
-                      extra_old_configure_args, external_source_dir):
+                      extra_old_configure_args, external_source_dir,
+                      shared_js):
     import glob
     import itertools
     import subprocess
     import sys
     # Import getmtime without overwriting the sandbox os.path.
     from os.path import getmtime
 
     from mozbuild.shellutil import quote
@@ -126,16 +128,18 @@ def prepare_configure(old_configure, moz
                     print("unset %s" % key, file=out)
 
         print('PYTHON=%s' % quote(python), file=out)
         if compile_env:
             print('COMPILE_ENVIRONMENT=1', file=out)
         print('MOZ_BUILD_APP=%s' % build_project, file=out)
         if external_source_dir:
             print(external_source_dir.format('EXTERNAL_SOURCE_DIR'), file=out)
+        if shared_js:
+            print('JS_SHARED_LIBRARY=1', file=out)
 
     if extra_old_configure_args:
         cmd += extra_old_configure_args
 
     return cmd
 
 
 @template
@@ -178,17 +182,16 @@ def old_configure_options(*options):
     '--enable-debug-symbols',
     '--enable-default-toolkit',
     '--enable-directshow',
     '--enable-dmd',
     '--enable-dtrace',
     '--enable-dump-painting',
     '--enable-elf-hack',
     '--enable-eme',
-    '--enable-export-js',
     '--enable-extensions',
     '--enable-faststripe',
     '--enable-feeds',
     '--enable-ffmpeg',
     '--enable-fmp4',
     '--enable-gamepad',
     '--enable-gc-trace',
     '--enable-gconf',
@@ -242,17 +245,16 @@ def old_configure_options(*options):
     '--enable-readline',
     '--enable-reflow-perf',
     '--enable-release',
     '--enable-replace-malloc',
     '--enable-require-all-d3dc-versions',
     '--enable-rust',
     '--enable-safe-browsing',
     '--enable-sandbox',
-    '--enable-shared-js',
     '--enable-signmar',
     '--enable-simulator',
     '--enable-skia',
     '--enable-skia-gpu',
     '--enable-small-chunk-size',
     '--enable-startup-notification',
     '--enable-startupcache',
     '--enable-stdcxx-compat',
--- a/build/moz.configure/util.configure
+++ b/build/moz.configure/util.configure
@@ -71,8 +71,32 @@ del _defines
 
 @template
 def unique_list(l):
     result = []
     for i in l:
         if l not in result:
             result.append(i)
     return result
+
+
+# Denotes a deprecated option. Combines option() and @depends:
+# @deprecated_option('--option')
+# def option(value):
+#     ...
+# @deprecated_option() takes the same arguments as option(), except `help`.
+# The function may handle the option like a typical @depends function would,
+# but it is recommended it emits a deprecation error message suggesting an
+# alternative option to use if there is one.
+@template
+def deprecated_option(*args, **kwargs):
+    assert 'help' not in kwargs
+    kwargs['help'] = 'Deprecated'
+    opt = option(*args, **kwargs)
+
+    def decorator(func):
+        @depends(opt.option)
+        def deprecated(value):
+            if value.origin != 'default':
+                return func(value)
+        return deprecated
+
+    return decorator
--- a/embedding/ios/confvars.sh
+++ b/embedding/ios/confvars.sh
@@ -10,9 +10,8 @@ MOZ_CHROME_FILE_FORMAT=omni
 MOZ_APP_VERSION=$MOZILLA_VERSION
 MOZ_PLACES=1
 MOZ_EXTENSIONS_DEFAULT=" gio"
 MOZ_SERVICES_COMMON=1
 MOZ_SERVICES_CRYPTO=1
 MOZ_SERVICES_SYNC=1
 MOZ_MEDIA_NAVIGATOR=1
 MOZ_SERVICES_HEALTHREPORT=1
-MOZ_DISABLE_EXPORT_JS=1
--- a/js/moz.configure
+++ b/js/moz.configure
@@ -13,8 +13,57 @@ def js_shell_default(build_project, help
 
 js_option('--disable-js-shell', default=js_shell_default,
        help='Do not build the JS shell')
 
 @depends('--disable-js-shell')
 def js_shell(value):
     if not value:
         set_config('JS_DISABLE_SHELL', '1')
+
+
+# SpiderMonkey as a shared library, and how its symbols are exported
+# ==================================================================
+@depends(build_project, '--help')
+def js_shared_default(build_project, help):
+    return build_project == 'js'
+
+js_option('--disable-shared-js', default=js_shared_default,
+          help='Do not create a shared library')
+
+js_option('--disable-export-js', default=js_shared_default,
+          help='Do not mark JS symbols as DLL exported/visible')
+
+@depends('--disable-shared-js', '--disable-export-js')
+def static_js(shared_js, export_js):
+    if shared_js:
+        if not export_js:
+            error('Must export JS symbols when building a shared library.')
+        set_config('JS_SHARED_LIBRARY', '1')
+    else:
+        if export_js:
+            set_define('STATIC_EXPORTABLE_JS_API', '1')
+        else:
+            set_define('STATIC_JS_API', '1')
+        set_define('MOZ_STATIC_JS', '1')
+
+
+@deprecated_option(env='DISABLE_SHARED_JS', nargs='?')
+def disable_shared_js(value):
+    # DISABLE_SHARED_JS=1 gets us an empty PositiveOptionValue
+    if value and not len(value):
+        suggestion = '--disable-shared-js'
+    else:
+        suggestion = '--enable-shared-js'
+
+    error('Setting %s is deprecated, use %s instead.'
+          % (value.format('DISABLE_SHARED_JS'), suggestion))
+
+@deprecated_option(env='DISABLE_EXPORT_JS', nargs='?')
+def disable_export_js(value):
+    # DISABLE_EXPORT_JS=1 gets us an empty PositiveOptionValue
+    if value and not len(value):
+        suggestion = '--disable-export-js'
+    else:
+        suggestion = '--enable-export-js'
+
+    error('Setting %s is deprecated, use %s instead.'
+          % (value.format('DISABLE_EXPORT_JS'), suggestion))
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -81,42 +81,16 @@ MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pw
 MOZ_DEFAULT_COMPILER
 
 dnl Check for Perl first -- needed for win32 SDK checks
 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
 if test -z "$PERL" -o "$PERL" = ":"; then
     AC_MSG_ERROR([perl not found in \$PATH])
 fi
 
-MOZ_ARG_ENABLE_BOOL(shared-js,
-[  --disable-shared-js
-                          Do not create a shared library.],
-    DISABLE_SHARED_JS=0,
-    DISABLE_SHARED_JS=1)
-
-MOZ_ARG_DISABLE_BOOL(export-js,
-[  --disable-export-js
-                          Do not mark JS symbols as DLL exported/visible.],
-    DISABLE_EXPORT_JS=1,
-    DISABLE_EXPORT_JS=)
-
-if test "$DISABLE_SHARED_JS" = "1" ; then
-  if test "$DISABLE_EXPORT_JS" = "1"; then
-    AC_DEFINE(STATIC_JS_API)
-  else
-    AC_DEFINE(STATIC_EXPORTABLE_JS_API)
-  fi
-else
-  if test "$DISABLE_EXPORT_JS" = "1"; then
-    AC_MSG_ERROR([Must export JS symbols when building a shared library.])
-  fi
-  JS_SHARED_LIBRARY=1
-fi
-AC_SUBST(JS_SHARED_LIBRARY)
-
 if test "$JS_STANDALONE" = no; then
   autoconfmk=autoconf-js.mk
   JS_STANDALONE=
   #DIST is exported from top-level configure
 else
   JS_STANDALONE=1
   AC_DEFINE(JS_STANDALONE)
   DIST="$MOZ_BUILD_ROOT/dist"
--- a/mobile/android/b2gdroid/confvars.sh
+++ b/mobile/android/b2gdroid/confvars.sh
@@ -42,17 +42,16 @@ MOZ_ANDROID_BEAM=1
 
 MOZ_XULRUNNER=
 
 MOZ_CAPTURE=1
 MOZ_RAW=1
 MOZ_PLACES=
 MOZ_SOCIAL=
 MOZ_ANDROID_HISTORY=1
-MOZ_DISABLE_EXPORT_JS=1
 MOZ_ANDROID_APZ=1
 
 # use custom widget for html:select
 MOZ_USE_NATIVE_POPUP_WINDOWS=1
 
 MOZ_APP_ID={f7b06d8d-139c-459a-85fa-46bc6c52e2b7}
 
 MOZ_APP_STATIC_INI=1
--- a/mobile/android/confvars.sh
+++ b/mobile/android/confvars.sh
@@ -35,17 +35,16 @@ MOZ_ANDROID_BEAM=1
 
 MOZ_XULRUNNER=
 
 MOZ_CAPTURE=1
 MOZ_RAW=1
 MOZ_PLACES=
 MOZ_SOCIAL=
 MOZ_ANDROID_HISTORY=1
-MOZ_DISABLE_EXPORT_JS=1
 
 # use custom widget for html:select
 MOZ_USE_NATIVE_POPUP_WINDOWS=1
 
 MOZ_APP_ID={aa3c5121-dab2-40e2-81ca-7ea25febc110}
 
 MOZ_APP_STATIC_INI=1
 
--- a/old-configure.in
+++ b/old-configure.in
@@ -3532,22 +3532,16 @@ fi
 
 AC_SUBST(MOZ_NATIVE_HUNSPELL)
 
 dnl ========================================================
 dnl system libffi Support
 dnl ========================================================
 MOZ_CONFIG_FFI()
 
-MOZ_ARG_ENABLE_BOOL(shared-js,
-[  --enable-shared-js
-                          Create a shared JavaScript library.],
-    JS_SHARED_LIBRARY=1,
-    JS_SHARED_LIBRARY=)
-
 dnl ========================================================
 dnl Java SDK support
 dnl ========================================================
 
 JAVA_BIN_PATH=
 MOZ_ARG_WITH_STRING(java-bin-path,
 [  --with-java-bin-path=dir
                           Location of Java binaries (java, javac, jar)],
@@ -8919,21 +8913,16 @@ dnl mask as short hand property
 dnl ========================================================
 dnl Uncommenting the next line would enable mask-as-shorthand feature.
 dnl MOZ_ENABLE_MASK_AS_SHORTHAND=1
 if test "$MOZ_ENABLE_MASK_AS_SHORTHAND"; then
   AC_DEFINE(MOZ_ENABLE_MASK_AS_SHORTHAND)
 fi
 AC_SUBST(MOZ_ENABLE_MASK_AS_SHORTHAND)
 
-if test -z "$JS_SHARED_LIBRARY"; then
-  AC_DEFINE(MOZ_STATIC_JS)
-fi
-AC_SUBST(JS_SHARED_LIBRARY)
-
 # Avoid using obsolete NSPR features
 AC_DEFINE(NO_NSPR_10_SUPPORT)
 
 MOZ_CREATE_CONFIG_STATUS()
 
 if test "$COMPILE_ENVIRONMENT"; then
   MOZ_SUBCONFIGURE_ICU()
   MOZ_SUBCONFIGURE_FFI()
@@ -9033,22 +9022,16 @@ ac_configure_args="`echo $ac_configure_a
 if test "$_INTL_API" = no; then
     ac_configure_args="$ac_configure_args --without-intl-api"
 fi
 
 if test "$BUILD_CTYPES"; then
     # Build js-ctypes on the platforms we can.
     ac_configure_args="$ac_configure_args --enable-ctypes"
 fi
-if test -z "$JS_SHARED_LIBRARY" ; then
-    ac_configure_args="$ac_configure_args --disable-shared-js"
-    if test -n "$MOZ_DISABLE_EXPORT_JS"; then
-        ac_configure_args="$ac_configure_args --disable-export-js"
-    fi
-fi
 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
 fi
 ac_configure_args="$ac_configure_args --prefix=$dist"
 if test "$MOZ_MEMORY"; then
    ac_configure_args="$ac_configure_args --enable-jemalloc"
 fi