Skip to content

Commit bba6e44

Browse files
committed
perf: 不依赖config的node版本
1 parent 18aeeaa commit bba6e44

File tree

7 files changed

+30
-22
lines changed

7 files changed

+30
-22
lines changed

conf/config.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"version": "0.55.0",
66
"template": "https://oss.npmmirror.com/dist/nwjs/v${version}/nwjs-sdk-v${version}-linux-x64.tar.gz"
77
},
8-
"loong64": {
8+
"loongarch64": {
99
"version": "0.65.1",
1010
"template": "https://github.com/msojocs/nwjs-loongarch/releases/download/v0.65.2/nwjs-sdk-v0.65.2-linux-loong64.tar.gz"
1111
}
@@ -56,9 +56,9 @@
5656
"version": "16.13.1",
5757
"template": "https://npmmirror.com/mirrors/node/v${version}/node-v${version}-linux-x64.tar.gz"
5858
},
59-
"loong64": {
60-
"version": "16.13.1",
61-
"template": "https://npmmirror.com/mirrors/node/v${version}/node-v${version}-linux-x64.tar.gz"
59+
"loongarch64": {
60+
"version": "18.20.4",
61+
"template": "https://github.com/loong64/node/releases/download/v${version}/node-v${version}-linux-loong64.tar.gz"
6262
}
6363
}
6464
},

test/fix-md5

Lines changed: 0 additions & 7 deletions
This file was deleted.

test/qemu-loongarch64

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# qemu
3+
docker run --rm --privileged loongcr.lcpu.dev/multiarch/archlinux --reset -p yes
4+
5+
docker run --rm -it \
6+
--name hello \
7+
-v $(pwd):/workspace \
8+
-w /workspace \
9+
--platform=linux/loong64 \
10+
ghcr.io/loong64/debian:trixie-slim \
11+
/bin/bash

tools/fix-other.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ compiler_version=$(node "$root_dir/tools/parse-config.js" --get-compiler-version
1111
arch=$(node "$root_dir/tools/parse-config.js" --get-arch $@)
1212
if [ "$arch" == "x64" ];then
1313
arch="x86_64"
14+
elif [ "$arch" == "loongarch64" ];then
15+
arch="loong64"
1416
fi
1517

1618
mkdir -p "${srcdir}/cache/compiler/v${compiler_version}"

tools/parse-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ for (let i = 0; i < args.length; i++) {
4646
i++;
4747
if (i < args.length) {
4848
if (args[i - 1] === '--arch') {
49-
if (args[i] === 'x64' || args[i] === 'loong64') {
49+
if (args[i] === 'x64' || args[i] === 'loongarch64') {
5050
configArg.arch = args[i];
5151
} else {
5252
console.error(`Invalid value for option --arch: ${args[i]}`);

tools/rebuild-node-modules.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ fail() {
1414

1515
root_dir=$(cd `dirname $0`/.. && pwd -P)
1616
package_dir="$root_dir/package.nw"
17-
export PATH="$root_dir/node/bin:$PATH"
1817

1918
if [ ! -z $1 ];then
2019
NW_VERSION=$1
@@ -44,7 +43,7 @@ arch=$(node "$root_dir/tools/parse-config.js" --get-arch $@)
4443

4544
if [ "$arch" == "loong64" ];then
4645
notice "龙架构,准备交叉编译"
47-
export PATH="$root_dir/cache/cross-tools/target/usr/bin:$root_dir/node/bin:$root_dir/cache/cross-tools/loongarch64-unknown-linux-gnu/bin:$root_dir/cache/cross-tools/bin:$PATH"
46+
export PATH="$root_dir/cache/cross-tools/target/usr/bin:$root_dir/cache/cross-tools/loongarch64-unknown-linux-gnu/bin:$root_dir/cache/cross-tools/bin:$PATH"
4847
tools/cross-loong64-prepare.sh
4948
export CC=loongarch64-unknown-linux-gnu-gcc
5049
export CXX=loongarch64-unknown-linux-gnu-g++
@@ -126,9 +125,12 @@ export JOBS=$max_thread
126125
# 每个模块单独 rebuild,因为交叉编译时可能需要单独调整配置
127126
cd "${package_dir}/node_modules_tmp/node_modules"
128127

128+
node_version=$(node $root_dir/tools/parse-config.js --get-node-version $@)
129+
configure_args="--target_platform=linux --target_arch=${arch} --verbose --host --target=v$node_version"
130+
129131
cd nodegit
130132
notice "Build nodegit"
131-
node-gyp configure --target_platform=linux --target_arch=${arch} --verbose --host
133+
node-gyp configure "$configure_args"
132134
if [ "$arch" == "loong64" ];then
133135
sed -i 's#libssh2ConfigureScript,#`${libssh2ConfigureScript} --host=loongarch64-unknown-linux-gnu`,#' utils/configureLibssh2.js
134136
fi
@@ -137,18 +139,18 @@ rm -rf .github include src lifecycleScripts vendor utils build/vendor build/Rele
137139
cd ..
138140

139141
cd extract-file-icon
140-
node-gyp configure --target_platform=linux --target_arch=${arch} --verbose --host
142+
node-gyp configure "$configure_args"
141143
node-gyp build
142144
cd ..
143145

144146
cd native-keymap
145-
node-gyp configure --target_platform=linux --target_arch=${arch} --verbose --host
147+
node-gyp configure "$configure_args"
146148
node-gyp build
147149
cd ..
148150

149151
cd node-pty
150152
# node build
151-
node-gyp configure --target_platform=linux --target_arch=${arch} --verbose --host
153+
node-gyp configure "$configure_args"
152154
node-gyp build
153155
cd ..
154156
# nw rebuild
@@ -177,7 +179,7 @@ if [ "$arch" == "loong64" ];then
177179
export CFLAGS="$CFLAGS -x c -std=gnu89 -Wno-error=incompatible-pointer-types -Wno-incompatible-pointer-types"
178180
export CXXFLAGS="$CXXFLAGS -Wno-error=incompatible-pointer-types -Wno-incompatible-pointer-types"
179181
fi
180-
node-gyp configure --target_platform=linux --target_arch=${arch} --verbose --host
182+
node-gyp configure "$configure_args"
181183
node-gyp build
182184
cd ../oniguruma
183185
notice "rebuild oniguruma"
@@ -191,7 +193,7 @@ cd ..
191193

192194
cp -fr "spdlog" "spdlog-node"
193195
cd spdlog-node
194-
node-gyp configure --target_platform=linux --target_arch=${arch} --verbose --host
196+
node-gyp configure "$configure_args"
195197
node-gyp build
196198
cd ..
197199
mkdir -p @vscode
@@ -203,7 +205,7 @@ cd ..
203205

204206
cd @vscode/sqlite3
205207
notice "Build @vscode/sqlite3"
206-
node-gyp configure --target_platform=linux --target_arch=${arch} --verbose --host
208+
node-gyp configure "$configure_args"
207209
node-gyp build
208210
cd ../..
209211

tools/setup-wechat-devtools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ if [ $CURRENT_STEP == $INSTALL_START ];then
5252
fi
5353

5454
# 将node加入环境
55-
export PATH="$root_dir/cache/npm/node_global/bin:$root_dir/node/bin:$PATH"
55+
export PATH="$root_dir/cache/npm/node_global/bin:$PATH"
5656
node --version
5757
npm --version
5858

0 commit comments

Comments
 (0)