Skip to content
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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

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.

/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 @@ -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; \
Copy link
Contributor

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

Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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...

Copy link
Member Author

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

Copy link
Member

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.

else \
echo Missing or stale $@, please run ./$<; \
exit 1; \
fi

.PHONY: install
install: all ## Installs node into $PREFIX (default=/usr/local).
Expand Down
9 changes: 9 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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 @@ -1447,6 +1449,9 @@ def make_bin_override():

return bin_override

def shell_quote(arg):
return "'" + arg.replace("'", "'\\''") + "'"

output = {
'variables': {},
'include_dirs': [],
Expand Down Expand Up @@ -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 ' +
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

' '.join([shell_quote(arg) for arg in original_argv]) + '\n')
Copy link
Member

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.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

os.chmod('config.status', 0775)

config = {
'BUILDTYPE': 'Debug' if options.debug else 'Release',
'PYTHON': sys.executable,
Expand Down