-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: remove requirement to re-run ./configure #21371
Conversation
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.
@@ -98,7 +98,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; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather have:
$(PYTHON) configure $(something that reads .configure_args as args)
So it will be easier to implement for Windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw shouldn't this be dependant on ls -R *.gyp?
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it will be easier to implement for Windows
We could follow the same approach pretty easily, I think
btw shouldn't this be dependant on
ls -R *.gyp?
as well?
I don’t know, somebody else would have to answer that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I understand why your pattern makes perfect sense for autotools, since it only assumes a POSIX compatible shell...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah … I heard escaping parameters for cmd is fun :)
Otherwise we should be able to follow the same format here if we like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be dependant on
ls -R *.gyp
?
Ideally, yes, but can be done in a separate PR.
@@ -69,6 +69,7 @@ ipch/ | |||
|
|||
/config.mk | |||
/config.gypi | |||
/config.status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggesting a .configure_args
approach, and .*
files are ignored by default.
tl;dr if we simply store the args as Another idea, add a |
@refack This approach and filename match what it’s how the autotools |
But My suggestion is: ---
configure | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 97a75b98569..c8a21c35703 100755
--- a/configure
+++ b/configure
@@ -554,7 +554,13 @@ parser.add_option('-C',
dest='compile_commands_json',
help=optparse.SUPPRESS_HELP)
-(options, args) = parser.parse_args()
+args = sys.argv[1:]
+if args[0] == '--reuse':
+ with open('.used_configure_flags') as f
+ args = f.readlines()
+else:
+ write('.used_configure_flags', '\n'.join(args)
+(options, args) = parser.parse_args(args)
# Expand ~ in the install prefix now, it gets written to multiple files.
options.prefix = os.path.expanduser(options.prefix or '') |
@refack How would this work on Windows? |
#21284 is a PR to avoid that (get it to work similar to this after your change, only there it needs to do CMD batch acrobatics). |
configure
Outdated
@@ -1513,6 +1518,10 @@ pprint.pprint(output, indent=2) | |||
write('config.gypi', do_not_edit + | |||
pprint.pformat(output, indent=2) + '\n') | |||
|
|||
write('config.status', '#!/bin/sh\nset -ex\n./configure ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: How about exec ./configure …
? This should allow getting rid of the set -e
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
configure
Outdated
@@ -1513,6 +1518,10 @@ pprint.pprint(output, indent=2) | |||
write('config.gypi', do_not_edit + | |||
pprint.pformat(output, indent=2) + '\n') | |||
|
|||
write('config.status', '#!/bin/sh\nset -ex\n./configure ' + | |||
' '.join([shell_quote(arg) for arg in original_argv]) + '\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use pipes.quote(arg)
for this (officially deprecated but shlex.quote
doesn't exist in python 2.7.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@@ -98,7 +98,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; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be dependant on
ls -R *.gyp
?
Ideally, yes, but can be done in a separate PR.
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]>
Landed in 074e7f8 |
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]>
Instead of requiring
./configure
to be run again afterthe 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.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes