1 Star 0 Fork 14

成子晗/node-gyp

forked from src-openEuler/node-gyp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
node-gyp-addon-gypi.patch 2.82 KB
一键复制 编辑 原始数据 按行查看 历史
root 提交于 2020-08-28 17:24 . package init
commit 4daac6e35e1ea8e886a823785e7b06e80c933ac2
Author: Tom Hughes <tom@compton.nu>
Date: Mon Jan 18 17:06:18 2016 +0000
Use custom addon.gypi by default instead of downloading node source
diff --git a/lib/configure.js b/lib/configure.js
index 4e06529..046c12f 100644
--- a/lib/configure.js
+++ b/lib/configure.js
@@ -59,24 +59,26 @@ function configure (gyp, argv, callback) {
if ('v' + release.version !== process.version) {
// if --target was given, then determine a target version to compile for
log.verbose('get node dir', 'compiling against --target node version: %s', release.version)
- } else {
- // if no --target was specified then use the current host node version
- log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', release.version)
- }
- if (!release.semver) {
- // could not parse the version string with semver
- return callback(new Error('Invalid version number: ' + release.version))
- }
+ if (!release.semver) {
+ // could not parse the version string with semver
+ return callback(new Error('Invalid version number: ' + release.version))
+ }
- // ensure that the target node version's dev files are installed
- gyp.opts.ensure = true
- gyp.commands.install([ release.version ], function (err, version) {
- if (err) return callback(err)
- log.verbose('get node dir', 'target node version installed:', release.versionDir)
- nodeDir = path.resolve(gyp.devDir, release.versionDir)
+ // ensure that the target node version's dev files are installed
+ gyp.opts.ensure = true
+ gyp.commands.install([ release.version ], function (err, version) {
+ if (err) return callback(err)
+ log.verbose('get node dir', 'target node version installed:', release.versionDir)
+ nodeDir = path.resolve(gyp.devDir, release.versionDir)
+ createBuildDir()
+ })
+ } else {
+ // if no --target was specified then use RPM installed headers
+ log.verbose('get node dir', 'no --target version specified, falling back to RPM installed headers')
+ nodeDir = '/usr/share/node'
createBuildDir()
- })
+ }
}
}
@@ -248,7 +250,8 @@ function configure (gyp, argv, callback) {
// this logic ported from the old `gyp_addon` python file
var gyp_script = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
- var addon_gypi = path.resolve(__dirname, '..', 'addon.gypi')
+ var addon_gypi_file = gyp.opts.target || gyp.opts.nodeDir ? 'addon.gypi' : 'addon-rpm.gypi'
+ var addon_gypi = path.resolve(__dirname, '..', addon_gypi_file)
var common_gypi = path.resolve(nodeDir, 'include/node/common.gypi')
fs.stat(common_gypi, function (err, stat) {
if (err)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chengzihan2/node-gyp.git
git@gitee.com:chengzihan2/node-gyp.git
chengzihan2
node-gyp
node-gyp
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385