Skip to content

Commit 0363b4a

Browse files
authored
Merge pull request #1823 from shimat/restore_linux_package
restore linux RID package
2 parents 4101911 + 88e6ba3 commit 0363b4a

11 files changed

+100
-19
lines changed

.github/workflows/ubuntu-slim.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,18 @@ jobs:
183183
package_project="OpenCvSharp4.official.runtime.ubuntu.${{ matrix.ubuntu }}-x64.slim.csproj"
184184
dotnet pack "nuget/${package_project}" -o ${GITHUB_WORKSPACE}/artifacts -p:Version=$version
185185
186+
- name: Create linux-x64 NuGet package (slim)
187+
if: matrix.ubuntu == '22.04'
188+
env:
189+
BETA: "-beta"
190+
run: |
191+
yyyymmdd=`date '+%Y%m%d'`
192+
version="${OPENCV_VERSION}.${yyyymmdd}${BETA}"
193+
echo "Package version: $version"
194+
195+
cd ${GITHUB_WORKSPACE}/opencvsharp
196+
dotnet pack "nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj" -o ${GITHUB_WORKSPACE}/artifacts -p:Version=$version
197+
186198
- uses: actions/upload-artifact@v6
187199
with:
188200
name: artifacts_ubuntu_slim_${{ matrix.ubuntu }}

.github/workflows/ubuntu.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,20 @@ jobs:
184184
185185
ls ${GITHUB_WORKSPACE}/artifacts
186186
187+
- name: Create linux-x64 NuGet package
188+
if: matrix.ubuntu == '22.04'
189+
env:
190+
BETA: "-beta"
191+
run: |
192+
yyyymmdd=`date '+%Y%m%d'`
193+
version="${OPENCV_VERSION}.${yyyymmdd}${BETA}"
194+
echo "Package version: $version"
195+
196+
cd ${GITHUB_WORKSPACE}/opencvsharp
197+
dotnet pack "nuget/OpenCvSharp4.official.runtime.linux-x64.csproj" -o ${GITHUB_WORKSPACE}/artifacts -p:Version=$version
198+
199+
ls ${GITHUB_WORKSPACE}/artifacts
200+
187201
- uses: actions/upload-artifact@v6
188202
with:
189203
name: artifacts_ubuntu_${{ matrix.ubuntu }}

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ dotnet add package OpenCvSharp4.Windows
1414
### Linux / Ubuntu
1515
```bash
1616
dotnet add package OpenCvSharp4
17-
dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64
17+
dotnet add package OpenCvSharp4.official.runtime.linux-x64
1818
# optional slim profile (smaller native dependency surface)
19-
# dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim
19+
# dotnet add package OpenCvSharp4.official.runtime.linux-x64.slim
2020
```
2121

2222
For more installation options, see the [Installation](#installation) section below.
@@ -54,21 +54,20 @@ For a smaller feature profile, pair `OpenCvSharp4` with `OpenCvSharp4.runtime.wi
5454
### UWP
5555
Add `OpenCvSharp4` and `OpenCvSharp4.runtime.uwp` NuGet packages to your project. Note that `OpenCvSharp4.runtime.win` and `OpenCvSharp4.Windows` don't work for UWP.
5656

57-
### Ubuntu 24.04
58-
Add `OpenCvSharp4` and `OpenCvSharp4.official.runtime.ubuntu.24.04-x64` NuGet packages to your project.
57+
### Linux (Ubuntu and other distributions)
58+
Add `OpenCvSharp4` and `OpenCvSharp4.official.runtime.linux-x64` NuGet packages to your project. This package uses the portable `linux-x64` RID and works with .NET 8+ publish/deploy workflows out of the box.
5959
```bash
6060
dotnet new console -n ConsoleApp01
6161
cd ConsoleApp01
6262
dotnet add package OpenCvSharp4
63-
dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64
63+
dotnet add package OpenCvSharp4.official.runtime.linux-x64
6464
# or slim profile:
65-
# dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim
65+
# dotnet add package OpenCvSharp4.official.runtime.linux-x64.slim
6666
# -- edit Program.cs --- #
6767
dotnet run
6868
```
6969

70-
### Other Linux distributions
71-
Add `OpenCvSharp4` and the appropriate Ubuntu runtime package (for example `OpenCvSharp4.official.runtime.ubuntu.24.04-x64`) to your project. The Ubuntu runtime packages are built on the specified Ubuntu releases and may work on similar distributions.
70+
Distro-specific packages (`OpenCvSharp4.official.runtime.ubuntu.24.04-x64`, `OpenCvSharp4.official.runtime.ubuntu.22.04-x64`) are also available but use distro-specific RIDs that are [no longer resolved automatically by .NET 8+](https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/rid-graph). The `linux-x64` package is recommended for most users.
7271

7372

7473
### Slim profile module coverage
@@ -82,6 +81,7 @@ This profile is used by:
8281

8382
- `OpenCvSharp4.runtime.win.slim`
8483
- `OpenCvSharp4.Windows.Slim`
84+
- `OpenCvSharp4.official.runtime.linux-x64.slim`
8585
- `OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim`
8686
- `OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim`
8787

@@ -167,6 +167,8 @@ http://shimat.github.io/opencvsharp/api/OpenCvSharp.html
167167
|**[OpenCvSharp4.runtime.win](https://www.nuget.org/packages/OpenCvSharp4.runtime.win/)**| Native bindings for Windows x64/x86 (except UWP) |
168168
|**[OpenCvSharp4.runtime.win.slim](https://www.nuget.org/packages/OpenCvSharp4.runtime.win.slim/)**| Slim native bindings for Windows x64/x86 (except UWP), with `core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo` enabled |
169169
|**[OpenCvSharp4.runtime.uwp](https://www.nuget.org/packages/OpenCvSharp4.runtime.uwp/)**| Native bindings for UWP (Universal Windows Platform) x64/x86/ARM |
170+
|**[OpenCvSharp4.official.runtime.linux-x64](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.linux-x64/)**| Native bindings for Linux x64 (portable RID, recommended) |
171+
|**[OpenCvSharp4.official.runtime.linux-x64.slim](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.linux-x64.slim/)**| Slim native bindings for Linux x64 (portable RID), with `core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo` enabled |
170172
|**[OpenCvSharp4.official.runtime.ubuntu.22.04-x64](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.ubuntu.22.04-x64/)**| Native bindings for Ubuntu 22.04 x64 |
171173
|**[OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim/)**| Slim native bindings for Ubuntu 22.04 x64, with `core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo` enabled |
172174
|**[OpenCvSharp4.official.runtime.ubuntu.24.04-x64](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.ubuntu.24.04-x64/)**| Native bindings for Ubuntu 24.04 x64 |
@@ -238,7 +240,7 @@ dotnet run
238240
```
239241
## Customizing OpenCV and OpenCvSharp for embedded (ARM) Platforms
240242

241-
If you want to use OpenCV and OpenCvSharp on an embedded platform like a Raspberry Pi with a 64-bit OS, you have to build both libraries manually, and it's easiest to build it right on your target hardware to avoid cross-compiler toolchain challenges. [The instructions for this build and install are here](embedded-builds.md).
243+
If you want to use OpenCV and OpenCvSharp on an embedded platform like a Raspberry Pi with a 64-bit OS, you have to build both libraries manually, and it's easiest to build it right on your target hardware to avoid cross-compiler toolchain challenges. [The instructions for this build and install are here](docs/embedded-builds.md).
242244

243245
## Donations
244246
If you find the OpenCvSharp library useful and would like to show your gratitude by donating, here are some donation options. Thank you.
File renamed without changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
4+
<NoBuild>true</NoBuild>
5+
<IncludeBuildOutput>false</IncludeBuildOutput>
6+
7+
<!-- NuGet Package Metadata -->
8+
<PackageId>OpenCvSharp4.official.runtime.linux-x64</PackageId>
9+
<Title>OpenCvSharp native bindings for Linux x64</Title>
10+
<Authors>shimat</Authors>
11+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
12+
<PackageProjectUrl>https://github.com/shimat/opencvsharp</PackageProjectUrl>
13+
<PackageIcon>opencvsharp.png</PackageIcon>
14+
<Description>Internal implementation package for OpenCvSharp to work on Linux x64 (portable RID)</Description>
15+
<PackageTags>Image Processing OpenCV Wrapper FFI opencvsharp linux</PackageTags>
16+
<Copyright>Copyright 2008-2026</Copyright>
17+
<PackageReleaseNotes></PackageReleaseNotes>
18+
<RepositoryUrl>https://github.com/shimat/opencvsharp.git</RepositoryUrl>
19+
<RepositoryType>git</RepositoryType>
20+
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
21+
</PropertyGroup>
22+
23+
<ItemGroup>
24+
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/linux-x64/native/" />
25+
<None Include="icon/opencvsharp.png" Pack="true" PackagePath="" />
26+
</ItemGroup>
27+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
4+
<NoBuild>true</NoBuild>
5+
<IncludeBuildOutput>false</IncludeBuildOutput>
6+
7+
<PackageId>OpenCvSharp4.official.runtime.linux-x64.slim</PackageId>
8+
<Title>OpenCvSharp native bindings for Linux x64 (Slim)</Title>
9+
<Authors>shimat</Authors>
10+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
11+
<PackageProjectUrl>https://github.com/shimat/opencvsharp</PackageProjectUrl>
12+
<PackageIcon>opencvsharp.png</PackageIcon>
13+
<Description>Slim native bindings package for OpenCvSharp on Linux x64 (portable RID). Enabled modules: core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo. Disabled modules: contrib,dnn,ml,video,videoio,highgui,stitching,barcode.</Description>
14+
<PackageTags>Image Processing OpenCV Wrapper FFI opencvsharp linux slim</PackageTags>
15+
<Copyright>Copyright 2008-2026</Copyright>
16+
<PackageReleaseNotes></PackageReleaseNotes>
17+
<RepositoryUrl>https://github.com/shimat/opencvsharp.git</RepositoryUrl>
18+
<RepositoryType>git</RepositoryType>
19+
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
20+
</PropertyGroup>
21+
22+
<ItemGroup>
23+
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/linux-x64/native/" />
24+
<None Include="icon/opencvsharp.png" Pack="true" PackagePath="" />
25+
</ItemGroup>
26+
</Project>

nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
44
<NoBuild>true</NoBuild>
55
<IncludeBuildOutput>false</IncludeBuildOutput>
66

@@ -21,7 +21,7 @@
2121
</PropertyGroup>
2222

2323
<ItemGroup>
24-
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.22.04-x64/native" />
24+
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.22.04-x64/native/" />
2525
<None Include="icon\opencvsharp.png" Pack="true" PackagePath="" />
2626
</ItemGroup>
2727
</Project>

nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
44
<NoBuild>true</NoBuild>
55
<IncludeBuildOutput>false</IncludeBuildOutput>
66

@@ -20,7 +20,7 @@
2020
</PropertyGroup>
2121

2222
<ItemGroup>
23-
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.22.04-x64/native" />
23+
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.22.04-x64/native/" />
2424
<None Include="icon\opencvsharp.png" Pack="true" PackagePath="" />
2525
</ItemGroup>
2626
</Project>

nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
44
<NoBuild>true</NoBuild>
55
<IncludeBuildOutput>false</IncludeBuildOutput>
66

@@ -21,7 +21,7 @@
2121
</PropertyGroup>
2222

2323
<ItemGroup>
24-
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.24.04-x64/native" />
24+
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.24.04-x64/native/" />
2525
<None Include="icon\opencvsharp.png" Pack="true" PackagePath="" />
2626
</ItemGroup>
2727
</Project>

nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
44
<NoBuild>true</NoBuild>
55
<IncludeBuildOutput>false</IncludeBuildOutput>
66

@@ -20,7 +20,7 @@
2020
</PropertyGroup>
2121

2222
<ItemGroup>
23-
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.24.04-x64/native" />
23+
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.24.04-x64/native/" />
2424
<None Include="icon\opencvsharp.png" Pack="true" PackagePath="" />
2525
</ItemGroup>
2626
</Project>

0 commit comments

Comments
 (0)