Skip to content

Commit

Permalink
Backed out changeset ee6dbeaf8852 (bug 1664077) for build bustages on…
Browse files Browse the repository at this point in the history
… gfxFontUtils.h. CLOSED TREE
  • Loading branch information
Razvan Maries committed Sep 15, 2020
1 parent 3fd4726 commit f46af2a
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 13 deletions.
13 changes: 13 additions & 0 deletions build/autoconf/config.status.m4
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ done
cat >> $CONFIG_STATUS <<\EOF
]
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
non_global_defines = [
EOF
if test -n "$_NON_GLOBAL_ACDEFINES"; then
for var in $_NON_GLOBAL_ACDEFINES; do
echo " '$var'," >> $CONFIG_STATUS
done
fi
cat >> $CONFIG_STATUS <<EOF
]
flags = [
undivert(MOZ_DIVERSION_ARGS)dnl
]
Expand Down
3 changes: 3 additions & 0 deletions build/moz.configure/old.configure
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ def post_old_configure(raw_config):
for k, v in iteritems(dict(raw_config['defines'])):
set_old_configure_define(k, v)

set_old_configure_config('non_global_defines',
raw_config['non_global_defines'])


# Assuming no other option is declared after this function, handle the
# env options that were injected by mozconfig_options by creating dummy
Expand Down
6 changes: 4 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ def sanitize_config(v):
sanitized_config = {}
sanitized_config['substs'] = {
k: sanitize_config(v) for k, v in six.iteritems(config)
if k not in ('DEFINES', 'TOPSRCDIR', 'TOPOBJDIR', 'CONFIG_STATUS_DEPS')
if k not in ('DEFINES', 'non_global_defines', 'TOPSRCDIR', 'TOPOBJDIR',
'CONFIG_STATUS_DEPS')
}
sanitized_config['defines'] = {
k: sanitize_config(v) for k, v in six.iteritems(config['DEFINES'])
}
sanitized_config['non_global_defines'] = config['non_global_defines']
sanitized_config['topsrcdir'] = config['TOPSRCDIR']
sanitized_config['topobjdir'] = config['TOPOBJDIR']
sanitized_config['mozconfig'] = config.get('MOZCONFIG')
Expand All @@ -125,7 +127,7 @@ def sanitize_config(v):
fh.write('%s = ' % k)
write_indented_repr(fh, v)
fh.write("__all__ = ['topobjdir', 'topsrcdir', 'defines', "
"'substs', 'mozconfig']")
"'non_global_defines', 'substs', 'mozconfig']")

if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'):
fh.write(textwrap.dedent('''
Expand Down
14 changes: 14 additions & 0 deletions old-configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -2487,6 +2487,7 @@ if test "$NECKO_WIFI"; then
AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
fi
AC_DEFINE(NECKO_WIFI)
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
fi
AC_SUBST(NECKO_WIFI)
AC_SUBST(NECKO_WIFI_DBUS)
Expand Down Expand Up @@ -2833,6 +2834,19 @@ fi
dnl Spit out some output
dnl ========================================================

dnl The following defines are used by xpcom
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
HAVE_GETPAGESIZE
HAVE_STATVFS64
HAVE_STATVFS
HAVE_STATFS64
HAVE_STATFS
HAVE_SYS_STATVFS_H
HAVE_SYS_STATFS_H
HAVE_SYS_VFS_H
HAVE_SYS_MOUNT_H
"

# Avoid using obsolete NSPR features
AC_DEFINE(NO_NSPR_10_SUPPORT)

Expand Down
19 changes: 13 additions & 6 deletions python/mozbuild/mozbuild/backend/configenvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self):
self.topsrcdir = None
self.topobjdir = None
self.defines = {}
self.non_global_defines = []
self.substs = {}
self.files = []
self.mozconfig = None
Expand Down Expand Up @@ -94,10 +95,12 @@ class ConfigEnvironment(object):
the top object directory.
- defines is a dict filled from AC_DEFINE and AC_DEFINE_UNQUOTED in
autoconf.
- non_global_defines are a list of names appearing in defines above
that are not meant to be exported in ACDEFINES (see below)
- substs is a dict filled from AC_SUBST in autoconf.
ConfigEnvironment automatically defines one additional substs variable
from all the defines:
from all the defines not appearing in non_global_defines:
- ACDEFINES contains the defines in the form -DNAME=VALUE, for use on
preprocessor command lines. The order in which defines were given
when creating the ConfigEnvironment is preserved.
Expand All @@ -118,12 +121,13 @@ class ConfigEnvironment(object):
"""

def __init__(self, topsrcdir, topobjdir, defines=None,
substs=None, source=None, mozconfig=None):
non_global_defines=None, substs=None, source=None, mozconfig=None):

if not source:
source = mozpath.join(topobjdir, 'config.status')
self.source = source
self.defines = ReadOnlyDict(defines or {})
self.non_global_defines = non_global_defines or []
self.substs = dict(substs or {})
self.topsrcdir = mozpath.abspath(topsrcdir)
self.topobjdir = mozpath.abspath(topobjdir)
Expand All @@ -146,7 +150,8 @@ def __init__(self, topsrcdir, topobjdir, defines=None,
self.import_suffix = self.dll_suffix
self.bin_suffix = self.substs.get('BIN_SUFFIX', '')

global_defines = [name for name in self.defines]
global_defines = [name for name in self.defines
if name not in self.non_global_defines]
self.substs["ACDEFINES"] = ' '.join(
[
'-D%s=%s' % (name, shell_quote(self.defines[name]).replace('$', '$$'))
Expand Down Expand Up @@ -185,15 +190,16 @@ def is_artifact_build(self):
@memoized_property
def acdefines(self):
acdefines = dict((name, self.defines[name])
for name in self.defines)
for name in self.defines
if name not in self.non_global_defines)
return ReadOnlyDict(acdefines)

@staticmethod
def from_config_status(path):
config = BuildConfig.from_config_status(path)

return ConfigEnvironment(config.topsrcdir, config.topobjdir,
config.defines, config.substs, path)
config.defines, config.non_global_defines, config.substs, path)


class PartialConfigDict(object):
Expand Down Expand Up @@ -308,7 +314,7 @@ class PartialConfigEnvironment(object):
environment.
The PartialConfigEnvironment automatically defines one additional subst variable
from all the defines:
from all the defines not appearing in non_global_defines:
- ACDEFINES contains the defines in the form -DNAME=VALUE, for use on
preprocessor command lines. The order in which defines were given
when creating the ConfigEnvironment is preserved.
Expand All @@ -331,6 +337,7 @@ def write_vars(self, config):

global_defines = [
name for name in config['defines']
if name not in config['non_global_defines']
]
acdefines = ' '.join(['-D%s=%s' % (name,
shell_quote(config['defines'][name]).replace('$', '$$'))
Expand Down
4 changes: 4 additions & 0 deletions python/mozbuild/mozbuild/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ def config_environment(self):
def defines(self):
return self.config_environment.defines

@property
def non_global_defines(self):
return self.config_environment.non_global_defines

@property
def substs(self):
return self.config_environment.substs
Expand Down
8 changes: 5 additions & 3 deletions python/mozbuild/mozbuild/config_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@
'''.strip()


def config_status(topobjdir='.', topsrcdir='.', defines=None, substs=None,
source=None, mozconfig=None, args=sys.argv[1:]):
def config_status(topobjdir='.', topsrcdir='.', defines=None,
non_global_defines=None, substs=None, source=None,
mozconfig=None, args=sys.argv[1:]):
'''Main function, providing config.status functionality.
Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
Expand Down Expand Up @@ -112,7 +113,8 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None, substs=None,
if not options.not_topobjdir:
topobjdir = os.path.realpath('.')

env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines, substs=substs,
env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
non_global_defines=non_global_defines, substs=substs,
source=source, mozconfig=mozconfig)

with FileAvoidWrite(os.path.join(topobjdir, 'mozinfo.json')) as f:
Expand Down
21 changes: 21 additions & 0 deletions python/mozbuild/mozbuild/test/backend/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

CONFIGS = defaultdict(lambda: {
'defines': {},
'non_global_defines': [],
'substs': {'OS_TARGET': 'WINNT'},
}, {
'binary-components': {
'defines': {},
'non_global_defines': [],
'substs': {
'LIB_PREFIX': 'lib',
'RUST_LIB_PREFIX': 'lib',
Expand All @@ -44,6 +46,7 @@
},
'rust-library': {
'defines': {},
'non_global_defines': [],
'substs': {
'COMPILE_ENVIRONMENT': '1',
'RUST_TARGET': 'x86_64-unknown-linux-gnu',
Expand All @@ -55,6 +58,7 @@
},
'host-rust-library': {
'defines': {},
'non_global_defines': [],
'substs': {
'COMPILE_ENVIRONMENT': '1',
'RUST_HOST_TARGET': 'x86_64-unknown-linux-gnu',
Expand All @@ -67,6 +71,7 @@
},
'host-rust-library-features': {
'defines': {},
'non_global_defines': [],
'substs': {
'COMPILE_ENVIRONMENT': '1',
'RUST_HOST_TARGET': 'x86_64-unknown-linux-gnu',
Expand All @@ -79,6 +84,7 @@
},
'rust-library-features': {
'defines': {},
'non_global_defines': [],
'substs': {
'COMPILE_ENVIRONMENT': '1',
'RUST_TARGET': 'x86_64-unknown-linux-gnu',
Expand All @@ -90,6 +96,7 @@
},
'rust-programs': {
'defines': {},
'non_global_defines': [],
'substs': {
'COMPILE_ENVIRONMENT': '1',
'RUST_TARGET': 'i686-pc-windows-msvc',
Expand All @@ -100,6 +107,7 @@
},
'test-support-binaries-tracked': {
'defines': {},
'non_global_defines': [],
'substs': {
'COMPILE_ENVIRONMENT': '1',
'LIB_SUFFIX': 'dll',
Expand All @@ -108,6 +116,7 @@
},
'sources': {
'defines': {},
'non_global_defines': [],
'substs': {
'LIB_PREFIX': 'lib',
'LIB_SUFFIX': 'a',
Expand All @@ -118,13 +127,18 @@
'MOZ_TRUE_1': '1',
'MOZ_TRUE_2': '1',
},
'non_global_defines': [
'MOZ_NONGLOBAL_1',
'MOZ_NONGLOBAL_2',
],
'substs': {
'MOZ_FOO': 'foo',
'MOZ_BAR': 'bar',
},
},
'substitute_config_files': {
'defines': {},
'non_global_defines': [],
'substs': {
'MOZ_FOO': 'foo',
'MOZ_BAR': 'bar',
Expand All @@ -135,18 +149,21 @@
'foo': 'baz qux',
'baz': 1,
},
'non_global_defines': [],
'substs': {
'foo': 'bar baz',
},
},
'visual-studio': {
'defines': {},
'non_global_defines': [],
'substs': {
'MOZ_APP_NAME': 'my_app',
},
},
'prog-lib-c-only': {
'defines': {},
'non_global_defines': [],
'substs': {
'COMPILE_ENVIRONMENT': '1',
'LIB_SUFFIX': '.a',
Expand All @@ -155,6 +172,7 @@
},
'gn-processor': {
'defines': {},
'non_global_defines': [],
'substs': {
'BUILD_BACKENDS': [
'GnMozbuildWriter',
Expand All @@ -172,6 +190,7 @@
},
'ipdl_sources': {
'defines': {},
'non_global_defines': [],
'substs': {
'COMPILE_ENVIRONMENT': '1',
'LIB_SUFFIX': '.a',
Expand All @@ -180,13 +199,15 @@
},
'program-paths': {
'defines': {},
'non_global_defines': [],
'substs': {
'COMPILE_ENVIRONMENT': '1',
'BIN_SUFFIX': '.prog',
},
},
'linkage': {
'defines': {},
'non_global_defines': [],
'substs': {
'CC_TYPE': 'clang',
'COMPILE_ENVIRONMENT': '1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ def test_auto_substs(self):
'''
env = ConfigEnvironment('.', '.',
defines={'foo': 'bar', 'baz': 'qux 42',
'abc': "d'e'f"},
'abc': "d'e'f", 'extra': 'foobar'},
non_global_defines=['extra', 'ignore'],
substs={'FOO': 'bar', 'FOOBAR': '', 'ABC': 'def',
'bar': 'baz qux', 'zzz': '"abc def"',
'qux': ''})
# non_global_defines should be filtered out in ACDEFINES.
# Original order of the defines need to be respected in ACDEFINES
self.assertEqual(env.substs['ACDEFINES'],
"""-Dabc='d'\\''e'\\''f' -Dbaz='qux 42' -Dfoo=bar""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
'defines': {
'MOZ_FOO': '1',
'MOZ_BAR': '2',
'MOZ_NON_GLOBAL': '3',
},
'substs': {
'MOZ_SUBST_1': '1',
'MOZ_SUBST_2': '2',
'CPP': 'cpp',
},
'non_global_defines': [
'MOZ_NON_GLOBAL',
],
}


Expand Down
3 changes: 2 additions & 1 deletion python/mozbuild/mozbuild/test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,10 @@ def test_config_environment(self):
fh.write("topsrcdir = '%s'\n" % topsrcdir)
fh.write("mozconfig = None\n")
fh.write("defines = { 'FOO': 'foo' }\n")
fh.write("non_global_defines = ['BAR']\n")
fh.write("substs = { 'QUX': 'qux' }\n")
fh.write("__all__ = ['topobjdir', 'topsrcdir', 'defines', "
"'substs', 'mozconfig']")
"'non_global_defines', 'substs', 'mozconfig']")

base = self.get_base(topobjdir=d)

Expand Down

0 comments on commit f46af2a

Please sign in to comment.