Rename package to StaticLink.Avalonia
This commit is contained in:
1 parent
f685b52496
commit
aa0118a4e3
12 files changed
+266
-412
No files matched your search
@@ -1,10 +1,10 @@
|
||||
# Shiroka.Avalonia.StaticLink
|
||||
# StaticLink.Avalonia
|
||||
|
||||
Static graphics libraries for Avalonia NativeAOT single-file publishing.
|
||||
Static native libraries for Avalonia NativeAOT publishing.
|
||||
|
||||
This package provides static archives for SkiaSharp, HarfBuzzSharp, and ANGLE, then wires them into MSBuild through `buildTransitive` targets. It is intended for Avalonia applications that want NativeAOT single-file publish outputs without shipping Avalonia graphics native libraries next to the executable.
|
||||
This package links Avalonia's graphics/native dependencies from static archives so NativeAOT publish output does not need the usual SkiaSharp, HarfBuzzSharp, ANGLE, or AvaloniaNative runtime files next to the executable.
|
||||
|
||||
Repository: <https://github.com/greepar/Avalonia.StaticGraphics>
|
||||
Repository: <https://github.com/greepar/StaticLink.Avalonia>
|
||||
|
||||
## Supported RIDs
|
||||
|
||||
@@ -15,34 +15,14 @@ Repository: <https://github.com/greepar/Avalonia.StaticGraphics>
|
||||
- `osx-x64`
|
||||
- `osx-arm64`
|
||||
|
||||
## Included Libraries
|
||||
|
||||
Windows:
|
||||
|
||||
- `skia.lib`
|
||||
- `SkiaSharp.lib`
|
||||
- `libHarfBuzzSharp.lib`
|
||||
- `libANGLE_static.lib`
|
||||
- `libGLESv2_static.lib`
|
||||
|
||||
Linux and macOS:
|
||||
|
||||
- `libskia.a`
|
||||
- `libSkiaSharp.a`
|
||||
- `libHarfBuzzSharp.a`
|
||||
- `libANGLE_static.a`
|
||||
- `libGLESv2_static.a`
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
dotnet add package Shiroka.Avalonia.StaticLink
|
||||
dotnet add package StaticLink.Avalonia
|
||||
```
|
||||
|
||||
## Publish
|
||||
|
||||
Windows x64 or arm64:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release -r win-x64 \
|
||||
-p:PublishAot=true \
|
||||
@@ -51,7 +31,9 @@ dotnet publish -c Release -r win-x64 \
|
||||
-p:StripSymbols=true
|
||||
```
|
||||
|
||||
Linux x64 or arm64:
|
||||
Use the RID you need, for example `linux-x64`, `linux-arm64`, `osx-arm64`, or `osx-x64`.
|
||||
|
||||
For Linux, `lld` is recommended:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release -r linux-x64 \
|
||||
@@ -62,102 +44,18 @@ dotnet publish -c Release -r linux-x64 \
|
||||
-p:LinkerFlavor=lld
|
||||
```
|
||||
|
||||
macOS x64 or arm64:
|
||||
For macOS, avoid the Metal renderer for fully static output. Use OpenGL or Software:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release -r osx-arm64 \
|
||||
-p:PublishAot=true \
|
||||
-p:SelfContained=true \
|
||||
-p:PublishSingleFile=true \
|
||||
-p:StripSymbols=true
|
||||
```csharp
|
||||
.With(new AvaloniaNativePlatformOptions
|
||||
{
|
||||
RenderingMode = [AvaloniaNativeRenderingMode.OpenGl, AvaloniaNativeRenderingMode.Software]
|
||||
})
|
||||
```
|
||||
|
||||
The package automatically contributes the static archives as `NativeLibrary` items when `PublishAot=true` and the `RuntimeIdentifier` is supported.
|
||||
## Notes
|
||||
|
||||
## Verify Output
|
||||
|
||||
After publishing, the publish directory should not contain Avalonia graphics runtime files such as:
|
||||
|
||||
- `libSkiaSharp.so`
|
||||
- `libHarfBuzzSharp.so`
|
||||
- `libSkiaSharp.dylib`
|
||||
- `libHarfBuzzSharp.dylib`
|
||||
- `libSkiaSharp.dll`
|
||||
- `libHarfBuzzSharp.dll`
|
||||
- `av_libglesv2.dll`
|
||||
|
||||
The package stores static archives under `static/<rid>/native/` inside the NuGet package, so `.a` and `.lib` files are used for linking and are not normal runtime assets.
|
||||
|
||||
## Build From Source
|
||||
|
||||
This repository does not depend on 2ndLAB static packages. The GitHub Actions workflow builds the native libraries from upstream source repositories:
|
||||
|
||||
- SkiaSharp: <https://github.com/mono/SkiaSharp>
|
||||
- ANGLE: <https://github.com/google/angle>
|
||||
|
||||
Build scripts:
|
||||
|
||||
- `scripts/build-linux-static-graphics.sh`
|
||||
- `scripts/build-windows-static-graphics.ps1`
|
||||
- `scripts/build-macos-static-graphics.sh`
|
||||
|
||||
Build locally after the static archives exist:
|
||||
|
||||
```bash
|
||||
dotnet pack NuGet/StaticGraphics/Shiroka.Avalonia.StaticLink.csproj -c Release -o artifacts/nuget
|
||||
```
|
||||
|
||||
The package will be written to:
|
||||
|
||||
```text
|
||||
artifacts/nuget/Shiroka.Avalonia.StaticLink.*.nupkg
|
||||
```
|
||||
|
||||
## GitHub Actions
|
||||
|
||||
The workflow `.github/workflows/nuget-static-graphics.yml` builds all native archives and packs a single NuGet package for all supported RIDs.
|
||||
|
||||
It will:
|
||||
|
||||
- build Linux x64 static archives on `ubuntu-latest`
|
||||
- build Linux arm64 static archives on `ubuntu-24.04-arm`
|
||||
- build Windows x64 and arm64 static archives on `windows-latest`
|
||||
- build macOS x64 and arm64 static archives on `macos-latest`
|
||||
- download all native artifacts into `External/NativeStatic/<rid>/`
|
||||
- run `dotnet pack`
|
||||
- upload the generated `.nupkg` as a workflow artifact
|
||||
|
||||
To publish automatically to nuget.org, add a repository secret named `NUGET_API_KEY`, then either:
|
||||
|
||||
- run the workflow manually with `publish_to_nuget=true`
|
||||
- push a tag matching `static-graphics-v*`
|
||||
|
||||
Example tag:
|
||||
|
||||
```bash
|
||||
git tag static-graphics-v3.119.2-7151.4
|
||||
git push origin static-graphics-v3.119.2-7151.4
|
||||
```
|
||||
|
||||
## Known Runtime Dependencies
|
||||
|
||||
Single-file does not always mean dependency-free. Depending on platform and publish settings, the final executable may still depend on operating system libraries and frameworks.
|
||||
|
||||
Linux examples:
|
||||
|
||||
- `libc.so.6`
|
||||
- `libm.so.6`
|
||||
- `libstdc++.so.6`
|
||||
- `libgcc_s.so.1`
|
||||
- `libfontconfig.so.1`
|
||||
- `libfreetype.so.6`
|
||||
|
||||
Linux systems also need usable fonts for text rendering and font fallback.
|
||||
|
||||
## Scope
|
||||
|
||||
This package only covers Avalonia graphics-related native libraries. If your application uses other native dependencies, such as SQLite, audio backends, OpenSSL, or custom native libraries, those dependencies may require separate handling.
|
||||
|
||||
## License
|
||||
|
||||
The NuGet package metadata uses the MIT license. The bundled third-party native libraries are built from their upstream projects and remain subject to their respective upstream licenses.
|
||||
- The package is intended for Avalonia `11.3.x` NativeAOT apps.
|
||||
- The CI builds and smoke-publishes all six supported RIDs.
|
||||
- macOS smoke tests run the published app on GitHub Actions and require it to stay alive for 15 seconds.
|
||||
- Other native dependencies used by your app, such as SQLite or audio libraries, are outside this package's scope.
|
||||
Reference in new issue
Block a user