Add NodeJS build for Windows

This commit is contained in:
Alexandre Lissy 2019-03-20 09:16:09 +01:00
parent 16b7237e70
commit 2a73a76ac3
5 changed files with 33 additions and 5 deletions

View File

@ -135,6 +135,8 @@ define copy_missing_libs
if [ "$(OS)" = "Darwin" ]; then \
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)"; \
missing_libs="$$missing_libs $$new_missing"; \
elif [ "$(OS)" = "${TC_MSYS_VERSION}" ]; then \
missing_libs="libdeepspeech.so"; \
else \
missing_libs="$$missing_libs $$($(LDD) $$lib | grep 'not found' | awk '{ print $$1 }')"; \
fi; \

View File

@ -5,6 +5,7 @@ build:
- "linux-amd64-cpu-opt"
- "linux-rpi3-cpu-opt"
- "linux-arm64-cpu-opt"
- "win-amd64-cpu-opt"
routes:
- "notify.irc-channel.${notifications.irc}.on-exception"
- "notify.irc-channel.${notifications.irc}.on-failed"
@ -21,5 +22,5 @@ build:
build: "taskcluster/node-build.sh"
package: "taskcluster/node-package.sh"
metadata:
name: "DeepSpeech NodeJS package"
description: "Packaging DeepSpeech for registry"
name: "DeepSpeech NodeJS CPU package"
description: "Packaging DeepSpeech CPU for registry"

View File

@ -31,10 +31,12 @@ if [ "${cuda}" = "--cuda" ]; then
cp ${DS_ROOT_TASK}/DeepSpeech/tf/bazel-bin/native_client/liblibdeepspeech.so.ifso ${DS_ROOT_TASK}/DeepSpeech/tf/bazel-bin/native_client/libdeepspeech.so.if.lib
fi
export PATH=$PATH:$(cygpath ${ChocolateyInstall})/bin
export PATH=$PATH:$(cygpath ${ChocolateyInstall})/bin:'/c/Program Files/nodejs/'
do_deepspeech_binary_build
do_deepspeech_nodejs_build "${cuda}"
do_deepspeech_netframework_build
do_nuget_build "${PROJECT_NAME}"

View File

@ -15,3 +15,8 @@ package_native_client "native_client.tar.xz"
cp ${DS_ROOT_TASK}/DeepSpeech/ds/examples/net_framework/CSharpExamples/*.nupkg ${TASKCLUSTER_ARTIFACTS}/
cp ${DS_ROOT_TASK}/DeepSpeech/ds/examples/net_framework/CSharpExamples/DeepSpeechConsole/bin/x64/Release/DeepSpeechConsole.exe ${TASKCLUSTER_ARTIFACTS}/
if [ -f ${DS_ROOT_TASK}/DeepSpeech/ds/native_client/javascript/wrapper.tar.gz ]; then
cp ${DS_ROOT_TASK}/DeepSpeech/ds/native_client/javascript/wrapper.tar.gz ${TASKCLUSTER_ARTIFACTS}/
cp ${DS_ROOT_TASK}/DeepSpeech/ds/native_client/javascript/deepspeech-*.tgz ${TASKCLUSTER_ARTIFACTS}/
fi;

View File

@ -841,7 +841,16 @@ do_deepspeech_nodejs_build()
npm update && npm install node-gyp node-pre-gyp
export PATH="$(npm root)/.bin/:$PATH"
# Python 2.7 is required for node-pre-gyp, it is only required to force it on
# Windows
if [ "${OS}" = "${TC_MSYS_VERSION}" ]; then
NPM_ROOT=$(cygpath -u "$(npm root)")
PYTHON27=":/c/Python27"
else
NPM_ROOT="$(npm root)"
fi
export PATH="$NPM_ROOT/.bin/${PYTHON27}:$PATH"
for node in ${SUPPORTED_NODEJS_VERSIONS}; do
EXTRA_CFLAGS="${EXTRA_LOCAL_CFLAGS}" EXTRA_LDFLAGS="${EXTRA_LOCAL_LDFLAGS}" EXTRA_LIBS="${EXTRA_LOCAL_LIBS}" make -C native_client/javascript \
@ -868,7 +877,16 @@ do_deepspeech_npm_package()
npm update && npm install node-gyp node-pre-gyp
export PATH="$(npm root)/.bin/:$PATH"
# Python 2.7 is required for node-pre-gyp, it is only required to force it on
# Windows
if [ "${OS}" = "${TC_MSYS_VERSION}" ]; then
NPM_ROOT=$(cygpath -u "$(npm root)")
PYTHON27=":/c/Python27"
else
NPM_ROOT="$(npm root)"
fi
export PATH="$NPM_ROOT/.bin/$PYTHON27:$PATH"
all_tasks="$(curl -s https://queue.taskcluster.net/v1/task/${TASK_ID} | python -c 'import json; import sys; print(" ".join(json.loads(sys.stdin.read())["dependencies"]));')"