build: add library_files to gyp variables

GYP uses the system path when parsing node.gyp;
However, if system python is different from our
gyp runtime python, like '2.7', gyp would crash.

Co-authored-by: Michaël Zasso <targos@protonmail.com>

PR-URL: https://github.com/nodejs/node/pull/39293
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
himself65andMichaël Zasso committed 2021-07-14 10:44:56 +08:00
1 parent c506660f32
commit cfb7c4f658
3 files changed
+5 -23

No files matched your search

+4
View File
@@ -45,6 +45,7 @@ import getmoduleversion
import getnapibuildversion
import getsharedopensslhasquic
from gyp_node import run_gyp
from utils import SearchFiles
# parse our options
parser = argparse.ArgumentParser()
@@ -1155,6 +1156,8 @@ def gcc_version_ge(version_checked):
return False
return True
def configure_node_lib_files(o):
o['variables']['node_library_files'] = SearchFiles('lib', 'js')
def configure_node(o):
if options.dest_os == 'android':
@@ -1903,6 +1906,7 @@ if (options.dest_os):
flavor = GetFlavor(flavor_params)
configure_node(output)
configure_node_lib_files(output)
configure_napi(output)
configure_library('zlib', output)
configure_library('http_parser', output)
+1 -1
View File
@@ -33,7 +33,7 @@
# Windows command length limit or there would be an error.
# See https://docs.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation
'library_files': [
'<!@(python tools/search_files.py --ext js lib)',
'<@(node_library_files)',
],
'deps_files': [
'deps/v8/tools/splaytree.mjs',
-22
View File
@@ -1,22 +0,0 @@
#!/usr/bin/env python
"""
This is a utility for recursively searching files under
a specified directory
"""
import argparse
import utils
def main():
parser = argparse.ArgumentParser(
description='Search files with a specific extension under a directory',
fromfile_prefix_chars='@'
)
parser.add_argument('--ext', required=True, help='extension to search for')
parser.add_argument('directory', help='input directory')
options = parser.parse_args()
print('\n'.join(utils.SearchFiles(options.directory, options.ext)))
if __name__ == "__main__":
main()