Skip to content

Commit 3d3dbae

Browse files
addaleaxtargos
authored andcommitted
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: #21371 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
1 parent bb0795a commit 3d3dbae

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ ipch/
6969

7070
/config.mk
7171
/config.gypi
72+
/config.status
7273
/config_fips.gypi
7374
*-nodegyp*
7475
/gyp-mac-tool

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \
114114
$(PYTHON) tools/gyp_node.py -f make
115115

116116
config.gypi: configure
117-
$(error Missing or stale $@, please run ./$<)
117+
@if [ -x config.status ]; then \
118+
./config.status; \
119+
else \
120+
echo Missing or stale $@, please run ./$<; \
121+
exit 1; \
122+
fi
118123

119124
.PHONY: install
120125
install: all ## Installs node into $PREFIX (default=/usr/local).

configure

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ if sys.version_info[0] != 2 or sys.version_info[1] not in (6, 7):
2828
import errno
2929
import optparse
3030
import os
31+
import pipes
3132
import pprint
3233
import re
3334
import shlex
@@ -38,6 +39,8 @@ import string
3839
# If not run from node/, cd to node/.
3940
os.chdir(os.path.dirname(__file__) or '.')
4041

42+
original_argv = sys.argv[1:]
43+
4144
# gcc and g++ as defaults matches what GYP's Makefile generator does,
4245
# except on OS X.
4346
CC = os.environ.get('CC', 'cc' if sys.platform == 'darwin' else 'gcc')
@@ -1530,6 +1533,10 @@ pprint.pprint(output, indent=2)
15301533
write('config.gypi', do_not_edit +
15311534
pprint.pformat(output, indent=2) + '\n')
15321535

1536+
write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' +
1537+
' '.join([pipes.quote(arg) for arg in original_argv]) + '\n')
1538+
os.chmod('config.status', 0775)
1539+
15331540
config = {
15341541
'BUILDTYPE': 'Debug' if options.debug else 'Release',
15351542
'PYTHON': sys.executable,

0 commit comments

Comments
 (0)