From f2bc0785b9852dae1b6f5c700fbca41e573aa916 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 13 Apr 2018 22:06:20 +0200 Subject: 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. --- application/palemoon/modules/AboutHomeUtils.jsm | 2 +- application/palemoon/modules/moz.build | 5 ++++- browser/modules/AboutHome.jsm | 2 +- build/autoconf/compiler-opts.m4 | 2 +- config/version.mk | 2 +- js/src/old-configure.in | 1 + old-configure.in | 18 +++++++++--------- python/mozbuild/mozbuild/mozinfo.py | 2 +- toolkit/content/jar.mn | 2 +- toolkit/modules/AppConstants.jsm | 13 ++++++++++--- toolkit/xre/nsAppRunner.cpp | 2 +- xpcom/system/nsIXULRuntime.idl | 2 +- 12 files changed, 32 insertions(+), 21 deletions(-) diff --git a/application/palemoon/modules/AboutHomeUtils.jsm b/application/palemoon/modules/AboutHomeUtils.jsm index 1d4070eaf..72712e1f3 100644 --- a/application/palemoon/modules/AboutHomeUtils.jsm +++ b/application/palemoon/modules/AboutHomeUtils.jsm @@ -44,7 +44,7 @@ this.AboutHomeUtils = { return !Services.prefs.getBoolPref("browser.EULA.override"); } catch (e) { } -#ifndef MOZILLA_OFFICIAL +#ifndef MC_OFFICIAL // Non-official builds shouldn't show the notification. return false; #endif diff --git a/application/palemoon/modules/moz.build b/application/palemoon/modules/moz.build index 7620b9862..f7717ef89 100644 --- a/application/palemoon/modules/moz.build +++ b/application/palemoon/modules/moz.build @@ -37,5 +37,8 @@ EXTRA_PP_JS_MODULES += [ 'RecentWindow.jsm', ] +# Pass down 'official build' flags +if CONFIG['MC_OFFICIAL']: + DEFINES['MC_OFFICIAL'] = 1 if CONFIG['MOZILLA_OFFICIAL']: - DEFINES['MOZILLA_OFFICIAL'] = 1 \ No newline at end of file + DEFINES['MOZILLA_OFFICIAL'] = 1 diff --git a/browser/modules/AboutHome.jsm b/browser/modules/AboutHome.jsm index 8c0fc4c15..639194c20 100644 --- a/browser/modules/AboutHome.jsm +++ b/browser/modules/AboutHome.jsm @@ -47,7 +47,7 @@ this.AboutHomeUtils = { return !Services.prefs.getBoolPref("browser.EULA.override"); } catch (e) { } - if (!AppConstants.MOZILLA_OFFICIAL) { + if (!AppConstants.MC_OFFICIAL) { // Non-official builds shouldn't show the notification. return false; } diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4 index 5e495e107..57a974435 100644 --- a/build/autoconf/compiler-opts.m4 +++ b/build/autoconf/compiler-opts.m4 @@ -7,7 +7,7 @@ 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 + if test -z "$MC_OFFICIAL"; then DEVELOPER_OPTIONS=1 fi MOZ_ARG_ENABLE_BOOL(release, diff --git a/config/version.mk b/config/version.mk index 1b9f68afa..ef8eca9d0 100644 --- a/config/version.mk +++ b/config/version.mk @@ -16,7 +16,7 @@ ifndef RESFILE RCFILE=./module.rc RESFILE=./module.res _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 endif ifdef MOZ_DEBUG diff --git a/js/src/old-configure.in b/js/src/old-configure.in index 5da81ce3e..1736cc5d4 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -2106,6 +2106,7 @@ AC_SUBST(MOZ_APP_VERSION) AC_SUBST(MOZ_PKG_SPECIAL) AC_SUBST(MOZILLA_OFFICIAL) +AC_SUBST(MC_OFFICIAL) dnl ======================================================== dnl ECMAScript Internationalization API Support (uses ICU) diff --git a/old-configure.in b/old-configure.in index 2a9e2c65f..6e2d743d6 100644 --- a/old-configure.in +++ b/old-configure.in @@ -2259,7 +2259,7 @@ MOZ_ARG_HEADER(Application) ENABLE_SYSTEM_EXTENSION_DIRS=1 MOZ_BRANDING_DIRECTORY= MOZ_OFFICIAL_BRANDING= -MC_OFFICIAL=1 +MC_OFFICIAL= MOZ_FEEDS=1 MOZ_AUTH_EXTENSION=1 if test "$MOZ_IOS"; then @@ -2352,10 +2352,10 @@ AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY) dnl ======================================================== dnl = Vendor override dnl ======================================================== -MOZ_ARG_DISABLE_BOOL(official-vendor, -[ --disable-official-vendor Disable the use of official vendor.], - MC_OFFICIAL=, - MC_OFFICIAL=1) +MOZ_ARG_ENABLE_BOOL(official-vendor, +[ --enable-official-vendor This is an official release build.], + MC_OFFICIAL=1, + MC_OFFICIAL=) dnl ======================================================== @@ -2363,11 +2363,10 @@ dnl = Trademarked Branding dnl ======================================================== MOZ_ARG_ENABLE_BOOL(official-branding, [ --enable-official-branding - Enable Official mozilla.org Branding + Enable Official Branding Do not distribute builds with --enable-official-branding unless you have - permission to use trademarks per - http://www.mozilla.org/foundation/trademarks/ .], + permission to use our trademarks!], MOZ_OFFICIAL_BRANDING=1, MOZ_OFFICIAL_BRANDING=) @@ -2587,6 +2586,7 @@ if test -n "$MOZ_OFFICIAL_BRANDING"; then else MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY} AC_DEFINE(MOZ_OFFICIAL_BRANDING) +dnl Using official branding implies an official release build. MC_OFFICIAL=1 fi fi @@ -5481,7 +5481,7 @@ 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 + # Build revisions should always be present in official Mozilla builds MOZ_INCLUDE_SOURCE_INFO=1 fi diff --git a/python/mozbuild/mozbuild/mozinfo.py b/python/mozbuild/mozbuild/mozinfo.py index 712722d62..3e1d0a760 100755 --- a/python/mozbuild/mozbuild/mozinfo.py +++ b/python/mozbuild/mozbuild/mozinfo.py @@ -90,7 +90,7 @@ def build_dict(config, env=os.environ): d['bin_suffix'] = substs.get('BIN_SUFFIX', '') d['addon_signing'] = substs.get('MOZ_ADDON_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')) def guess_platform(): diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index f9ac19a24..851c72250 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -12,7 +12,7 @@ toolkit.jar: content/global/about.xhtml content/global/aboutAbout.js content/global/aboutAbout.xhtml -#ifdef MOZILLA_OFFICIAL +#ifdef MC_OFFICIAL content/global/aboutRights.xhtml #else content/global/aboutRights.xhtml (aboutRights-unbranded.xhtml) diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm index 93acea0ec..2b18f3c1a 100644 --- a/toolkit/modules/AppConstants.jsm +++ b/toolkit/modules/AppConstants.jsm @@ -36,11 +36,18 @@ this.AppConstants = Object.freeze({ false, #endif - // Official corresponds, roughly, to whether this build is performed - // on Mozilla's continuous integration infrastructure. You should + // Official corresponds to whether this build is considered an + // official, branded release for the public. You should // disable developer-only functionality when this flag is set. + // MOZILLA_OFFICIAL is deprecated but kept for extension compatibility. MOZILLA_OFFICIAL: -#ifdef MOZILLA_OFFICIAL +#ifdef MC_OFFICIAL + true, +#else + false, +#endif + MC_OFFICIAL: +#ifdef MC_OFFICIAL true, #else false, diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index b65a4093f..530e4a353 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -1023,7 +1023,7 @@ nsXULAppInfo::GetDistributionID(nsACString& aResult) NS_IMETHODIMP nsXULAppInfo::GetIsOfficial(bool* aResult) { -#ifdef MOZILLA_OFFICIAL +#ifdef MC_OFFICIAL *aResult = true; #else *aResult = false; diff --git a/xpcom/system/nsIXULRuntime.idl b/xpcom/system/nsIXULRuntime.idl index fda0e696f..994084c0a 100644 --- a/xpcom/system/nsIXULRuntime.idl +++ b/xpcom/system/nsIXULRuntime.idl @@ -164,7 +164,7 @@ interface nsIXULRuntime : nsISupports 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; -- cgit v1.2.3