Bug 1354581 - Move enable-release / MOZILLA_OFFICIAL support into the python configure r?glandium
MozReview-Commit-ID: GP0smX8AWcu
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -1,25 +1,16 @@
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Add compiler specific options
AC_DEFUN([MOZ_DEFAULT_COMPILER],
[
-dnl set DEVELOPER_OPTIONS early; MOZ_DEFAULT_COMPILER is usually the first non-setup directive
- if test -z "$MOZILLA_OFFICIAL"; then
- DEVELOPER_OPTIONS=1
- fi
- MOZ_ARG_ENABLE_BOOL(release,
- [ --enable-release Build with more conservative, release engineering-oriented options.
- This may slow down builds.],
- DEVELOPER_OPTIONS=,
- DEVELOPER_OPTIONS=1)
dnl Default to MSVC for win32 and gcc-4.2 for darwin
dnl ==============================================================
if test -z "$CROSS_COMPILE"; then
case "$target" in
*-mingw*)
if test -z "$CPP"; then CPP="$CC -E -nologo"; fi
if test -z "$CXXCPP"; then CXXCPP="$CXX -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -208,17 +208,16 @@ def old_configure_options(*options):
'--enable-pie',
'--enable-png-arm-neon-support',
'--enable-posix-nspr-emulation',
'--enable-pref-extensions',
'--enable-pulseaudio',
'--enable-raw',
'--enable-readline',
'--enable-reflow-perf',
- '--enable-release',
'--enable-safe-browsing',
'--enable-sandbox',
'--enable-signmar',
'--enable-simulator',
'--enable-small-chunk-size',
'--enable-startup-notification',
'--enable-startupcache',
'--enable-stdcxx-compat',
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -997,16 +997,48 @@ set_config('VISIBILITY_FLAGS', visibilit
# We only want to include windows.configure when we are compiling on
# Windows, for Windows.
@depends(target, host)
def is_windows(target, host):
return host.kernel == 'WINNT' and target.kernel == 'WINNT'
include('windows.configure', when=is_windows)
+js_option('--enable-release', default=False,
+ help='Build with more conservative, release engineering-oriented options. This may slow down builds.')
+
+@depends('--enable-release', 'MOZILLA_OFFICIAL')
+def enable_release(target, mozilla_official_flag):
+ # We have either --enable-release or MOZILLA_OFFICIAL
+ # means that we are in release mode (and not dev mode)
+ return bool(target) or bool(mozilla_official_flag)
+
+@depends('MOZILLA_OFFICIAL')
+def enable_official(mozilla_official_flag):
+ # if we have the variable MOZILLA_OFFICIAL, MOZ_INCLUDE_SOURCE_INFO_FLAG
+ # should be 1 too
+ return bool(mozilla_official_flag) or None
+
+set_config('MOZILLA_OFFICIAL', enable_official)
+# Until we move all the MOZILLA_OFFICIAL consumers out of old-configure.
+add_old_configure_assignment('MOZILLA_OFFICIAL',
+ enable_official)
+
+@depends(enable_release)
+def dev_options(enable_release):
+ # If official release, disable the developer mode
+ return not bool(enable_release)
+
+set_config('DEVELOPER_OPTIONS', dev_options)
+# Until we move all the DEVELOPER_OPTIONS consumers out of old-configure.
+add_old_configure_assignment('DEVELOPER_OPTIONS',
+ dev_options)
+
+
+
# Security Hardening
# ==============================================================
option('--enable-hardening', env='MOZ_SECURITY_HARDENING',
help='Enables security hardening compiler options')
@depends('--enable-hardening', c_compiler)
def security_hardening_cflags(value, c_compiler):
--- a/moz.configure
+++ b/moz.configure
@@ -66,16 +66,19 @@ add_old_configure_assignment('COMPILE_EN
js_option('--disable-tests',
help='Do not build test libraries & programs')
@depends('--disable-tests')
def enable_tests(value):
if value:
return True
+js_option(env='MOZILLA_OFFICIAL',
+ help='Build an official release (will disable the DEVELOPER_OPTIONS).')
+
set_config('ENABLE_TESTS', enable_tests)
set_define('ENABLE_TESTS', enable_tests)
@depends(enable_tests)
def gtest_has_rtti(value):
if value:
return '0'
--- a/old-configure.in
+++ b/old-configure.in
@@ -5143,19 +5143,17 @@ AC_SUBST(FIREFOX_VERSION)
AC_SUBST(MOZ_UA_OS_AGNOSTIC)
if test -n "$MOZ_UA_OS_AGNOSTIC"; then
AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
fi
AC_SUBST(MOZ_PKG_SPECIAL)
AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
-AC_SUBST(MOZILLA_OFFICIAL)
if test "$MOZILLA_OFFICIAL"; then
- AC_DEFINE(MOZILLA_OFFICIAL)
# Build revisions should always be present in official builds
MOZ_INCLUDE_SOURCE_INFO=1
fi
# External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
# explicitly set the repository and changeset information in.
AC_SUBST(MOZ_SOURCE_REPO)
AC_SUBST(MOZ_SOURCE_CHANGESET)
--- a/python/mozbuild/mozbuild/test/configure/common.py
+++ b/python/mozbuild/mozbuild/test/configure/common.py
@@ -231,16 +231,31 @@ class BaseConfigureTest(unittest.TestCas
os.chdir(self._cwd)
def config_guess(self, stdin, args):
return 0, self.HOST, ''
def config_sub(self, stdin, args):
return 0, args[0], ''
+ def get_value_for(self, args=[], environ={}, mozconfig=''):
+ sandbox = self.get_sandbox({}, {}, args, environ, mozconfig)
+
+ # Add a fake old-configure option
+ sandbox.option_impl('--with-foo', nargs='*',
+ help='Help missing for old configure options')
+
+ # Remove all implied options, otherwise, getting
+ # all_configure_options below triggers them, and that triggers
+ # configure parts that aren't expected to run during this test.
+ del sandbox._implied_options[:]
+ result = sandbox._value_for(sandbox['all_configure_options'])
+ shell = mozpath.abspath('/bin/sh')
+ return result.replace('CONFIG_SHELL=%s ' % shell, '')
+
def get_sandbox(self, paths, config, args=[], environ={}, mozconfig='',
out=None, logger=None):
kwargs = {}
if logger:
kwargs['logger'] = logger
else:
if not out:
out = StringIO()
--- a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py
@@ -4,68 +4,54 @@
from __future__ import absolute_import, print_function, unicode_literals
from mozunit import main
from mozpack import path as mozpath
from common import BaseConfigureTest
-
class TestMozConfigure(BaseConfigureTest):
def test_moz_configure_options(self):
- def get_value_for(args=[], environ={}, mozconfig=''):
- sandbox = self.get_sandbox({}, {}, args, environ, mozconfig)
-
- # Add a fake old-configure option
- sandbox.option_impl('--with-foo', nargs='*',
- help='Help missing for old configure options')
-
- # Remove all implied options, otherwise, getting
- # all_configure_options below triggers them, and that triggers
- # configure parts that aren't expected to run during this test.
- del sandbox._implied_options[:]
- result = sandbox._value_for(sandbox['all_configure_options'])
- shell = mozpath.abspath('/bin/sh')
- return result.replace('CONFIG_SHELL=%s ' % shell, '')
self.assertEquals('--enable-application=browser',
- get_value_for(['--enable-application=browser']))
+ self.get_value_for(['--enable-application=browser']))
self.assertEquals('--enable-application=browser '
'MOZ_VTUNE=1',
- get_value_for(['--enable-application=browser',
+ self.get_value_for(['--enable-application=browser',
'MOZ_VTUNE=1']))
- value = get_value_for(
+ value = self.get_value_for(
environ={'MOZ_VTUNE': '1'},
mozconfig='ac_add_options --enable-project=js')
self.assertEquals('--enable-project=js MOZ_VTUNE=1',
value)
# --disable-js-shell is the default, so it's filtered out.
self.assertEquals('--enable-application=browser',
- get_value_for(['--enable-application=browser',
+ self.get_value_for(['--enable-application=browser',
'--disable-js-shell']))
# Normally, --without-foo would be filtered out because that's the
# default, but since it is a (fake) old-configure option, it always
# appears.
self.assertEquals('--enable-application=browser --without-foo',
- get_value_for(['--enable-application=browser',
+ self.get_value_for(['--enable-application=browser',
'--without-foo']))
self.assertEquals('--enable-application=browser --with-foo',
- get_value_for(['--enable-application=browser',
+ self.get_value_for(['--enable-application=browser',
'--with-foo']))
self.assertEquals("--enable-application=browser '--with-foo=foo bar'",
- get_value_for(['--enable-application=browser',
+ self.get_value_for(['--enable-application=browser',
'--with-foo=foo bar']))
+
def test_nsis_version(self):
this = self
class FakeNSIS(object):
def __init__(self, version):
self.version = version
def __call__(self, stdin, args):
--- a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
@@ -57,11 +57,30 @@ class TestToolkitMozConfigure(BaseConfig
self.assertEqual(
get_value('--enable-necko-protocols=all,-http,-about'),
tuple(p for p in default_protocols if p not in ('http', 'about')))
self.assertEqual(
get_value('--enable-necko-protocols=default,-http,-about'),
tuple(p for p in default_protocols if p not in ('http', 'about')))
+ def test_release_arg(self):
+
+ value = self.get_value_for(['--enable-release'],
+ environ={'MOZILLA_OFFICIAL': '',
+ 'DEVELOPER_OPTIONS': ''})
+ self.assertEquals('--enable-release',
+ value)
+
+ value = self.get_value_for(
+ environ={'MOZILLA_OFFICIAL': '1',
+ 'DEVELOPER_OPTIONS': ''})
+ self.assertEquals('MOZILLA_OFFICIAL=1',
+ value)
+
+ value = self.get_value_for(
+ environ={'MOZILLA_OFFICIAL': '1',
+ 'DEVELOPER_OPTIONS': '1'})
+ self.assertEquals('MOZILLA_OFFICIAL=1',
+ value)
if __name__ == '__main__':
main()