Skip to content

Commit

Permalink
Bug 1461836 - Write out complete configure dependencies from configur…
Browse files Browse the repository at this point in the history
…e for consumption by make and non-make backends. r=mshal

MozReview-Commit-ID: 792seCZ2rs1

--HG--
extra : rebase_source : e6450cd2947e2fd55085a2af469535421bc07bfb
  • Loading branch information
chmanchester committed May 21, 2018
1 parent d2641f7 commit 636b4fc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 50 deletions.
9 changes: 0 additions & 9 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@ CLOBBER: $(topsrcdir)/CLOBBER
@exit 1
endif

$(topsrcdir)/configure: $(topsrcdir)/configure.in $(topsrcdir)/old-configure.in
$(topsrcdir)/js/src/configure: $(topsrcdir)/js/src/configure.in $(topsrcdir)/js/src/old-configure.in
$(topsrcdir)/configure $(topsrcdir)/js/src/configure:
@echo 'STOP! $? has changed, and your configure is out of date.'
@echo 'Please rerun autoconf and re-configure your build directory.'
@echo 'To ignore this message, touch "$@",'
@echo 'but your build might not succeed.'
@exit 1

config.status: $(configure_dir)/configure $(configure_dir)/old-configure
js/src/config.status: $(topsrcdir)/js/src/configure $(topsrcdir)/js/src/old-configure
config.status js/src/config.status:
Expand Down
28 changes: 3 additions & 25 deletions client.mk
Original file line number Diff line number Diff line change
Expand Up @@ -91,36 +91,14 @@ endif
MAKEFILE = $(wildcard $(OBJDIR)/Makefile)
CONFIG_STATUS = $(wildcard $(OBJDIR)/config.status)

EXTRA_CONFIG_DEPS := \
$(TOPSRCDIR)/aclocal.m4 \
$(TOPSRCDIR)/old-configure.in \
$(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
$(TOPSRCDIR)/js/src/aclocal.m4 \
$(TOPSRCDIR)/js/src/old-configure.in \
$(NULL)
# Include deps for configure written by configure itself.
CONFIG_STATUS_DEPS := $(if $(wildcard $(OBJDIR)/config_status_deps.in),$(shell cat $(OBJDIR)/config_status_deps.in),)

$(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
$(CONFIGURES): %: %.in
@echo Generating $@
cp -f $< $@
chmod +x $@

CONFIG_STATUS_DEPS := \
$(wildcard $(TOPSRCDIR)/*/confvars.sh) \
$(CONFIGURES) \
$(TOPSRCDIR)/nsprpub/configure \
$(TOPSRCDIR)/config/milestone.txt \
$(TOPSRCDIR)/browser/config/version.txt \
$(TOPSRCDIR)/browser/config/version_display.txt \
$(TOPSRCDIR)/build/virtualenv_packages.txt \
$(TOPSRCDIR)/python/mozbuild/mozbuild/virtualenv.py \
$(TOPSRCDIR)/testing/mozbase/packages.txt \
$(OBJDIR)/.mozconfig.json \
$(NULL)

# Include a dep file emitted by configure to track Python files that
# may influence the result of configure.
-include $(OBJDIR)/configure.d

CONFIGURE_ENV_ARGS += \
MAKE='$(MAKE)' \
$(NULL)
Expand Down
21 changes: 9 additions & 12 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
base_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(base_dir, 'python', 'mozbuild'))
from mozbuild.configure import ConfigureSandbox
from mozbuild.makeutil import Makefile
from mozbuild.pythonutil import iter_modules_in_path
from mozbuild.backend.configenvironment import PartialConfigEnvironment
from mozbuild.util import (
indented_repr,
encode,
)
import mozpack.path as mozpath


def main(argv):
Expand Down Expand Up @@ -50,7 +50,7 @@ def sanitized_bools(v):
sanitized_config['substs'] = {
k: sanitized_bools(v) for k, v in config.iteritems()
if k not in ('DEFINES', 'non_global_defines', 'TOPSRCDIR', 'TOPOBJDIR',
'ALL_CONFIGURE_PATHS')
'CONFIG_STATUS_DEPS')
}
sanitized_config['defines'] = {
k: sanitized_bools(v) for k, v in config['DEFINES'].iteritems()
Expand Down Expand Up @@ -93,16 +93,13 @@ def sanitized_bools(v):
partial_config = PartialConfigEnvironment(config['TOPOBJDIR'])
partial_config.write_vars(sanitized_config)

# Write out a depfile so Make knows to re-run configure when relevant Python
# changes.
mk = Makefile()
rule = mk.create_rule()
rule.add_targets(["%s/config.status" % config['TOPOBJDIR']])
rule.add_dependencies(itertools.chain(config['ALL_CONFIGURE_PATHS'],
iter_modules_in_path(config['TOPOBJDIR'],
config['TOPSRCDIR'])))
with open('configure.d', 'w') as fh:
mk.dump(fh)
# Write out a file so the build backend knows to re-run configure when
# relevant Python changes.
with open('config_status_deps.in', 'w') as fh:
for f in itertools.chain(config['CONFIG_STATUS_DEPS'],
iter_modules_in_path(config['TOPOBJDIR'],
config['TOPSRCDIR'])):
fh.write('%s\n' % mozpath.normpath(f))

# Other things than us are going to run this file, so we need to give it
# executable permissions.
Expand Down
32 changes: 28 additions & 4 deletions moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,33 @@ check_prog('7Z', ('7z', '7za'), allow_missing=True, when=target_is_windows)
# Fallthrough to autoconf-based configure
include('build/moz.configure/old.configure')

@depends(check_build_environment, build_project)
@imports('__sandbox__')
def all_paths():
return __sandbox__._all_paths
@imports('glob')
def config_status_deps(build_env, build_project):

set_config('ALL_CONFIGURE_PATHS', all_paths())
# Please do not add anything after setting ALL_CONFIGURE_PATHS.
topsrcdir = build_env.topsrcdir
topobjdir = build_env.topobjdir

return list(__sandbox__._all_paths) + [
os.path.join(topsrcdir, build_project, 'confvars.sh'),
os.path.join(topsrcdir, 'configure'),
os.path.join(topsrcdir, 'js', 'src', 'configure'),
os.path.join(topsrcdir, 'configure.in'),
os.path.join(topsrcdir, 'js', 'src', 'configure.in'),
os.path.join(topsrcdir, 'nsprpub', 'configure'),
os.path.join(topsrcdir, 'config', 'milestone.txt'),
os.path.join(topsrcdir, 'browser', 'config', 'version.txt'),
os.path.join(topsrcdir, 'browser', 'config', 'version_display.txt'),
os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt'),
os.path.join(topsrcdir, 'python', 'mozbuild', 'mozbuild', 'virtualenv.py'),
os.path.join(topsrcdir, 'testing', 'mozbase', 'packages.txt'),
os.path.join(topobjdir, '.mozconfig.json'),
os.path.join(topsrcdir, 'aclocal.m4'),
os.path.join(topsrcdir, 'old-configure.in'),
os.path.join(topsrcdir, 'js', 'src', 'aclocal.m4'),
os.path.join(topsrcdir, 'js', 'src', 'old-configure.in'),
] + glob.glob(os.path.join(topsrcdir, 'build', 'autoconf', '*.m4'))

set_config('CONFIG_STATUS_DEPS', config_status_deps)
# Please do not add anything after setting config_dep_paths.

0 comments on commit 636b4fc

Please sign in to comment.