Fangjun Kuang
Committed by GitHub

Fix building for .Net (#463)

1 -name: dot-net 1 +name: release-nuget-package
2 2
3 on: 3 on:
4 - push:  
5 - branches:  
6 - - dot-net  
7 - - fix-dot-net  
8 - tags:  
9 - - '*'  
10 -  
11 workflow_dispatch: 4 workflow_dispatch:
12 5
13 concurrency: 6 concurrency:
14 - group: dot-net-${{ github.ref }} 7 + group: release-nuget-package
15 cancel-in-progress: true 8 cancel-in-progress: true
16 9
  10 +permissions:
  11 + contents: read
  12 +
17 jobs: 13 jobs:
18 - build-libs:  
19 - name: dot-net for ${{ matrix.os }} 14 + release-nuget-package:
20 runs-on: ${{ matrix.os }} 15 runs-on: ${{ matrix.os }}
21 strategy: 16 strategy:
22 fail-fast: false 17 fail-fast: false
23 matrix: 18 matrix:
24 - os: [ubuntu-latest, windows-latest, macos-latest]  
25 -  
26 - steps:  
27 - - uses: actions/checkout@v4  
28 - # see https://cibuildwheel.readthedocs.io/en/stable/changelog/  
29 - # for a list of versions  
30 - - name: Build wheels  
31 - uses: pypa/cibuildwheel@v2.11.4  
32 - env:  
33 - CIBW_BEFORE_BUILD: "pip install -U cmake numpy"  
34 - CIBW_BUILD: "cp38-*64"  
35 - CIBW_SKIP: "cp27-* cp35-* cp36-* *-win32 pp* *-musllinux* *-manylinux_i686"  
36 - CIBW_BUILD_VERBOSITY: 3  
37 - CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH='/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib'  
38 - CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""  
39 -  
40 - - name: Display wheels  
41 - shell: bash  
42 - run: |  
43 - ls -lh ./wheelhouse/*.whl  
44 - unzip -l ./wheelhouse/*.whl  
45 -  
46 - - uses: actions/upload-artifact@v3  
47 - with:  
48 - name: ${{ matrix.os }}-wheels  
49 - path: ./wheelhouse/*.whl  
50 -  
51 - build-nuget-packages:  
52 - name: build-nuget-packages  
53 - runs-on: ubuntu-latest  
54 - needs: build-libs 19 + os: [ubuntu-latest]
55 20
56 steps: 21 steps:
57 - uses: actions/checkout@v4 22 - uses: actions/checkout@v4
58 -  
59 - - name: Retrieve artifact from ubuntu-latest  
60 - uses: actions/download-artifact@v2  
61 - with:  
62 - name: ubuntu-latest-wheels  
63 - path: ./linux  
64 -  
65 - - name: Retrieve artifact from macos-latest  
66 - uses: actions/download-artifact@v2  
67 - with:  
68 - name: macos-latest-wheels  
69 - path: ./macos  
70 -  
71 - - name: Retrieve artifact from windows-latest  
72 - uses: actions/download-artifact@v2  
73 - with:  
74 - name: windows-latest-wheels  
75 - path: ./windows  
76 -  
77 - - name: Display wheels  
78 - shell: bash  
79 - run: |  
80 - tree .  
81 -  
82 - - name: Unzip Ubuntu wheels  
83 - shell: bash  
84 - run: |  
85 - cd linux  
86 - unzip ./*.whl  
87 - tree .  
88 -  
89 - - name: Unzip macOS wheels  
90 - shell: bash  
91 - run: |  
92 - cd macos  
93 - unzip ./*.whl  
94 - tree .  
95 -  
96 - - name: Unzip Windows wheels  
97 - shell: bash  
98 - run: |  
99 - cd windows  
100 - unzip ./*.whl  
101 - tree .  
102 -  
103 - - name: Setup .NET Core 3.1  
104 - uses: actions/setup-dotnet@v1  
105 with: 23 with:
106 - dotnet-version: 3.1.x 24 + fetch-depth: 0
107 25
108 - - name: Setup .NET 7.0 26 + - name: Setup .NET
109 uses: actions/setup-dotnet@v1 27 uses: actions/setup-dotnet@v1
110 with: 28 with:
111 - dotnet-version: 7.0.x 29 + dotnet-version: |
  30 + 6.0.x
  31 + 7.0.x
112 32
113 - name: Check dotnet 33 - name: Check dotnet
114 run: dotnet --info 34 run: dotnet --info
115 35
116 - - name: build nuget packages 36 + - name: Build
117 shell: bash 37 shell: bash
118 run: | 38 run: |
119 cd scripts/dotnet 39 cd scripts/dotnet
120 ./run.sh 40 ./run.sh
121 - ls -lh packages  
122 41
123 - - uses: actions/upload-artifact@v3  
124 - name: upload nuget packages  
125 - with:  
126 - name: nuget-packages  
127 - path: scripts/dotnet/packages/*.nupkg 42 + ls -lh /tmp/packages
128 43
129 - name: publish .Net packages to nuget.org 44 - name: publish .Net packages to nuget.org
130 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 45 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
@@ -133,13 +48,5 @@ jobs: @@ -133,13 +48,5 @@ jobs:
133 API_KEY: ${{ secrets.NUGET_API_KEY }} 48 API_KEY: ${{ secrets.NUGET_API_KEY }}
134 run: | 49 run: |
135 # API_KEY is valid until 2024.05.02 50 # API_KEY is valid until 2024.05.02
136 - cd scripts/dotnet/packages 51 + cd /tmp/packages
137 dotnet nuget push ./org.k2fsa.sherpa.onnx.*.nupkg --skip-duplicate --api-key $API_KEY --source https://api.nuget.org/v3/index.json 52 dotnet nuget push ./org.k2fsa.sherpa.onnx.*.nupkg --skip-duplicate --api-key $API_KEY --source https://api.nuget.org/v3/index.json
138 -  
139 - - name: Release nuget packages  
140 - if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')  
141 - uses: svenstaro/upload-release-action@v2  
142 - with:  
143 - file_glob: true  
144 - overwrite: true  
145 - file: scripts/dotnet/packages/*.nupkg  
  1 +name: test-dot-net-nuget
  2 +
  3 +on:
  4 + workflow_dispatch:
  5 +
  6 + schedule:
  7 + # minute (0-59)
  8 + # hour (0-23)
  9 + # day of the month (1-31)
  10 + # month (1-12)
  11 + # day of the week (0-6)
  12 + # nightly build at 23:50 UTC time every day
  13 + - cron: "50 23 * * *"
  14 +
  15 +concurrency:
  16 + group: test-dot-net-nuget
  17 + cancel-in-progress: true
  18 +
  19 +permissions:
  20 + contents: read
  21 +
  22 +jobs:
  23 + test-dot-net-nuget:
  24 + runs-on: ${{ matrix.os }}
  25 + strategy:
  26 + fail-fast: false
  27 + matrix:
  28 + os: [ubuntu-latest, macos-latest, windows-latest]
  29 +
  30 + steps:
  31 + - uses: actions/checkout@v4
  32 + with:
  33 + fetch-depth: 0
  34 +
  35 + - name: Setup .NET 6.0
  36 + uses: actions/setup-dotnet@v1
  37 + with:
  38 + dotnet-version: 6.0.x
  39 +
  40 + - name: Check dotnet
  41 + run: dotnet --info
  42 +
  43 + - name: Decode a file
  44 + shell: bash
  45 + run: |
  46 + cd dotnet-examples/
  47 +
  48 + cd online-decode-files
  49 + ./run-transducer.sh
  50 + ./run-paraformer.sh
  51 +
  52 + cd ../offline-decode-files
  53 + ./run-nemo-ctc.sh
  54 + ./run-paraformer.sh
  55 + ./run-zipformer.sh
  56 + ./run-whisper.sh
  57 + ./run-tdnn-yesno.sh
@@ -4,28 +4,13 @@ on: @@ -4,28 +4,13 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - master 6 - master
7 - paths:  
8 - - '.github/workflows/test-dot-net'  
9 - - 'dotnet-examples/**'  
10 7
11 pull_request: 8 pull_request:
12 branches: 9 branches:
13 - master 10 - master
14 - paths:  
15 - - '.github/workflows/test-dot-net'  
16 - - 'dotnet-examples/**'  
17 11
18 workflow_dispatch: 12 workflow_dispatch:
19 13
20 - schedule:  
21 - # minute (0-59)  
22 - # hour (0-23)  
23 - # day of the month (1-31)  
24 - # month (1-12)  
25 - # day of the week (0-6)  
26 - # nightly build at 23:50 UTC time every day  
27 - - cron: "50 23 * * *"  
28 -  
29 concurrency: 14 concurrency:
30 group: test-dot-net 15 group: test-dot-net
31 cancel-in-progress: true 16 cancel-in-progress: true
@@ -34,31 +19,124 @@ permissions: @@ -34,31 +19,124 @@ permissions:
34 contents: read 19 contents: read
35 20
36 jobs: 21 jobs:
37 - test-dot-net: 22 + build-libs:
  23 + name: ${{ matrix.os }}
38 runs-on: ${{ matrix.os }} 24 runs-on: ${{ matrix.os }}
39 strategy: 25 strategy:
40 fail-fast: false 26 fail-fast: false
41 matrix: 27 matrix:
42 os: [ubuntu-latest, macos-latest, windows-latest] 28 os: [ubuntu-latest, macos-latest, windows-latest]
  29 + python-version: ["3.8"]
43 30
44 steps: 31 steps:
45 - uses: actions/checkout@v4 32 - uses: actions/checkout@v4
46 with: 33 with:
47 fetch-depth: 0 34 fetch-depth: 0
48 35
49 - - name: Setup .NET Core 3.1  
50 - uses: actions/setup-dotnet@v1 36 + - name: ccache
  37 + uses: hendrikmuhs/ccache-action@v1.2
  38 + with:
  39 + key: ${{ matrix.os }}-release-shared
  40 +
  41 + - name: Build sherpa-onnx
  42 + shell: bash
  43 + run: |
  44 + export CMAKE_CXX_COMPILER_LAUNCHER=ccache
  45 + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
  46 + cmake --version
  47 +
  48 + mkdir build
  49 + cd build
  50 + cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_BUILD_TYPE=Release ..
  51 + cmake --build . --target install --config Release
  52 +
  53 + - uses: actions/upload-artifact@v3
  54 + with:
  55 + name: ${{ matrix.os }}
  56 + path: ./build/install/lib/
  57 +
  58 + test-dot-net:
  59 + runs-on: ${{ matrix.os }}
  60 + needs: [build-libs]
  61 + strategy:
  62 + fail-fast: false
  63 + matrix:
  64 + os: [ubuntu-latest, macos-latest]
  65 + python-version: ["3.8"]
  66 +
  67 + steps:
  68 + - uses: actions/checkout@v4
51 with: 69 with:
52 - dotnet-version: 3.1.x 70 + fetch-depth: 0
53 71
54 - - name: Setup .NET 6.0  
55 - uses: actions/setup-dotnet@v1 72 + - name: Setup Python ${{ matrix.python-version }}
  73 + uses: actions/setup-python@v2
56 with: 74 with:
57 - dotnet-version: 6.0.x 75 + python-version: ${{ matrix.python-version }}
  76 +
  77 + - name: Install Python dependencies
  78 + shell: bash
  79 + run: |
  80 + python3 -m pip install --upgrade pip Jinja2
  81 +
  82 + - name: Retrieve artifact from ubuntu-latest
  83 + uses: actions/download-artifact@v2
  84 + with:
  85 + name: ubuntu-latest
  86 + path: /tmp/linux
  87 +
  88 + - name: Retrieve artifact from macos-latest
  89 + uses: actions/download-artifact@v2
  90 + with:
  91 + name: macos-latest
  92 + path: /tmp/macos
  93 +
  94 + - name: Retrieve artifact from windows-latest
  95 + uses: actions/download-artifact@v2
  96 + with:
  97 + name: windows-latest
  98 + path: /tmp/windows
  99 +
  100 + - name: Setup .NET
  101 + uses: actions/setup-dotnet@v3
  102 + with:
  103 + dotnet-version: |
  104 + 6.0.x
  105 + 7.0.x
58 106
59 - name: Check dotnet 107 - name: Check dotnet
60 run: dotnet --info 108 run: dotnet --info
61 109
  110 + - name: Display files
  111 + shell: bash
  112 + run: |
  113 + echo "----------/tmp/----------"
  114 + ls -lh /tmp/
  115 +
  116 + echo "----------/tmp/linux----------"
  117 + ls -lh /tmp/linux
  118 +
  119 + echo "----------/tmp/macos----------"
  120 + ls -lh /tmp/macos
  121 +
  122 + echo "----------/tmp/windows----------"
  123 + ls -lh /tmp/windows
  124 +
  125 + - name: Build
  126 + shell: bash
  127 + run: |
  128 + cd scripts/dotnet
  129 + ./run.sh
  130 +
  131 + - name: Copy files
  132 + shell: bash
  133 + run: |
  134 + cp -v scripts/dotnet/examples/offline-decode-files.csproj dotnet-examples/offline-decode-files/
  135 + cp -v scripts/dotnet/examples/online-decode-files.csproj dotnet-examples/online-decode-files/
  136 + cp -v scripts/dotnet/examples/speech-recognition-from-microphone.csproj dotnet-examples/speech-recognition-from-microphone/
  137 +
  138 + ls -lh /tmp
  139 +
62 - name: Decode a file 140 - name: Decode a file
63 shell: bash 141 shell: bash
64 run: | 142 run: |
  1 +# Introduction
  2 +
  3 +Files in this directory are used exclusively by CI.
  1 +<Project Sdk="Microsoft.NET.Sdk">
  2 +
  3 + <PropertyGroup>
  4 + <OutputType>Exe</OutputType>
  5 + <TargetFramework>net6.0</TargetFramework>
  6 + <RootNamespace>offline_decode_files</RootNamespace>
  7 + <ImplicitUsings>enable</ImplicitUsings>
  8 + <Nullable>enable</Nullable>
  9 + </PropertyGroup>
  10 +
  11 + <PropertyGroup>
  12 + <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
  13 + </PropertyGroup>
  14 +
  15 + <ItemGroup>
  16 + <PackageReference Include="CommandLineParser" Version="2.9.1" />
  17 + <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" />
  18 + </ItemGroup>
  19 +
  20 +</Project>
  1 +<Project Sdk="Microsoft.NET.Sdk">
  2 +
  3 + <PropertyGroup>
  4 + <OutputType>Exe</OutputType>
  5 + <TargetFramework>net6.0</TargetFramework>
  6 + <RootNamespace>online_decode_files</RootNamespace>
  7 + <ImplicitUsings>enable</ImplicitUsings>
  8 + <Nullable>enable</Nullable>
  9 + </PropertyGroup>
  10 +
  11 +
  12 + <PropertyGroup>
  13 + <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
  14 + </PropertyGroup>
  15 +
  16 + <ItemGroup>
  17 + <PackageReference Include="CommandLineParser" Version="2.9.1" />
  18 + <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" />
  19 + </ItemGroup>
  20 +
  21 +</Project>
  1 +<Project Sdk="Microsoft.NET.Sdk">
  2 +
  3 + <PropertyGroup>
  4 + <OutputType>Exe</OutputType>
  5 + <TargetFramework>net6.0</TargetFramework>
  6 + <RootNamespace>speech_recognition_from_microphone</RootNamespace>
  7 + <ImplicitUsings>enable</ImplicitUsings>
  8 + <Nullable>enable</Nullable>
  9 + </PropertyGroup>
  10 +
  11 + <PropertyGroup>
  12 + <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
  13 + </PropertyGroup>
  14 +
  15 + <ItemGroup>
  16 + <PackageReference Include="CommandLineParser" Version="2.9.1" />
  17 + <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" />
  18 + <PackageReference Include="PortAudioSharp2" Version="*" />
  19 + </ItemGroup>
  20 +
  21 +</Project>
@@ -33,12 +33,18 @@ def get_dict(): @@ -33,12 +33,18 @@ def get_dict():
33 33
34 def process_linux(s): 34 def process_linux(s):
35 libs = [ 35 libs = [
  36 + "libespeak-ng.so",
  37 + "libkaldi-decoder-core.so",
36 "libkaldi-native-fbank-core.so", 38 "libkaldi-native-fbank-core.so",
37 - "libonnxruntime.so.1.16.2", 39 + "libonnxruntime.so.1.16.3",
  40 + "libpiper_phonemize.so.1",
38 "libsherpa-onnx-c-api.so", 41 "libsherpa-onnx-c-api.so",
39 "libsherpa-onnx-core.so", 42 "libsherpa-onnx-core.so",
  43 + "libsherpa-onnx-fst.so.6",
  44 + "libsherpa-onnx-kaldifst-core.so",
  45 + "libucd.so",
40 ] 46 ]
41 - prefix = f"{SHERPA_ONNX_DIR}/linux/sherpa_onnx/lib/" 47 + prefix = "/tmp/linux/"
42 libs = [prefix + lib for lib in libs] 48 libs = [prefix + lib for lib in libs]
43 libs = "\n ;".join(libs) 49 libs = "\n ;".join(libs)
44 50
@@ -55,12 +61,18 @@ def process_linux(s): @@ -55,12 +61,18 @@ def process_linux(s):
55 61
56 def process_macos(s): 62 def process_macos(s):
57 libs = [ 63 libs = [
  64 + "libespeak-ng.dylib",
  65 + "libkaldi-decoder-core.dylib",
58 "libkaldi-native-fbank-core.dylib", 66 "libkaldi-native-fbank-core.dylib",
59 - "libonnxruntime.1.16.2.dylib", 67 + "libonnxruntime.1.16.3.dylib",
  68 + "libpiper_phonemize.1.dylib",
60 "libsherpa-onnx-c-api.dylib", 69 "libsherpa-onnx-c-api.dylib",
61 "libsherpa-onnx-core.dylib", 70 "libsherpa-onnx-core.dylib",
  71 + "libsherpa-onnx-fst.6.dylib",
  72 + "libsherpa-onnx-kaldifst-core.dylib",
  73 + "libucd.dylib",
62 ] 74 ]
63 - prefix = f"{SHERPA_ONNX_DIR}/macos/sherpa_onnx/lib/" 75 + prefix = f"/tmp/macos/"
64 libs = [prefix + lib for lib in libs] 76 libs = [prefix + lib for lib in libs]
65 libs = "\n ;".join(libs) 77 libs = "\n ;".join(libs)
66 78
@@ -77,30 +89,23 @@ def process_macos(s): @@ -77,30 +89,23 @@ def process_macos(s):
77 89
78 def process_windows(s): 90 def process_windows(s):
79 libs = [ 91 libs = [
  92 + "espeak-ng.dll",
  93 + "kaldi-decoder-core.dll",
80 "kaldi-native-fbank-core.dll", 94 "kaldi-native-fbank-core.dll",
81 "onnxruntime.dll", 95 "onnxruntime.dll",
  96 + "piper_phonemize.dll",
82 "sherpa-onnx-c-api.dll", 97 "sherpa-onnx-c-api.dll",
83 "sherpa-onnx-core.dll", 98 "sherpa-onnx-core.dll",
  99 + "sherpa-onnx-fst.lib",
  100 + "sherpa-onnx-kaldifst-core.lib",
  101 + "ucd.dll",
84 ] 102 ]
85 103
86 version = get_version() 104 version = get_version()
87 105
88 - prefix1 = f"{SHERPA_ONNX_DIR}/windows/sherpa_onnx/lib/"  
89 - prefix2 = f"{SHERPA_ONNX_DIR}/windows/sherpa_onnx/"  
90 - prefix3 = f"{SHERPA_ONNX_DIR}/windows/"  
91 - prefix4 = f"{SHERPA_ONNX_DIR}/windows/sherpa_onnx-{version}.data/data/bin/"  
92 - print(prefix1, prefix2, prefix3, prefix4)  
93 -  
94 - lib_list = []  
95 - for lib in libs:  
96 - for prefix in [prefix1, prefix2, prefix3, prefix4]:  
97 - f = Path(prefix) / lib  
98 - if f.is_file():  
99 - lib_list.append(str(f))  
100 - break  
101 -  
102 - print("lib_list", lib_list)  
103 - libs = "\n ;".join(lib_list) 106 + prefix = "/tmp/windows/"
  107 + libs = [prefix + lib for lib in libs]
  108 + libs = "\n ;".join(libs)
104 109
105 d = get_dict() 110 d = get_dict()
106 d["dotnet_rid"] = "win-x64" 111 d["dotnet_rid"] = "win-x64"
@@ -138,6 +138,8 @@ namespace SherpaOnnx @@ -138,6 +138,8 @@ namespace SherpaOnnx
138 138
139 DecodingMethod = "greedy_search"; 139 DecodingMethod = "greedy_search";
140 MaxActivePaths = 4; 140 MaxActivePaths = 4;
  141 + HotwordsFile = "";
  142 + HotwordsScore = 1.5F;
141 143
142 } 144 }
143 public FeatureConfig FeatConfig; 145 public FeatureConfig FeatConfig;
@@ -148,6 +150,11 @@ namespace SherpaOnnx @@ -148,6 +150,11 @@ namespace SherpaOnnx
148 public string DecodingMethod; 150 public string DecodingMethod;
149 151
150 public int MaxActivePaths; 152 public int MaxActivePaths;
  153 +
  154 + [MarshalAs(UnmanagedType.LPStr)]
  155 + public string HotwordsFile;
  156 +
  157 + public float HotwordsScore;
151 } 158 }
152 159
153 public class OfflineRecognizerResult 160 public class OfflineRecognizerResult
@@ -3,6 +3,75 @@ @@ -3,6 +3,75 @@
3 3
4 set -ex 4 set -ex
5 5
  6 +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
  7 +SHERPA_ONNX_DIR=$(cd $SCRIPT_DIR/../.. && pwd)
  8 +echo "SCRIPT_DIR: $SCRIPT_DIR"
  9 +echo "SHERPA_ONNX_DIR: $SHERPA_ONNX_DIR"
  10 +
  11 +SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" $SHERPA_ONNX_DIR/CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
  12 +
  13 +mkdir -p /tmp/
  14 +pushd /tmp
  15 +
  16 +mkdir -p linux macos windows
  17 +
  18 +if [ ! -f /tmp/linux/libsherpa-onnx-core.so ]; then
  19 + echo "---linux x86_64---"
  20 + cd linux
  21 + mkdir wheel
  22 + cd wheel
  23 + curl -OL https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  24 + unzip sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  25 + cp -v sherpa_onnx/lib/*.so* ../
  26 + cd ..
  27 + rm -v libpiper_phonemize.so libpiper_phonemize.so.1.2.0
  28 + rm -v libsherpa-onnx-fst.so
  29 + rm -v libonnxruntime.so
  30 + rm -v libcargs.so
  31 + rm -rf wheel
  32 + ls -lh
  33 + cd ..
  34 +fi
  35 +
  36 +if [ ! -f /tmp/macos/libsherpa-onnx-core.dylib ]; then
  37 + echo "---macOS x86_64---"
  38 + cd macos
  39 + mkdir wheel
  40 + cd wheel
  41 + curl -OL https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_10_14_x86_64.whl
  42 + unzip sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_10_14_x86_64.whl
  43 + cp -v sherpa_onnx/lib/*.dylib ../
  44 +
  45 + cd ..
  46 +
  47 + rm -v libcargs.dylib
  48 + rm -v libonnxruntime.dylib
  49 + rm -v libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib
  50 + rm -v libsherpa-onnx-fst.dylib
  51 + rm -rf wheel
  52 + ls -lh
  53 + cd ..
  54 +fi
  55 +
  56 +
  57 +if [ ! -f /tmp/windows/libsherpa-onnx-core.dll ]; then
  58 + echo "---windows x64---"
  59 + cd windows
  60 + mkdir wheel
  61 + cd wheel
  62 + curl -OL https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win_amd64.whl
  63 + unzip sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win_amd64.whl
  64 + cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.dll ../
  65 + cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.lib ../
  66 + cd ..
  67 +
  68 + rm -rf wheel
  69 + ls -lh
  70 + cd ..
  71 +fi
  72 +
  73 +popd
  74 +
6 mkdir -p macos linux windows all 75 mkdir -p macos linux windows all
7 76
8 cp ./online.cs all 77 cp ./online.cs all
@@ -31,3 +100,6 @@ dotnet pack -c Release -o ../packages @@ -31,3 +100,6 @@ dotnet pack -c Release -o ../packages
31 popd 100 popd
32 101
33 ls -lh packages 102 ls -lh packages
  103 +
  104 +mkdir /tmp/packages
  105 +cp -v packages/*.nupkg /tmp/packages