run.sh
3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/env bash
# Copyright (c) 2023 Xiaomi Corporation
set -ex
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SHERPA_ONNX_DIR=$(cd $SCRIPT_DIR/../.. && pwd)
echo "SCRIPT_DIR: $SCRIPT_DIR"
echo "SHERPA_ONNX_DIR: $SHERPA_ONNX_DIR"
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" $SHERPA_ONNX_DIR/CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
# You can pre-download the required wheels to $src_dir
if [ $(hostname) == fangjuns-MacBook-Pro.local ]; then
HF_MIRROR=hf-mirror.com
src_dir=/Users/fangjun/open-source/sherpa-onnx/scripts/dotnet/tmp
else
src_dir=/tmp
HF_MIRROR=hf.co
fi
export src_dir
mkdir -p $src_dir
pushd $src_dir
mkdir -p linux macos windows-x64 windows-x86
linux_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
linux_wheel=$src_dir/$linux_wheel_filename
macos_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_11_0_universal2.whl
macos_wheel=$src_dir/$macos_wheel_filename
windows_x64_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win_amd64.whl
windows_x64_wheel=$src_dir/$windows_x64_wheel_filename
windows_x86_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win32.whl
windows_x86_wheel=$src_dir/$windows_x86_wheel_filename
if [ ! -f $src_dir/linux/libsherpa-onnx-core.so ]; then
echo "---linux x86_64---"
cd linux
mkdir -p wheel
cd wheel
if [ -f $linux_wheel ]; then
cp -v $linux_wheel .
else
curl -OL https://$HF_MIRROR/csukuangfj/sherpa-onnx-wheels/resolve/main/$linux_wheel_filename
fi
unzip $linux_wheel_filename
cp -v sherpa_onnx/lib/*.so* ../
cd ..
rm -v libpiper_phonemize.so libpiper_phonemize.so.1.2.0
rm -v libonnxruntime.so
rm -v libcargs.so
rm -rf wheel
ls -lh
cd ..
fi
if [ ! -f $src_dir/macos/libsherpa-onnx-core.dylib ]; then
echo "--- macOS x86_64/arm64 universal2---"
cd macos
mkdir -p wheel
cd wheel
if [ -f $macos_wheel ]; then
cp -v $macos_wheel .
else
curl -OL https://$HF_MIRROR/csukuangfj/sherpa-onnx-wheels/resolve/main/$macos_wheel_filename
fi
unzip $macos_wheel_filename
cp -v sherpa_onnx/lib/*.dylib ../
cd ..
rm -v libcargs.dylib
rm -v libonnxruntime.dylib
rm -v libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib
rm -rf wheel
ls -lh
cd ..
fi
if [ ! -f $src_dir/windows-x64/sherpa-onnx-core.dll ]; then
echo "---windows x64---"
cd windows-x64
mkdir -p wheel
cd wheel
if [ -f $windows_x64_wheel ]; then
cp -v $windows_x64_wheel .
else
curl -OL https://$HF_MIRROR/csukuangfj/sherpa-onnx-wheels/resolve/main/$windows_x64_wheel_filename
fi
unzip $windows_x64_wheel_filename
cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.dll ../
cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.lib ../
cd ..
rm -rf wheel
ls -lh
cd ..
fi
if [ ! -f $src_dir/windows-x86/sherpa-onnx-core.dll ]; then
echo "---windows x86---"
cd windows-x86
mkdir -p wheel
cd wheel
if [ -f $windows_x86_wheel ]; then
cp -v $windows_x86_wheel .
else
curl -OL https://$HF_MIRROR/csukuangfj/sherpa-onnx-wheels/resolve/main/$windows_x86_wheel_filename
fi
unzip $windows_x86_wheel_filename
cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.dll ../
cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.lib ../
cd ..
rm -rf wheel
ls -lh
cd ..
fi
popd
mkdir -p macos linux windows-x64 windows-x86 all
cp ./*.cs all
./generate.py
pushd linux
dotnet build -c Release
dotnet pack -c Release -o ../packages
popd
pushd macos
dotnet build -c Release
dotnet pack -c Release -o ../packages
popd
pushd windows-x64
dotnet build -c Release
dotnet pack -c Release -o ../packages
popd
pushd windows-x86
dotnet build -c Release
dotnet pack -c Release -o ../packages
popd
pushd all
dotnet build -c Release
dotnet pack -c Release -o ../packages
popd
ls -lh packages
mkdir -p /tmp/packages
cp -v packages/*.nupkg /tmp/packages