diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-07 04:26:01 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-07 04:35:16 -0500 |
commit | 0f3e990615adfd42ae9cfbe13a6259cb6a0368c4 (patch) | |
tree | b661be23c84e9cefb9822eef924987828495041b | |
parent | 347e24fcecf58a6664097a28855078b514fdc38c (diff) | |
download | UXP-0f3e990615adfd42ae9cfbe13a6259cb6a0368c4.tar UXP-0f3e990615adfd42ae9cfbe13a6259cb6a0368c4.tar.gz UXP-0f3e990615adfd42ae9cfbe13a6259cb6a0368c4.tar.lz UXP-0f3e990615adfd42ae9cfbe13a6259cb6a0368c4.tar.xz UXP-0f3e990615adfd42ae9cfbe13a6259cb6a0368c4.zip |
Add configure variable verification
-rw-r--r-- | build/directive4.py | 73 | ||||
-rw-r--r-- | old-configure.in | 29 |
2 files changed, 102 insertions, 0 deletions
diff --git a/build/directive4.py b/build/directive4.py new file mode 100644 index 000000000..2a49f3028 --- /dev/null +++ b/build/directive4.py @@ -0,0 +1,73 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Imports +from __future__ import print_function, unicode_literals +from collections import OrderedDict + +import os +import sys +import json + +# Sanity check +if not len(sys.argv) > 1: + print("Incorrect number of arguments") + sys.exit(1) + +# Vars +listConfigure = sys.argv[1:] +listConfig = [] +strBrandingDirectory = "" + +# Build a list of set configure variables +for _value in listConfigure: + _splitString = _value.split("=") + + if _splitString[1] == "1": + listConfig += [ _splitString[0] ] + elif _splitString[0] == "MOZ_BRANDING_DIRECTORY": + strBrandingDirectory = _splitString[1] + +# Only applies if using Official Branding or specific branding directories +if ('MOZ_OFFICIAL_BRANDING' in listConfig) or (strBrandingDirectory.endswith("branding/official")) or (strBrandingDirectory.endswith("branding/unstable")): + # Applies to Pale Moon and Basilisk + if ('MC_BASILISK' in listConfig) or ('MC_PALEMOON' in listConfig): + # Define a list of system libs + listSystemLibs = [ + 'MOZ_SYSTEM_LIBEVENT', + 'MOZ_SYSTEM_NSS', + 'MOZ_SYSTEM_NSPR', + 'MOZ_SYSTEM_JPEG', + 'MOZ_SYSTEM_ZLIB', + 'MOZ_SYSTEM_BZ2', + 'MOZ_SYSTEM_PNG', + 'MOZ_SYSTEM_LIBVPX', + 'MOZ_SYSTEM_SQLITE', + 'MOZ_SYSTEM_JEMALLOC' + ] + + # Iterate through system libs and output 1 to DIRECTIVE4 if any are found + for _value in listSystemLibs: + if _value in listConfig: + sys.stdout.write("1") + sys.exit(1) + + # Applies only to Pale Moon + if 'MC_PALEMOON' in listConfig: + # Define a list of configure features that are in violation of Official branding + listFeatureViolations = [ + 'MOZ_SANDBOX', + 'MOZ_WEBRTC' + ] + + # Iterate through features and output 1 to DIRECTIVE4 if any violations are found + for _value in listFeatureViolations: + if _value in listConfig: + sys.stdout.write("1") + sys.exit(1) + +# Exit outputting nothing to DIRECTIVE4 being empty because there are no violations +sys.exit(0) + + diff --git a/old-configure.in b/old-configure.in index 5942b0139..76f9d3a4d 100644 --- a/old-configure.in +++ b/old-configure.in @@ -5760,6 +5760,35 @@ fi AC_SUBST(MOZILLA_VERSION) +dnl ======================================================== +dnl Directive 4 +dnl ======================================================== + +DIRECTIVE4_LIST="MOZ_OFFICIAL_BRANDING=$MOZ_OFFICIAL_BRANDING +MOZ_BRANDING_DIRECTORY=$MOZ_BRANDING_DIRECTORY +MC_BASILISK=$MC_BASILISK +MC_PALEMOON=$MC_PALEMOON +MOZ_SANDBOX=$MOZ_SANDBOX +MOZ_WEBRTC=$MOZ_WEBRTC +MOZ_SYSTEM_LIBEVENT=$MOZ_SYSTEM_LIBEVENT +MOZ_SYSTEM_NSS=$MOZ_SYSTEM_NSS +MOZ_SYSTEM_NSPR=$MOZ_SYSTEM_NSPR +MOZ_SYSTEM_JPEG=$MOZ_SYSTEM_JPEG +MOZ_SYSTEM_ZLIB=$MOZ_SYSTEM_ZLIB +MOZ_SYSTEM_BZ2=$MOZ_SYSTEM_BZ2 +MOZ_SYSTEM_PNG=$MOZ_SYSTEM_PNG +MOZ_SYSTEM_LIBVPX=$MOZ_SYSTEM_LIBVPX +MOZ_SYSTEM_SQLITE=$MOZ_SYSTEM_SQLITE +MOZ_SYSTEM_JEMALLOC=$MOZ_SYSTEM_JEMALLOC" + +DIRECTIVE4=`$PYTHON $_topsrcdir/build/directive4.py $DIRECTIVE4_LIST` + +if test -n "$DIRECTIVE4"; then + AC_ERROR([Branding Violation - Please see: http://www.palemoon.org/redist.shtml]) +fi + +AC_SUBST(DIRECTIVE4) + dnl Spit out some output dnl ======================================================== |