@flun/nodejs-mobile-gyp 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -75
- package/LICENSE +9 -4
- package/README.md +198 -132
- package/addon.gypi +1 -1
- package/bin/node-gyp.js +6 -5
- package/gyp/README.md +5 -3
- package/gyp/data/win/large-pdb-shim.cc +1 -1
- package/gyp/gyp +1 -1
- package/gyp/gyp.bat +1 -1
- package/gyp/gyp_main.py +1 -1
- package/gyp/pylib/gyp/MSVSNew.py +1 -1
- package/gyp/pylib/gyp/MSVSProject.py +1 -1
- package/gyp/pylib/gyp/MSVSSettings.py +1 -1
- package/gyp/pylib/gyp/MSVSToolFile.py +1 -1
- package/gyp/pylib/gyp/MSVSUserFile.py +1 -1
- package/gyp/pylib/gyp/MSVSUtil.py +1 -1
- package/gyp/pylib/gyp/MSVSVersion.py +1 -1
- package/gyp/pylib/gyp/__init__.py +1 -1
- package/gyp/pylib/gyp/common.py +1 -1
- package/gyp/pylib/gyp/easy_xml.py +1 -1
- package/gyp/pylib/gyp/flock_tool.py +1 -1
- package/gyp/pylib/gyp/generator/analyzer.py +1 -1
- package/gyp/pylib/gyp/generator/android.py +1 -1
- package/gyp/pylib/gyp/generator/cmake.py +1 -1
- package/gyp/pylib/gyp/generator/compile_commands_json.py +1 -1
- package/gyp/pylib/gyp/generator/dump_dependency_json.py +1 -1
- package/gyp/pylib/gyp/generator/eclipse.py +1 -1
- package/gyp/pylib/gyp/generator/gypd.py +1 -1
- package/gyp/pylib/gyp/generator/gypsh.py +1 -1
- package/gyp/pylib/gyp/generator/make.py +23 -12
- package/gyp/pylib/gyp/generator/msvs.py +3 -3
- package/gyp/pylib/gyp/generator/ninja.py +1 -1
- package/gyp/pylib/gyp/generator/xcode.py +1 -1
- package/gyp/pylib/gyp/input.py +1 -1
- package/gyp/pylib/gyp/mac_tool.py +1 -1
- package/gyp/pylib/gyp/msvs_emulation.py +1 -1
- package/gyp/pylib/gyp/ninja_syntax.py +1 -1
- package/gyp/pylib/gyp/simple_copy.py +1 -1
- package/gyp/pylib/gyp/win_tool.py +1 -1
- package/gyp/pylib/gyp/xcode_emulation.py +5 -5
- package/gyp/pylib/gyp/xcode_ninja.py +1 -1
- package/gyp/pylib/gyp/xcodeproj_file.py +1 -1
- package/gyp/pylib/gyp/xml_fix.py +1 -1
- package/gyp/pylib/packaging/LICENSE +1 -1
- package/gyp/pylib/packaging/LICENSE.APACHE +1 -1
- package/gyp/pylib/packaging/LICENSE.BSD +1 -1
- package/gyp/pylib/packaging/__init__.py +1 -1
- package/gyp/pylib/packaging/_elffile.py +1 -1
- package/gyp/pylib/packaging/_manylinux.py +1 -1
- package/gyp/pylib/packaging/_musllinux.py +1 -1
- package/gyp/pylib/packaging/_parser.py +1 -1
- package/gyp/pylib/packaging/_structures.py +1 -1
- package/gyp/pylib/packaging/_tokenizer.py +1 -1
- package/gyp/pylib/packaging/markers.py +1 -1
- package/gyp/pylib/packaging/metadata.py +1 -1
- package/gyp/pylib/packaging/requirements.py +1 -1
- package/gyp/pylib/packaging/specifiers.py +1 -1
- package/gyp/pylib/packaging/tags.py +1 -1
- package/gyp/pylib/packaging/utils.py +1 -1
- package/gyp/pylib/packaging/version.py +1 -1
- package/lib/Find-VisualStudio.cs +1 -1
- package/lib/build.js +16 -16
- package/lib/clean.js +2 -2
- package/lib/configure.js +20 -17
- package/lib/create-config-gypi.js +8 -8
- package/lib/download.js +3 -3
- package/lib/find-node-directory.js +9 -9
- package/lib/find-python.js +14 -14
- package/lib/find-visualstudio.js +19 -19
- package/lib/install.js +22 -21
- package/lib/list.js +1 -1
- package/lib/log.js +2 -2
- package/lib/node-gyp.js +7 -7
- package/lib/process-release.js +14 -14
- package/lib/rebuild.js +1 -1
- package/lib/remove.js +2 -2
- package/lib/util.js +5 -4
- package/package.json +3 -3
- package/src/win_delay_load_hook.cc +1 -1
package/gyp/gyp
CHANGED
package/gyp/gyp.bat
CHANGED
package/gyp/gyp_main.py
CHANGED
package/gyp/pylib/gyp/MSVSNew.py
CHANGED
|
@@ -1280,4 +1280,4 @@ _MSBuildOnly(_manifest, "TrackerLogDirectory", _folder_name)
|
|
|
1280
1280
|
# MSBuild MASM settings.
|
|
1281
1281
|
|
|
1282
1282
|
# Options that have the same name in MSVS and MSBuild.
|
|
1283
|
-
_Same(_masm, "UseSafeExceptionHandlers", _boolean) # /safeseh
|
|
1283
|
+
_Same(_masm, "UseSafeExceptionHandlers", _boolean) # /safeseh
|
|
@@ -268,4 +268,4 @@ def InsertLargePdbShims(target_list, target_dicts, vars):
|
|
|
268
268
|
# Update the original target to depend on the shim target.
|
|
269
269
|
target_dict.setdefault("dependencies", []).append(full_shim_target_name)
|
|
270
270
|
|
|
271
|
-
return (target_list, target_dicts)
|
|
271
|
+
return (target_list, target_dicts)
|
package/gyp/pylib/gyp/common.py
CHANGED
|
@@ -156,7 +156,8 @@ cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
|
|
|
156
156
|
# special "figure out circular dependencies" flags around the entire
|
|
157
157
|
# input list during linking.
|
|
158
158
|
quiet_cmd_link = LINK($(TOOLSET)) $@
|
|
159
|
-
cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group
|
|
159
|
+
cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group \
|
|
160
|
+
$(LD_INPUTS) $(LIBS) -Wl,--end-group
|
|
160
161
|
|
|
161
162
|
# Note: this does not handle spaces in paths
|
|
162
163
|
define xargs
|
|
@@ -200,10 +201,12 @@ endef
|
|
|
200
201
|
# - Set SONAME to the library filename so our binaries don't reference
|
|
201
202
|
# the local, absolute paths used on the link command-line.
|
|
202
203
|
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
|
|
203
|
-
cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET))
|
|
204
|
+
cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) \
|
|
205
|
+
-Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)
|
|
204
206
|
|
|
205
207
|
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
|
|
206
|
-
cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET))
|
|
208
|
+
cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) \
|
|
209
|
+
-Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
|
|
207
210
|
""" # noqa: E501
|
|
208
211
|
|
|
209
212
|
LINK_COMMANDS_MAC = """\
|
|
@@ -217,7 +220,8 @@ quiet_cmd_solink = SOLINK($(TOOLSET)) $@
|
|
|
217
220
|
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
|
|
218
221
|
|
|
219
222
|
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
|
|
220
|
-
cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@
|
|
223
|
+
cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ \
|
|
224
|
+
$(filter-out FORCE_DO_CMD, $^) $(LIBS)
|
|
221
225
|
""" # noqa: E501
|
|
222
226
|
|
|
223
227
|
LINK_COMMANDS_ANDROID = """\
|
|
@@ -257,19 +261,24 @@ endef
|
|
|
257
261
|
# input list during linking.
|
|
258
262
|
quiet_cmd_link = LINK($(TOOLSET)) $@
|
|
259
263
|
quiet_cmd_link_host = LINK($(TOOLSET)) $@
|
|
260
|
-
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group
|
|
261
|
-
|
|
264
|
+
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group \
|
|
265
|
+
$(LD_INPUTS) -Wl,--end-group $(LIBS)
|
|
266
|
+
cmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group \
|
|
267
|
+
$(LD_INPUTS) -Wl,--end-group $(LIBS)
|
|
262
268
|
|
|
263
269
|
# Other shared-object link notes:
|
|
264
270
|
# - Set SONAME to the library filename so our binaries don't reference
|
|
265
271
|
# the local, absolute paths used on the link command-line.
|
|
266
272
|
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
|
|
267
|
-
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F)
|
|
273
|
+
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) \
|
|
274
|
+
-o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)
|
|
268
275
|
|
|
269
276
|
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
|
|
270
|
-
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET))
|
|
277
|
+
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) \
|
|
278
|
+
-Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
|
|
271
279
|
quiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@
|
|
272
|
-
cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET))
|
|
280
|
+
cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) \
|
|
281
|
+
-Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
|
|
273
282
|
""" # noqa: E501
|
|
274
283
|
|
|
275
284
|
|
|
@@ -287,7 +296,8 @@ quiet_cmd_solink = SOLINK($(TOOLSET)) $@
|
|
|
287
296
|
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)
|
|
288
297
|
|
|
289
298
|
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
|
|
290
|
-
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@
|
|
299
|
+
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ \
|
|
300
|
+
$(filter-out FORCE_DO_CMD, $^) $(LIBS)
|
|
291
301
|
""" # noqa: E501
|
|
292
302
|
|
|
293
303
|
|
|
@@ -305,7 +315,8 @@ quiet_cmd_solink = SOLINK($(TOOLSET)) $@
|
|
|
305
315
|
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)
|
|
306
316
|
|
|
307
317
|
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
|
|
308
|
-
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@
|
|
318
|
+
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ \
|
|
319
|
+
$(filter-out FORCE_DO_CMD, $^) $(LIBS)
|
|
309
320
|
""" # noqa: E501
|
|
310
321
|
|
|
311
322
|
|
|
@@ -2722,4 +2733,4 @@ def GenerateOutput(target_list, target_dicts, data, params):
|
|
|
2722
2733
|
|
|
2723
2734
|
root_makefile.write(SHARED_FOOTER)
|
|
2724
2735
|
|
|
2725
|
-
root_makefile.close()
|
|
2736
|
+
root_makefile.close()
|
|
@@ -746,8 +746,8 @@ def _EscapeEnvironmentVariableExpansion(s):
|
|
|
746
746
|
|
|
747
747
|
Escapes any % characters so that Windows-style environment variable
|
|
748
748
|
expansions will leave them alone.
|
|
749
|
-
|
|
750
|
-
|
|
749
|
+
原因见 Visual Studio 反馈 106127:
|
|
750
|
+
cl.exe 无法编译文件名含 % 字符的路径;
|
|
751
751
|
|
|
752
752
|
Args:
|
|
753
753
|
s: The string to be escaped.
|
|
@@ -3978,4 +3978,4 @@ def _AddMSBuildAction(
|
|
|
3978
3978
|
)
|
|
3979
3979
|
if additional_inputs:
|
|
3980
3980
|
action_spec.append(["AdditionalInputs", additional_inputs])
|
|
3981
|
-
actions_spec.append(action_spec)
|
|
3981
|
+
actions_spec.append(action_spec)
|
package/gyp/pylib/gyp/input.py
CHANGED
|
@@ -3112,4 +3112,4 @@ def Load(
|
|
|
3112
3112
|
# TODO(mark): Return |data| for now because the generator needs a list of
|
|
3113
3113
|
# build files that came in. In the future, maybe it should just accept
|
|
3114
3114
|
# a list, and not the whole data dict.
|
|
3115
|
-
return [flat_list, targets, data]
|
|
3115
|
+
return [flat_list, targets, data]
|
|
@@ -1701,9 +1701,8 @@ def GetMacInfoPlist(product_dir, xcode_settings, gyp_path_to_build_path):
|
|
|
1701
1701
|
def _GetXcodeEnv(
|
|
1702
1702
|
xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None
|
|
1703
1703
|
):
|
|
1704
|
-
"""
|
|
1705
|
-
|
|
1706
|
-
for a full list.
|
|
1704
|
+
"""返回 Xcode 会设置的环境变量;
|
|
1705
|
+
完整列表见 Xcode Build Setting Reference(TP40003931-CH3-SW153);
|
|
1707
1706
|
|
|
1708
1707
|
Args:
|
|
1709
1708
|
xcode_settings: An XcodeSettings object. If this is None, this function
|
|
@@ -1729,7 +1728,8 @@ def _GetXcodeEnv(
|
|
|
1729
1728
|
"CONFIGURATION": configuration,
|
|
1730
1729
|
"PRODUCT_NAME": xcode_settings.GetProductName(),
|
|
1731
1730
|
# For FULL_PRODUCT_NAME see:
|
|
1732
|
-
# /Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/
|
|
1731
|
+
# /Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/
|
|
1732
|
+
# MacOSX\ Product\ Types.xcspec # noqa: E501
|
|
1733
1733
|
"SRCROOT": srcroot,
|
|
1734
1734
|
"SOURCE_ROOT": "${SRCROOT}",
|
|
1735
1735
|
# This is not true for static libraries, but currently the env is only
|
|
@@ -1932,4 +1932,4 @@ def CloneConfigurationForDeviceAndEmulator(target_dicts):
|
|
|
1932
1932
|
targets for iOS device builds."""
|
|
1933
1933
|
if _HasIOSTarget(target_dicts):
|
|
1934
1934
|
return _AddIOSDeviceConfigurations(target_dicts)
|
|
1935
|
-
return target_dicts
|
|
1935
|
+
return target_dicts
|
package/gyp/pylib/gyp/xml_fix.py
CHANGED
|
@@ -20,4 +20,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
20
20
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
21
21
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
22
22
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
23
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
23
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -249,4 +249,4 @@ def platform_tags(archs: Sequence[str]) -> Iterator[str]:
|
|
|
249
249
|
if glibc_version in _LEGACY_MANYLINUX_MAP:
|
|
250
250
|
legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version]
|
|
251
251
|
if _is_compatible(arch, glibc_version):
|
|
252
|
-
yield f"{legacy_tag}_{arch}"
|
|
252
|
+
yield f"{legacy_tag}_{arch}"
|
|
@@ -822,4 +822,4 @@ class Metadata:
|
|
|
822
822
|
provides: _Validator[Optional[List[str]]] = _Validator(added="1.1")
|
|
823
823
|
"""``Provides`` (deprecated)"""
|
|
824
824
|
obsoletes: _Validator[Optional[List[str]]] = _Validator(added="1.1")
|
|
825
|
-
"""``Obsoletes`` (deprecated)"""
|
|
825
|
+
"""``Obsoletes`` (deprecated)"""
|
package/lib/Find-VisualStudio.cs
CHANGED
package/lib/build.js
CHANGED
|
@@ -9,14 +9,14 @@ import fsSync from 'fs';
|
|
|
9
9
|
|
|
10
10
|
const fs = gracefulFs.promises,
|
|
11
11
|
_hostIsWindows = process.platform === 'win32',
|
|
12
|
-
// Android 交叉编译即使宿主是 Windows
|
|
12
|
+
// Android 交叉编译即使宿主是 Windows,也必须走 make(make-android 生成器)
|
|
13
13
|
_isAndroidCrossBuild = process.env.npm_config_platform === 'android' || process.env.npm_config_format === 'make-android',
|
|
14
|
-
// win 在此文件中语义为"使用 MSBuild"
|
|
14
|
+
// win 在此文件中语义为"使用 MSBuild":仅 Windows 宿主且非 Android 交叉编译
|
|
15
15
|
win = _hostIsWindows && !_isAndroidCrossBuild,
|
|
16
16
|
/**
|
|
17
17
|
* Windows 上 GNU make 需要 sh.exe 来执行 Makefile 里的 Unix 命令
|
|
18
|
-
*
|
|
19
|
-
* 避免要求用户额外安装 MSYS2
|
|
18
|
+
* (printf / xargs / rm 等);优先复用 Git for Windows 自带的 usr/bin,
|
|
19
|
+
* 避免要求用户额外安装 MSYS2;通过 "where git" 反推,不硬编码路径;
|
|
20
20
|
*/
|
|
21
21
|
findWindowsShellDir = () => {
|
|
22
22
|
if (process.platform !== 'win32') return null;
|
|
@@ -24,7 +24,7 @@ const fs = gracefulFs.promises,
|
|
|
24
24
|
try { return fsSync.existsSync(path.join(dir, 'sh.exe')) ? dir : null } catch { return null }
|
|
25
25
|
};
|
|
26
26
|
const toShDir = (gitRoot) => tryShDir(path.join(gitRoot, 'usr', 'bin'));
|
|
27
|
-
// 1)
|
|
27
|
+
// 1) 注册表:Git for Windows 安装时必写,与 PATH 无关(最可靠)
|
|
28
28
|
const reg = process.env.SystemRoot ? path.join(process.env.SystemRoot, 'System32', 'reg.exe') : 'reg.exe';
|
|
29
29
|
for (const hive of ['HKLM', 'HKCU']) {
|
|
30
30
|
for (const key of ['SOFTWARE\\GitForWindows', 'SOFTWARE\\WOW6432Node\\GitForWindows']) {
|
|
@@ -40,7 +40,7 @@ const fs = gracefulFs.promises,
|
|
|
40
40
|
} catch { }
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
// 2) which.sync
|
|
43
|
+
// 2) which.sync(PATH 中能找到 git 时可用)
|
|
44
44
|
try {
|
|
45
45
|
const gitPath = which.sync('git');
|
|
46
46
|
if (gitPath) {
|
|
@@ -49,7 +49,7 @@ const fs = gracefulFs.promises,
|
|
|
49
49
|
if (r) return r;
|
|
50
50
|
}
|
|
51
51
|
} catch { }
|
|
52
|
-
// 3) PATH 中找 git.exe
|
|
52
|
+
// 3) PATH 中找 git.exe,再反推 ../usr/bin
|
|
53
53
|
for (const pd of (process.env.PATH || '').split(';')) {
|
|
54
54
|
if (!pd) continue;
|
|
55
55
|
try {
|
|
@@ -97,11 +97,11 @@ const fs = gracefulFs.promises,
|
|
|
97
97
|
if (win && !verbose) argv.push('/clp:Verbosity=minimal');
|
|
98
98
|
if (win) argv.push('/nologo'); // Windows 上关闭 Microsoft logo
|
|
99
99
|
|
|
100
|
-
//
|
|
100
|
+
// 指定构建类型,默认 Release
|
|
101
101
|
if (win) {
|
|
102
102
|
// 把 .gypi 配置中的 target_arch 转换为 MSBuild 的 /Platform
|
|
103
|
-
// 因为表示"32 位 Intel"
|
|
104
|
-
//
|
|
103
|
+
// 因为表示"32 位 Intel"的方式很多,默认按此处理
|
|
104
|
+
// 注意:msbuild 的 Condition 字符串相等比较不区分大小写
|
|
105
105
|
const archLower = arch.toLowerCase(), p = archLower === 'x64' ? 'x64' : (archLower === 'arm' ? 'ARM'
|
|
106
106
|
: (archLower === 'arm64' ? 'ARM64' : 'Win32'));
|
|
107
107
|
argv.push('/p:Configuration=' + buildType + ';Platform=' + p)
|
|
@@ -122,13 +122,13 @@ const fs = gracefulFs.promises,
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
if (win) {
|
|
125
|
-
// 用户是否指定了自己的 .sln
|
|
125
|
+
// 用户是否指定了自己的 .sln 文件?
|
|
126
126
|
const hasSln = argv.some(arg => path.extname(arg) === '.sln');
|
|
127
127
|
if (!hasSln) argv.unshift(gyp.opts.solution || guessedSolution);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
if (!win) {
|
|
131
|
-
//
|
|
131
|
+
// 把构建期依赖的符号链接(如 Python)加入 PATH
|
|
132
132
|
buildBinsDir = path.resolve('build', 'node_gyp_bins');
|
|
133
133
|
if (_hostIsWindows) {
|
|
134
134
|
const shellDir = findWindowsShellDir();
|
|
@@ -136,7 +136,7 @@ const fs = gracefulFs.promises,
|
|
|
136
136
|
process.env.PATH = `${shellDir};${process.env.PATH}`;
|
|
137
137
|
log.verbose('bin shell', `prepended ${shellDir} to PATH for make`);
|
|
138
138
|
} else {
|
|
139
|
-
log.warn('bin shell', 'no sh.exe found; GNU make 的 Unix
|
|
139
|
+
log.warn('bin shell', 'no sh.exe found; GNU make 的 Unix 命令可能失败;建议安装 Git for Windows');
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
process.env.PATH = _hostIsWindows
|
|
@@ -145,7 +145,7 @@ const fs = gracefulFs.promises,
|
|
|
145
145
|
await fs.mkdir(buildBinsDir, { recursive: true });
|
|
146
146
|
|
|
147
147
|
if (_hostIsWindows) {
|
|
148
|
-
// Windows 无 python3
|
|
148
|
+
// Windows 无 python3 名称,且创建符号链接需要管理员权限;改用 .cmd 桥接
|
|
149
149
|
const shimPath = path.join(buildBinsDir, 'python3.cmd');
|
|
150
150
|
await fs.writeFile(shimPath, `@echo off\r\n"${python}" %*\r\n`);
|
|
151
151
|
log.verbose('bin shims', `created python3.cmd shim to "${python}" and added to PATH`);
|
|
@@ -176,7 +176,7 @@ const fs = gracefulFs.promises,
|
|
|
176
176
|
doWhich = async () => {
|
|
177
177
|
// Windows 使用 node-gyp configure 提供的 msbuild
|
|
178
178
|
if (win) {
|
|
179
|
-
if (!config.variables.msbuild_path) throw new Error('MSBuild
|
|
179
|
+
if (!config.variables.msbuild_path) throw new Error('MSBuild 未设置,请先运行 `node-gyp configure`');
|
|
180
180
|
command = config.variables.msbuild_path, log.verbose('using MSBuild:', command), await doBuild();
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
@@ -190,7 +190,7 @@ const fs = gracefulFs.promises,
|
|
|
190
190
|
*/
|
|
191
191
|
findSolutionFile = async () => {
|
|
192
192
|
const files = await glob('build/*.sln')
|
|
193
|
-
if (files.length === 0) throw new Error('未找到 *.sln
|
|
193
|
+
if (files.length === 0) throw new Error('未找到 *.sln 文件,是否运行过 configure?');
|
|
194
194
|
guessedSolution = files[0], log.verbose('found first Solution file', guessedSolution), await doWhich();
|
|
195
195
|
},
|
|
196
196
|
/**
|