Convert MOZILLA_OFFICIAL conditionals to MC_OFFICIAL where needed.

- `--enable-official-branding` implies `MC_OFFICIAL` (no need to specifically set it)
- `--enable-official-vendor` can be used to set `MC_OFFICIAL` on builds without `--enable-official-branding` that should still be considered official release versions.
- `MC_OFFICIAL` implies `--enable-release`, meaning `DEVELOPER_OPTIONS` isn't set
- `MC_OFFICIAL` makes `nsXULAppInfo.getIsOfficial` return `true`
- `MC_OFFICIAL` makes `AppConstants.MOZILLA_OFFICIAL` (for compatibility in extensions) and `AppConstants.MC_OFFICIAL` return `true`
- Optional, for the time being: `MOZILLA_OFFICIAL` is still present in some places in case someone wants to build a Mozilla-alike official application and has the rights and necessary keys to use Mozilla-official third-party services. This must always be combined with `MC_OFFICIAL` to have a sane combination of defines. This may be removed in the future.
This commit is contained in:
wolfbeast 2018-04-13 22:06:20 +02:00 • committed by Roy Tam
commit d37246737b
12 changed files with 32 additions and 21 deletions

View file

@ -44,7 +44,7 @@ this.AboutHomeUtils = {
return !Services.prefs.getBoolPref("browser.EULA.override"); return !Services.prefs.getBoolPref("browser.EULA.override");
} catch (e) { } } catch (e) { }
#ifndef MOZILLA_OFFICIAL #ifndef MC_OFFICIAL
// Non-official builds shouldn't show the notification. // Non-official builds shouldn't show the notification.
return false; return false;
#endif #endif

View file

@ -37,5 +37,8 @@ EXTRA_PP_JS_MODULES += [
'RecentWindow.jsm', 'RecentWindow.jsm',
] ]
# Pass down 'official build' flags
if CONFIG['MC_OFFICIAL']:
DEFINES['MC_OFFICIAL'] = 1
if CONFIG['MOZILLA_OFFICIAL']: if CONFIG['MOZILLA_OFFICIAL']:
DEFINES['MOZILLA_OFFICIAL'] = 1 DEFINES['MOZILLA_OFFICIAL'] = 1

View file

@ -47,7 +47,7 @@ this.AboutHomeUtils = {
return !Services.prefs.getBoolPref("browser.EULA.override"); return !Services.prefs.getBoolPref("browser.EULA.override");
} catch (e) { } } catch (e) { }
if (!AppConstants.MOZILLA_OFFICIAL) { if (!AppConstants.MC_OFFICIAL) {
// Non-official builds shouldn't show the notification. // Non-official builds shouldn't show the notification.
return false; return false;
} }

View file

@ -7,7 +7,7 @@ dnl Add compiler specific options
AC_DEFUN([MOZ_DEFAULT_COMPILER], AC_DEFUN([MOZ_DEFAULT_COMPILER],
[ [
dnl set DEVELOPER_OPTIONS early; MOZ_DEFAULT_COMPILER is usually the first non-setup directive dnl set DEVELOPER_OPTIONS early; MOZ_DEFAULT_COMPILER is usually the first non-setup directive
if test -z "$MOZILLA_OFFICIAL"; then if test -z "$MC_OFFICIAL"; then
DEVELOPER_OPTIONS=1 DEVELOPER_OPTIONS=1
fi fi
MOZ_ARG_ENABLE_BOOL(release, MOZ_ARG_ENABLE_BOOL(release,

View file

@ -16,7 +16,7 @@ ifndef RESFILE
RCFILE=./module.rc RCFILE=./module.rc
RESFILE=./module.res RESFILE=./module.res
_RC_STRING = -QUIET 1 -DEPTH $(DEPTH) -TOPSRCDIR $(MOZILLA_DIR) -OBJDIR . -SRCDIR $(srcdir) -DISPNAME $(MOZ_APP_DISPLAYNAME) -APPVERSION $(MOZ_APP_VERSION) _RC_STRING = -QUIET 1 -DEPTH $(DEPTH) -TOPSRCDIR $(MOZILLA_DIR) -OBJDIR . -SRCDIR $(srcdir) -DISPNAME $(MOZ_APP_DISPLAYNAME) -APPVERSION $(MOZ_APP_VERSION)
ifdef MOZILLA_OFFICIAL ifdef MC_OFFICIAL
_RC_STRING += -OFFICIAL 1 _RC_STRING += -OFFICIAL 1
endif endif
ifdef MOZ_DEBUG ifdef MOZ_DEBUG

View file

@ -2112,6 +2112,7 @@ AC_SUBST(MOZ_APP_VERSION)
AC_SUBST(MOZ_PKG_SPECIAL) AC_SUBST(MOZ_PKG_SPECIAL)
AC_SUBST(MOZILLA_OFFICIAL) AC_SUBST(MOZILLA_OFFICIAL)
AC_SUBST(MC_OFFICIAL)
dnl ======================================================== dnl ========================================================
dnl ECMAScript Internationalization API Support (uses ICU) dnl ECMAScript Internationalization API Support (uses ICU)

View file

@ -2264,7 +2264,7 @@ MOZ_ARG_HEADER(Application)
ENABLE_SYSTEM_EXTENSION_DIRS=1 ENABLE_SYSTEM_EXTENSION_DIRS=1
MOZ_BRANDING_DIRECTORY= MOZ_BRANDING_DIRECTORY=
MOZ_OFFICIAL_BRANDING= MOZ_OFFICIAL_BRANDING=
MC_OFFICIAL=1 MC_OFFICIAL=
MOZ_FEEDS=1 MOZ_FEEDS=1
MOZ_AUTH_EXTENSION=1 MOZ_AUTH_EXTENSION=1
if test "$MOZ_IOS"; then if test "$MOZ_IOS"; then
@ -2357,10 +2357,10 @@ AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
dnl ======================================================== dnl ========================================================
dnl = Vendor override dnl = Vendor override
dnl ======================================================== dnl ========================================================
MOZ_ARG_DISABLE_BOOL(official-vendor, MOZ_ARG_ENABLE_BOOL(official-vendor,
[ --disable-official-vendor Disable the use of official vendor.], [ --enable-official-vendor This is an official release build.],
MC_OFFICIAL=, MC_OFFICIAL=1,
MC_OFFICIAL=1) MC_OFFICIAL=)
dnl ======================================================== dnl ========================================================
@ -2368,11 +2368,10 @@ dnl = Trademarked Branding
dnl ======================================================== dnl ========================================================
MOZ_ARG_ENABLE_BOOL(official-branding, MOZ_ARG_ENABLE_BOOL(official-branding,
[ --enable-official-branding [ --enable-official-branding
Enable Official mozilla.org Branding Enable Official Branding
Do not distribute builds with Do not distribute builds with
--enable-official-branding unless you have --enable-official-branding unless you have
permission to use trademarks per permission to use our trademarks!],
http://www.mozilla.org/foundation/trademarks/ .],
MOZ_OFFICIAL_BRANDING=1, MOZ_OFFICIAL_BRANDING=1,
MOZ_OFFICIAL_BRANDING=) MOZ_OFFICIAL_BRANDING=)
@ -2592,6 +2591,7 @@ if test -n "$MOZ_OFFICIAL_BRANDING"; then
else else
MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY} MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
AC_DEFINE(MOZ_OFFICIAL_BRANDING) AC_DEFINE(MOZ_OFFICIAL_BRANDING)
dnl Using official branding implies an official release build.
MC_OFFICIAL=1 MC_OFFICIAL=1
fi fi
fi fi
@ -5567,7 +5567,7 @@ AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
AC_SUBST(MOZILLA_OFFICIAL) AC_SUBST(MOZILLA_OFFICIAL)
if test "$MOZILLA_OFFICIAL"; then if test "$MOZILLA_OFFICIAL"; then
AC_DEFINE(MOZILLA_OFFICIAL) AC_DEFINE(MOZILLA_OFFICIAL)
# Build revisions should always be present in official builds # Build revisions should always be present in official Mozilla builds
MOZ_INCLUDE_SOURCE_INFO=1 MOZ_INCLUDE_SOURCE_INFO=1
fi fi

View file

@ -90,7 +90,7 @@ def build_dict(config, env=os.environ):
d['bin_suffix'] = substs.get('BIN_SUFFIX', '') d['bin_suffix'] = substs.get('BIN_SUFFIX', '')
d['addon_signing'] = substs.get('MOZ_ADDON_SIGNING') == '1' d['addon_signing'] = substs.get('MOZ_ADDON_SIGNING') == '1'
d['require_signing'] = substs.get('MOZ_REQUIRE_SIGNING') == '1' d['require_signing'] = substs.get('MOZ_REQUIRE_SIGNING') == '1'
d['official'] = bool(substs.get('MOZILLA_OFFICIAL')) d['official'] = bool(substs.get('MC_OFFICIAL'))
d['sm_promise'] = bool(substs.get('SPIDERMONKEY_PROMISE')) d['sm_promise'] = bool(substs.get('SPIDERMONKEY_PROMISE'))
def guess_platform(): def guess_platform():

View file

@ -12,7 +12,7 @@ toolkit.jar:
content/global/about.xhtml content/global/about.xhtml
content/global/aboutAbout.js content/global/aboutAbout.js
content/global/aboutAbout.xhtml content/global/aboutAbout.xhtml
#ifdef MOZILLA_OFFICIAL #ifdef MC_OFFICIAL
content/global/aboutRights.xhtml content/global/aboutRights.xhtml
#else #else
content/global/aboutRights.xhtml (aboutRights-unbranded.xhtml) content/global/aboutRights.xhtml (aboutRights-unbranded.xhtml)

View file

@ -36,11 +36,18 @@ this.AppConstants = Object.freeze({
false, false,
#endif #endif
// Official corresponds, roughly, to whether this build is performed // Official corresponds to whether this build is considered an
// on Mozilla's continuous integration infrastructure. You should // official, branded release for the public. You should
// disable developer-only functionality when this flag is set. // disable developer-only functionality when this flag is set.
// MOZILLA_OFFICIAL is deprecated but kept for extension compatibility.
MOZILLA_OFFICIAL: MOZILLA_OFFICIAL:
#ifdef MOZILLA_OFFICIAL #ifdef MC_OFFICIAL
true,
#else
false,
#endif
MC_OFFICIAL:
#ifdef MC_OFFICIAL
true, true,
#else #else
false, false,

View file

@ -1024,7 +1024,7 @@ nsXULAppInfo::GetDistributionID(nsACString& aResult)
NS_IMETHODIMP NS_IMETHODIMP
nsXULAppInfo::GetIsOfficial(bool* aResult) nsXULAppInfo::GetIsOfficial(bool* aResult)
{ {
#ifdef MOZILLA_OFFICIAL #ifdef MC_OFFICIAL
*aResult = true; *aResult = true;
#else #else
*aResult = false; *aResult = false;

View file

@ -164,7 +164,7 @@ interface nsIXULRuntime : nsISupports
readonly attribute AUTF8String distributionID; readonly attribute AUTF8String distributionID;
/** /**
* True if this is an official build (MOZILLA_OFFICIAL). * True if this is an official build (MC_OFFICIAL).
*/ */
readonly attribute boolean isOfficial; readonly attribute boolean isOfficial;