Skip to content

Commit

Permalink
build: remove requirement to re-run ./configure
Browse files Browse the repository at this point in the history
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 <me@gus.host>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
  • Loading branch information
addaleax authored and targos committed Jun 30, 2018
1 parent bb0795a commit 3d3dbae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ ipch/

/config.mk
/config.gypi
/config.status
/config_fips.gypi
*-nodegyp*
/gyp-mac-tool
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
7 changes: 7 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3d3dbae

Please sign in to comment.