summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2020-07-08 08:05:43 +0200
committerMyles Borins <mylesborins@github.com>2020-07-16 17:09:10 -0400
commita130771d4fc7d2e360057addab5978f8b4d03f26 (patch)
treeee1ca3d8f35ef2166e8832545ec74da77cae7d09
parentd11496174dead054014b56fa7990c2bcaf3e9a54 (diff)
downloadnode-new-a130771d4fc7d2e360057addab5978f8b4d03f26.tar.gz
build,tools: fix cmd_regen_makefile
Currently, after having configured and built node and then updating a dependent target the following error is produced when trying to rebuild the project: $ ./configure && make -j8 $ touch node.gypi $ make -j8 configure: error: no such option: -f make[1]: *** [Makefile:685: Makefile] Error 2 The reason for this is that the target 'cmd_regen_makefile' is using the command 'configure' instead of 'gyp_node.py' in out/Makefile: cmd_regen_makefile = cd $(srcdir); /work/nodejs/node/configure -fmake As far as I can tell gyp is using sys.argv[0] as the 'gyp_binary' in __init__.py: params = {'options': options, ... 'gyp_binary': sys.argv[0], But when called via 'configure' sys.argv[0] is 'configure' instead of gyp_node.py leading to the above error. This commit suggests setting the program name explicitly in gyp_node.py. Alternatively perhaps this could be done in configure.py instead but I was not sure what would be best. PR-URL: https://github.com/nodejs/node/pull/34255 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
-rwxr-xr-xtools/gyp_node.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/gyp_node.py b/tools/gyp_node.py
index 831d2ef155..333c89f5ae 100755
--- a/tools/gyp_node.py
+++ b/tools/gyp_node.py
@@ -51,6 +51,12 @@ def run_gyp(args):
args.append('-Dlinux_use_bundled_gold=0')
args.append('-Dlinux_use_gold_flags=0')
+ # Set the current program to this module. This is done because gyp
+ # will use the program path in targets it generates. If this script was called
+ # by another script the program name will not be gyp_node.py but whatever
+ # the name of the script that called it is, leading to incorrect commands
+ # in generated targets (for example cmd_regen_makefile).
+ sys.argv[0] = os.path.abspath(__file__)
rc = gyp.main(args)
if rc != 0:
print('Error running GYP')