diff --git a/scripts/dotnet/generate.py b/scripts/dotnet/generate.py
index 71b854f9..951e7892 100755
--- a/scripts/dotnet/generate.py
+++ b/scripts/dotnet/generate.py
@@ -34,23 +34,23 @@ def get_dict():
}
-def process_linux(s):
+def process_linux(s, rid):
libs = [
"libonnxruntime.so.1.17.1",
"libsherpa-onnx-c-api.so",
]
- prefix = f"{src_dir}/linux/"
+ prefix = f"{src_dir}/linux-{rid}/"
libs = [prefix + lib for lib in libs]
libs = "\n ;".join(libs)
d = get_dict()
- d["dotnet_rid"] = "linux-x64"
+ d["dotnet_rid"] = f"linux-{rid}"
d["libs"] = libs
environment = jinja2.Environment()
template = environment.from_string(s)
s = template.render(**d)
- with open("./linux/sherpa-onnx.runtime.csproj", "w") as f:
+ with open(f"./linux-{rid}/sherpa-onnx.runtime.csproj", "w") as f:
f.write(s)
@@ -101,7 +101,8 @@ def main():
s = read_proj_file("./sherpa-onnx.csproj.runtime.in")
process_macos(s, "x64")
process_macos(s, "arm64")
- process_linux(s)
+ process_linux(s, "x64")
+ process_linux(s, "arm64")
process_windows(s, "x64")
process_windows(s, "x86")
process_windows(s, "arm64")
diff --git a/scripts/dotnet/run.sh b/scripts/dotnet/run.sh
index 9f2890b4..5b000012 100755
--- a/scripts/dotnet/run.sh
+++ b/scripts/dotnet/run.sh
@@ -24,10 +24,13 @@ export src_dir
mkdir -p $src_dir
pushd $src_dir
-mkdir -p linux macos-x64 macos-arm64 windows-x64 windows-x86 windows-arm64
+mkdir -p linux-x64 linux-arm64 macos-x64 macos-arm64 windows-x64 windows-x86 windows-arm64
-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
+linux_x64_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
+linux_x64_wheel=$src_dir/$linux_x64_wheel_filename
+
+linux_arm64_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
+linux_arm64_wheel=$src_dir/$linux_arm64_wheel_filename
macos_x64_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp39-cp39-macosx_11_0_x86_64.whl
macos_x64_wheel=$src_dir/$macos_x64_wheel_filename
@@ -44,17 +47,35 @@ windows_x86_wheel=$src_dir/$windows_x86_wheel_filename
windows_arm64_wheel_filename=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-arm64.tar.bz2
windows_arm64_wheel=$src_dir/$windows_arm64_wheel_filename
-if [ ! -f $src_dir/linux/libsherpa-onnx-c-api.so ]; then
+if [ ! -f $src_dir/linux-x64/libsherpa-onnx-c-api.so ]; then
echo "---linux x86_64---"
- cd linux
+ cd linux-x64
mkdir -p wheel
cd wheel
- if [ -f $linux_wheel ]; then
- cp -v $linux_wheel .
+ if [ -f $linux_x64_wheel ]; then
+ cp -v $linux_x64_wheel .
else
- curl -OL https://$HF_MIRROR/csukuangfj/sherpa-onnx-wheels/resolve/main/$linux_wheel_filename
+ curl -OL https://$HF_MIRROR/csukuangfj/sherpa-onnx-wheels/resolve/main/$linux_x64_wheel_filename
fi
- unzip $linux_wheel_filename
+ unzip $linux_x64_wheel_filename
+ cp -v sherpa_onnx/lib/*.so* ../
+ cd ..
+ rm -rf wheel
+ ls -lh
+ cd ..
+fi
+
+if [ ! -f $src_dir/linux-arm64/libsherpa-onnx-c-api.so ]; then
+ echo "---linux arm64---"
+ cd linux-arm64
+ mkdir -p wheel
+ cd wheel
+ if [ -f $linux_arm64_wheel ]; then
+ cp -v $linux_arm64_wheel .
+ else
+ curl -OL https://$HF_MIRROR/csukuangfj/sherpa-onnx-wheels/resolve/main/$linux_arm64_wheel_filename
+ fi
+ unzip $linux_arm64_wheel_filename
cp -v sherpa_onnx/lib/*.so* ../
cd ..
rm -rf wheel
@@ -161,13 +182,18 @@ fi
popd
-mkdir -p macos-x64 macos-arm64 linux windows-x64 windows-x86 windows-arm64 all
+mkdir -p macos-x64 macos-arm64 linux-x64 linux-arm64 windows-x64 windows-x86 windows-arm64 all
cp ./*.cs all
./generate.py
-pushd linux
+pushd linux-x64
+dotnet build -c Release
+dotnet pack -c Release -o ../packages
+popd
+
+pushd linux-arm64
dotnet build -c Release
dotnet pack -c Release -o ../packages
popd
diff --git a/scripts/dotnet/sherpa-onnx.csproj.in b/scripts/dotnet/sherpa-onnx.csproj.in
index b155c60f..0cbe7efa 100644
--- a/scripts/dotnet/sherpa-onnx.csproj.in
+++ b/scripts/dotnet/sherpa-onnx.csproj.in
@@ -5,7 +5,7 @@
Library
10.0
net6.0;net45;net40;net35;net20;netstandard2.0
- linux-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64
+ linux-x64;linux-arm64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64
true
sherpa-onnx
{{ version }}
@@ -49,6 +49,7 @@
+