From 3d3dbae7d8b14e1a32128f957a1b5c333b525da7 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 16 Jun 2018 21:28:34 +0200 Subject: [PATCH] build: remove requirement to re-run ./configure Instead of requiring `./configure` to be run again after the file changed, first try to re-run the configure script with the arguments with which it was originally run. Usually, those arguments will either contain no flags, or all flags that were passed are still supported. PR-URL: https://github.com/nodejs/node/pull/21371 Reviewed-By: Gus Caplan Reviewed-By: Ujjwal Sharma Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Tiancheng "Timothy" Gu --- .gitignore | 1 + Makefile | 7 ++++++- configure | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 27e22ef6183f61..d8b381203b6a00 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,7 @@ ipch/ /config.mk /config.gypi +/config.status /config_fips.gypi *-nodegyp* /gyp-mac-tool diff --git a/Makefile b/Makefile index 55e4c52e7d6ebd..802cccbce6aa6d 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,12 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \ $(PYTHON) tools/gyp_node.py -f make config.gypi: configure - $(error Missing or stale $@, please run ./$<) + @if [ -x config.status ]; then \ + ./config.status; \ + else \ + echo Missing or stale $@, please run ./$<; \ + exit 1; \ + fi .PHONY: install install: all ## Installs node into $PREFIX (default=/usr/local). diff --git a/configure b/configure index efb92701e2606f..3a9ab42414569e 100755 --- a/configure +++ b/configure @@ -28,6 +28,7 @@ if sys.version_info[0] != 2 or sys.version_info[1] not in (6, 7): import errno import optparse import os +import pipes import pprint import re import shlex @@ -38,6 +39,8 @@ import string # If not run from node/, cd to node/. os.chdir(os.path.dirname(__file__) or '.') +original_argv = sys.argv[1:] + # gcc and g++ as defaults matches what GYP's Makefile generator does, # except on OS X. CC = os.environ.get('CC', 'cc' if sys.platform == 'darwin' else 'gcc') @@ -1530,6 +1533,10 @@ pprint.pprint(output, indent=2) write('config.gypi', do_not_edit + pprint.pformat(output, indent=2) + '\n') +write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' + + ' '.join([pipes.quote(arg) for arg in original_argv]) + '\n') +os.chmod('config.status', 0775) + config = { 'BUILDTYPE': 'Debug' if options.debug else 'Release', 'PYTHON': sys.executable,