Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 97bacdd

Browse files
authored
Merge pull request #1967 from lissyx/npm-win
Npm win
2 parents 6c1fce5 + d421daa commit 97bacdd

File tree

66 files changed

+289
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+289
-92
lines changed

native_client/definitions.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ define copy_missing_libs
135135
if [ "$(OS)" = "Darwin" ]; then \
136136
new_missing="$$( (for f in $$(otool -L $$lib 2>/dev/null | tail -n +2 | awk '{ print $$1 }' | grep -v '$$lib'); do ls -hal $$f; done;) 2>&1 | grep 'No such' | cut -d':' -f2 | xargs basename -a)"; \
137137
missing_libs="$$missing_libs $$new_missing"; \
138+
elif [ "$(OS)" = "${TC_MSYS_VERSION}" ]; then \
139+
missing_libs="libdeepspeech.so"; \
138140
else \
139141
missing_libs="$$missing_libs $$($(LDD) $$lib | grep 'not found' | awk '{ print $$1 }')"; \
140142
fi; \

native_client/javascript/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,22 @@ const binary = require('node-pre-gyp');
22
const path = require('path')
33
// 'lib', 'binding', 'v0.1.1', ['node', 'v' + process.versions.modules, process.platform, process.arch].join('-'), 'deepspeech-bingings.node')
44
const binding_path = binary.find(path.resolve(path.join(__dirname, 'package.json')));
5+
6+
// On Windows, we can't rely on RPATH being set to $ORIGIN/../ or on
7+
// @loader_path/../ but we can change the PATH to include the proper directory
8+
// for the dynamic linker
9+
if (process.platform === 'win32') {
10+
const dslib_path = path.resolve(path.join(binding_path, '../..'));
11+
var oldPath = process.env.PATH;
12+
process.env['PATH'] = `${dslib_path};${process.env.PATH}`;
13+
}
14+
515
const binding = require(binding_path);
616

17+
if (process.platform === 'win32') {
18+
process.env['PATH'] = oldPath;
19+
}
20+
721
function Model() {
822
this._impl = null;
923

taskcluster/.shared.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ nodejs:
4949
prep_9: 'nvm install 9.11.2 && nvm use 9.11.2'
5050
prep_10: 'nvm install 10.12.0 && nvm use 10.12.0'
5151
prep_11: 'nvm install 11.0.0 && nvm use 11.0.0'
52+
win:
53+
sox: 'wget https://sourceforge.net/projects/sox/files/sox/14.4.2/sox-14.4.2-win32.zip/download -O sox-14.4.2-win32.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_TASK_DIR/bin/ -tzip -aoa sox-14.4.2-win32.zip && rm sox-*zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/sox-14.4.2/:$PATH'
54+
prep_4: 'wget https://nodejs.org/dist/v4.9.1/node-v4.9.1-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_TASK_DIR/bin/ -tzip -aoa node-v4.9.1-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v4.9.1-win-x64/:$PATH'
55+
prep_5: 'wget https://nodejs.org/dist/v5.12.0/node-v5.12.0-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_TASK_DIR/bin/ -tzip -aoa node-v5.12.0-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v5.12.0-win-x64/:$PATH'
56+
prep_6: 'wget https://nodejs.org/dist/v6.14.4/node-v6.14.4-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_TASK_DIR/bin/ -tzip -aoa node-v6.14.4-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v6.14.4-win-x64/:$PATH'
57+
prep_7: 'wget https://nodejs.org/dist/v7.10.1/node-v7.10.1-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_TASK_DIR/bin/ -tzip -aoa node-v7.10.1-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v7.10.1-win-x64/:$PATH'
58+
prep_8: 'wget https://nodejs.org/dist/v8.12.0/node-v8.12.0-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_TASK_DIR/bin/ -tzip -aoa node-v8.12.0-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v8.12.0-win-x64/:$PATH'
59+
prep_9: 'wget https://nodejs.org/dist/v9.11.2/node-v9.11.2-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_TASK_DIR/bin/ -tzip -aoa node-v9.11.2-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v9.11.2-win-x64/:$PATH'
60+
prep_10: 'wget https://nodejs.org/dist/v10.12.0/node-v10.12.0-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_TASK_DIR/bin/ -tzip -aoa node-v10.12.0-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v10.12.0-win-x64/:$PATH'
61+
prep_11: 'wget https://nodejs.org/dist/v11.0.0/node-v11.0.0-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_TASK_DIR/bin/ -tzip -aoa node-v11.0.0-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v11.0.0-win-x64/:$PATH'
5262
## swig -javascript requires swig >= 3.0.7 (14.04 provides 2.0.11)
5363
## force 3.0.10 for nodejs V8 API compatibility
5464
swig:
@@ -81,6 +91,7 @@ system:
8191
homedir:
8292
linux: '/home/build-user'
8393
osx: '/Users/build-user'
94+
win: '/c/builds/tc-workdir'
8495
notifications:
8596
irc: '#machinelearning'
8697
aptEc2Mirrors: 'echo "deb http://archive.ubuntu.com/ubuntu/ trusty-updates main" > /etc/apt/sources.list.d/trusty-updates.list && sed -ri -e "s|archive.ubuntu.com|${TASKCLUSTER_WORKER_GROUP}.ec2.archive.ubuntu.com|g" -e "s|security.ubuntu.com|${TASKCLUSTER_WORKER_GROUP}.ec2.archive.ubuntu.com|g" /etc/apt/sources.list && apt-get -qq update && apt-get -qq -y upgrade'

taskcluster/node-build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
set -xe
44

5+
cuda=$1
6+
57
source $(dirname "$0")/../tc-tests-utils.sh
68

79
source ${DS_ROOT_TASK}/DeepSpeech/tf/tc-vars.sh
810

9-
do_deepspeech_npm_package
11+
do_deepspeech_npm_package "${cuda}"

taskcluster/node-package.yml renamed to taskcluster/node-package-cpu.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ build:
55
- "linux-amd64-cpu-opt"
66
- "linux-rpi3-cpu-opt"
77
- "linux-arm64-cpu-opt"
8+
- "win-amd64-cpu-opt"
89
routes:
910
- "notify.irc-channel.${notifications.irc}.on-exception"
1011
- "notify.irc-channel.${notifications.irc}.on-failed"
@@ -21,5 +22,5 @@ build:
2122
build: "taskcluster/node-build.sh"
2223
package: "taskcluster/node-package.sh"
2324
metadata:
24-
name: "DeepSpeech NodeJS package"
25-
description: "Packaging DeepSpeech for registry"
25+
name: "DeepSpeech NodeJS CPU package"
26+
description: "Packaging DeepSpeech CPU for registry"

taskcluster/node-package-gpu.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
build:
2+
template_file: linux-opt-base.tyml
3+
dependencies:
4+
- "linux-amd64-gpu-opt"
5+
- "win-amd64-gpu-opt"
6+
routes:
7+
- "notify.irc-channel.${notifications.irc}.on-exception"
8+
- "notify.irc-channel.${notifications.irc}.on-failed"
9+
system_setup:
10+
>
11+
${nodejs.packages_trusty.prep_6} && ${nodejs.packages_trusty.apt_pinning}
12+
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
13+
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
14+
system_config:
15+
>
16+
${swig.patch_nodejs.linux}
17+
tensorflow: "https://index.taskcluster.net/v1/task/project.deepspeech.tensorflow.pip.r1.13.17f818896d063427d38ba2ec6662902ea4ae79eb.cpu/artifacts/public/home.tar.xz"
18+
scripts:
19+
build: "taskcluster/node-build.sh --cuda"
20+
package: "taskcluster/node-package.sh"
21+
metadata:
22+
name: "DeepSpeech NodeJS GPU package"
23+
description: "Packaging DeepSpeech GPU for registry"

taskcluster/scriptworker-task-github.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ build:
77
- "linux-amd64-cpu-opt"
88
- "linux-amd64-gpu-opt"
99
- "linux-rpi3-cpu-opt"
10-
- "node-package"
10+
- "node-package-gpu"
11+
- "node-package-cpu"
1112
- "android-arm64-cpu-opt"
1213
- "android-armv7-cpu-opt"
1314
- "android-java-opt"
@@ -30,9 +31,9 @@ build:
3031
- "linux-arm64-cpu-opt"
3132
javascript:
3233
# GPU package
33-
- "linux-amd64-gpu-opt"
34+
- "node-package-gpu"
3435
# CPU package with all archs
35-
- "node-package"
36+
- "node-package-cpu"
3637
cpp:
3738
- "darwin-amd64-cpu-opt"
3839
- "linux-amd64-cpu-opt"

taskcluster/scriptworker-task-npm.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ build:
22
template_file: simple-task.tyml
33
dependencies:
44
# Make sure builds are ready
5-
- "linux-amd64-gpu-opt"
6-
- "node-package"
5+
- "node-package-gpu"
6+
- "node-package-cpu"
77
allowed:
88
- "tag"
99
ref_match: "refs/tags/"
@@ -18,9 +18,9 @@ build:
1818
java_aar: []
1919
javascript:
2020
# GPU package
21-
- "linux-amd64-gpu-opt"
21+
- "node-package-gpu"
2222
# CPU package with all archs
23-
- "node-package"
23+
- "node-package-cpu"
2424
nuget: []
2525
metadata:
2626
name: "DeepSpeech NPM Packages"

taskcluster/test-armbian-opt-base.tyml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ then:
3333
$let:
3434
training: { $eval: as_slugid("test-training_upstream-linux-amd64-py27mu-opt") }
3535
linux_arm64_build: { $eval: as_slugid("linux-arm64-cpu-opt") }
36-
node_package: { $eval: as_slugid("node-package") }
36+
node_package_cpu: { $eval: as_slugid("node-package-cpu") }
3737
in:
3838
DEEPSPEECH_ARTIFACTS_ROOT: https://queue.taskcluster.net/v1/task/${linux_arm64_build}/artifacts/public
39-
DEEPSPEECH_NODEJS: https://queue.taskcluster.net/v1/task/${node_package}/artifacts/public
39+
DEEPSPEECH_NODEJS: https://queue.taskcluster.net/v1/task/${node_package_cpu}/artifacts/public
4040
DEEPSPEECH_TEST_MODEL: https://queue.taskcluster.net/v1/task/${training}/artifacts/public/output_graph.pb
4141
DEEPSPEECH_PROD_MODEL: https://github.com/reuben/DeepSpeech/releases/download/v0.2.0-prod-ctcdecode/output_graph.pb
4242
DEEPSPEECH_PROD_MODEL_MMAP: https://github.com/reuben/DeepSpeech/releases/download/v0.2.0-prod-ctcdecode/output_graph.pbmm

taskcluster/test-darwin-opt-base.tyml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ then:
3434
$let:
3535
training: { $eval: as_slugid("test-training_upstream-linux-amd64-py27mu-opt") }
3636
darwin_amd64_build: { $eval: as_slugid("darwin-amd64-cpu-opt") }
37-
node_package: { $eval: as_slugid("node-package") }
37+
node_package_cpu: { $eval: as_slugid("node-package-cpu") }
3838
in:
3939
DEEPSPEECH_ARTIFACTS_ROOT: https://queue.taskcluster.net/v1/task/${darwin_amd64_build}/artifacts/public
40-
DEEPSPEECH_NODEJS: https://queue.taskcluster.net/v1/task/${node_package}/artifacts/public
40+
DEEPSPEECH_NODEJS: https://queue.taskcluster.net/v1/task/${node_package_cpu}/artifacts/public
4141
DEEPSPEECH_TEST_MODEL: https://queue.taskcluster.net/v1/task/${training}/artifacts/public/output_graph.pb
4242
DEEPSPEECH_PROD_MODEL: https://github.com/reuben/DeepSpeech/releases/download/v0.2.0-prod-ctcdecode/output_graph.pb
4343
DEEPSPEECH_PROD_MODEL_MMAP: https://github.com/reuben/DeepSpeech/releases/download/v0.2.0-prod-ctcdecode/output_graph.pbmm

0 commit comments

Comments
 (0)