mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1231314 - Turn mozilla-config.h and js-confdefs.h into CONFIGURE_DEFINE_FILES. r=gps
Both these files, are, after all, define files, like other CONFIGURE_DEFINE_FILES. They only happen to have a special requirement for an expansion for all defines, which doesn't need to happen through traditional preprocessing. This change adds consistency in how configure-related headers are being handled.
This commit is contained in:
parent
cc975ebcf9
commit
d767fb0352
@ -6,7 +6,8 @@
|
|||||||
#ifndef js_confdefs_h
|
#ifndef js_confdefs_h
|
||||||
#define js_confdefs_h
|
#define js_confdefs_h
|
||||||
|
|
||||||
@ALLDEFINES@
|
// Expands to all the defines from configure.
|
||||||
|
#undef ALLDEFINES
|
||||||
|
|
||||||
#include "js/RequiredDefines.h"
|
#include "js/RequiredDefines.h"
|
||||||
|
|
||||||
|
@ -61,10 +61,12 @@ TEST_DIRS += ['jsapi-tests', 'tests', 'gdb']
|
|||||||
|
|
||||||
CONFIGURE_SUBST_FILES += [
|
CONFIGURE_SUBST_FILES += [
|
||||||
'devtools/rootAnalysis/Makefile',
|
'devtools/rootAnalysis/Makefile',
|
||||||
'js-confdefs.h',
|
|
||||||
'js-config',
|
'js-config',
|
||||||
'js.pc',
|
'js.pc',
|
||||||
]
|
]
|
||||||
|
CONFIGURE_DEFINE_FILES += [
|
||||||
|
'js-confdefs.h',
|
||||||
|
]
|
||||||
|
|
||||||
if not CONFIG['JS_STANDALONE']:
|
if not CONFIG['JS_STANDALONE']:
|
||||||
CONFIGURE_SUBST_FILES += [
|
CONFIGURE_SUBST_FILES += [
|
||||||
|
@ -23,9 +23,11 @@ DIRS += [
|
|||||||
|
|
||||||
if not CONFIG['JS_STANDALONE']:
|
if not CONFIG['JS_STANDALONE']:
|
||||||
CONFIGURE_SUBST_FILES += [
|
CONFIGURE_SUBST_FILES += [
|
||||||
'mozilla-config.h',
|
|
||||||
'tools/update-packaging/Makefile',
|
'tools/update-packaging/Makefile',
|
||||||
]
|
]
|
||||||
|
CONFIGURE_DEFINE_FILES += [
|
||||||
|
'mozilla-config.h',
|
||||||
|
]
|
||||||
|
|
||||||
DIRS += [
|
DIRS += [
|
||||||
'build',
|
'build',
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ALLDEFINES@
|
// Expands to all the defines from configure.
|
||||||
|
#undef ALLDEFINES
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The c99 defining the limit macros (UINT32_MAX for example), says:
|
* The c99 defining the limit macros (UINT32_MAX for example), says:
|
||||||
|
@ -382,6 +382,9 @@ class CommonBackend(BuildBackend):
|
|||||||
"#define NAME ORIGINAL_VALUE" is turned into "#define NAME VALUE"
|
"#define NAME ORIGINAL_VALUE" is turned into "#define NAME VALUE"
|
||||||
"#undef UNKNOWN_NAME" is turned into "/* #undef UNKNOWN_NAME */"
|
"#undef UNKNOWN_NAME" is turned into "/* #undef UNKNOWN_NAME */"
|
||||||
Whitespaces are preserved.
|
Whitespaces are preserved.
|
||||||
|
|
||||||
|
As a special rule, "#undef ALLDEFINES" is turned into "#define NAME
|
||||||
|
VALUE" for all the defined variables.
|
||||||
'''
|
'''
|
||||||
with self._write_file(obj.output_path) as fh, \
|
with self._write_file(obj.output_path) as fh, \
|
||||||
open(obj.input_path, 'rU') as input:
|
open(obj.input_path, 'rU') as input:
|
||||||
@ -393,7 +396,18 @@ class CommonBackend(BuildBackend):
|
|||||||
name = m.group('name')
|
name = m.group('name')
|
||||||
value = m.group('value')
|
value = m.group('value')
|
||||||
if name:
|
if name:
|
||||||
if name in obj.config.defines:
|
if name == 'ALLDEFINES':
|
||||||
|
if cmd == 'define':
|
||||||
|
raise Exception(
|
||||||
|
'`#define ALLDEFINES` is not allowed in a '
|
||||||
|
'CONFIGURE_DEFINE_FILE')
|
||||||
|
defines = '\n'.join(sorted(
|
||||||
|
'#define %s %s' % (name, val)
|
||||||
|
for name, val in obj.config.defines.iteritems()
|
||||||
|
if name not in obj.config.non_global_defines))
|
||||||
|
l = l[:m.start('cmd') - 1] \
|
||||||
|
+ defines + l[m.end('name'):]
|
||||||
|
elif name in obj.config.defines:
|
||||||
if cmd == 'define' and value:
|
if cmd == 'define' and value:
|
||||||
l = l[:m.start('value')] \
|
l = l[:m.start('value')] \
|
||||||
+ str(obj.config.defines[name]) \
|
+ str(obj.config.defines[name]) \
|
||||||
|
@ -81,24 +81,20 @@ class ConfigEnvironment(object):
|
|||||||
- defines is a list of (name, value) tuples. In autoconf, these are
|
- defines is a list of (name, value) tuples. In autoconf, these are
|
||||||
set with AC_DEFINE and AC_DEFINE_UNQUOTED
|
set with AC_DEFINE and AC_DEFINE_UNQUOTED
|
||||||
- non_global_defines are a list of names appearing in defines above
|
- non_global_defines are a list of names appearing in defines above
|
||||||
that are not meant to be exported in ACDEFINES and ALLDEFINES (see
|
that are not meant to be exported in ACDEFINES (see below)
|
||||||
below)
|
|
||||||
- substs is a list of (name, value) tuples. In autoconf, these are
|
- substs is a list of (name, value) tuples. In autoconf, these are
|
||||||
set with AC_SUBST.
|
set with AC_SUBST.
|
||||||
|
|
||||||
ConfigEnvironment automatically defines two additional substs variables
|
ConfigEnvironment automatically defines one additional substs variable
|
||||||
from all the defines not appearing in non_global_defines:
|
from all the defines not appearing in non_global_defines:
|
||||||
- ACDEFINES contains the defines in the form -DNAME=VALUE, for use on
|
- ACDEFINES contains the defines in the form -DNAME=VALUE, for use on
|
||||||
preprocessor command lines. The order in which defines were given
|
preprocessor command lines. The order in which defines were given
|
||||||
when creating the ConfigEnvironment is preserved.
|
when creating the ConfigEnvironment is preserved.
|
||||||
- ALLDEFINES contains the defines in the form #define NAME VALUE, in
|
|
||||||
sorted order, for use in config files, for an automatic listing of
|
|
||||||
defines.
|
|
||||||
and two other additional subst variables from all the other substs:
|
and two other additional subst variables from all the other substs:
|
||||||
- ALLSUBSTS contains the substs in the form NAME = VALUE, in sorted
|
- ALLSUBSTS contains the substs in the form NAME = VALUE, in sorted
|
||||||
order, for use in autoconf.mk. It includes ACDEFINES, but doesn't
|
order, for use in autoconf.mk. It includes ACDEFINES
|
||||||
include ALLDEFINES. Only substs with a VALUE are included, such that
|
Only substs with a VALUE are included, such that the resulting file
|
||||||
the resulting file doesn't change when new empty substs are added.
|
doesn't change when new empty substs are added.
|
||||||
This results in less invalidation of build dependencies in the case
|
This results in less invalidation of build dependencies in the case
|
||||||
of autoconf.mk..
|
of autoconf.mk..
|
||||||
- ALLEMPTYSUBSTS contains the substs with an empty value, in the form
|
- ALLEMPTYSUBSTS contains the substs with an empty value, in the form
|
||||||
@ -117,6 +113,7 @@ class ConfigEnvironment(object):
|
|||||||
source = mozpath.join(topobjdir, 'config.status')
|
source = mozpath.join(topobjdir, 'config.status')
|
||||||
self.source = source
|
self.source = source
|
||||||
self.defines = ReadOnlyDict(defines)
|
self.defines = ReadOnlyDict(defines)
|
||||||
|
self.non_global_defines = non_global_defines
|
||||||
self.substs = dict(substs)
|
self.substs = dict(substs)
|
||||||
self.topsrcdir = mozpath.abspath(topsrcdir)
|
self.topsrcdir = mozpath.abspath(topsrcdir)
|
||||||
self.topobjdir = mozpath.abspath(topobjdir)
|
self.topobjdir = mozpath.abspath(topobjdir)
|
||||||
@ -146,8 +143,6 @@ class ConfigEnvironment(object):
|
|||||||
serialize(self.substs[name])) for name in self.substs if self.substs[name]]))
|
serialize(self.substs[name])) for name in self.substs if self.substs[name]]))
|
||||||
self.substs['ALLEMPTYSUBSTS'] = '\n'.join(sorted(['%s =' % name
|
self.substs['ALLEMPTYSUBSTS'] = '\n'.join(sorted(['%s =' % name
|
||||||
for name in self.substs if not self.substs[name]]))
|
for name in self.substs if not self.substs[name]]))
|
||||||
self.substs['ALLDEFINES'] = '\n'.join(sorted(['#define %s %s' % (name,
|
|
||||||
self.defines[name]) for name in global_defines]))
|
|
||||||
|
|
||||||
self.substs = ReadOnlyDict(self.substs)
|
self.substs = ReadOnlyDict(self.substs)
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ class ConfigEnvironment(ConfigStatus.ConfigEnvironment):
|
|||||||
|
|
||||||
class TestEnvironment(unittest.TestCase):
|
class TestEnvironment(unittest.TestCase):
|
||||||
def test_auto_substs(self):
|
def test_auto_substs(self):
|
||||||
'''Test the automatically set values of ACDEFINES, ALLDEFINES,
|
'''Test the automatically set values of ACDEFINES, ALLSUBSTS
|
||||||
ALLSUBSTS and ALLEMPTYSUBSTS.
|
and ALLEMPTYSUBSTS.
|
||||||
'''
|
'''
|
||||||
env = ConfigEnvironment('.', '.',
|
env = ConfigEnvironment('.', '.',
|
||||||
defines = [ ('foo', 'bar'), ('baz', 'qux 42'),
|
defines = [ ('foo', 'bar'), ('baz', 'qux 42'),
|
||||||
@ -45,16 +45,10 @@ class TestEnvironment(unittest.TestCase):
|
|||||||
substs = [ ('FOO', 'bar'), ('FOOBAR', ''), ('ABC', 'def'),
|
substs = [ ('FOO', 'bar'), ('FOOBAR', ''), ('ABC', 'def'),
|
||||||
('bar', 'baz qux'), ('zzz', '"abc def"'),
|
('bar', 'baz qux'), ('zzz', '"abc def"'),
|
||||||
('qux', '') ])
|
('qux', '') ])
|
||||||
# non_global_defines should be filtered out in ACDEFINES and
|
# non_global_defines should be filtered out in ACDEFINES.
|
||||||
# ALLDEFINES.
|
|
||||||
# Original order of the defines need to be respected in ACDEFINES
|
# Original order of the defines need to be respected in ACDEFINES
|
||||||
self.assertEqual(env.substs['ACDEFINES'], """-Dfoo=bar -Dbaz='qux 42' -Dabc='d'\\''e'\\''f'""")
|
self.assertEqual(env.substs['ACDEFINES'], """-Dfoo=bar -Dbaz='qux 42' -Dabc='d'\\''e'\\''f'""")
|
||||||
# ALLDEFINES, on the other hand, needs to be sorted
|
# Likewise for ALLSUBSTS, which also must contain ACDEFINES
|
||||||
self.assertEqual(env.substs['ALLDEFINES'], '''#define abc d'e'f
|
|
||||||
#define baz qux 42
|
|
||||||
#define foo bar''')
|
|
||||||
# Likewise for ALLSUBSTS, which also mustn't contain ALLDEFINES
|
|
||||||
# but contain ACDEFINES
|
|
||||||
self.assertEqual(env.substs['ALLSUBSTS'], '''ABC = def
|
self.assertEqual(env.substs['ALLSUBSTS'], '''ABC = def
|
||||||
ACDEFINES = -Dfoo=bar -Dbaz='qux 42' -Dabc='d'\\''e'\\''f'
|
ACDEFINES = -Dfoo=bar -Dbaz='qux 42' -Dabc='d'\\''e'\\''f'
|
||||||
FOO = bar
|
FOO = bar
|
||||||
|
Loading…
Reference in New Issue
Block a user