mirror of
https://github.com/jellyfin/jellyfin-skiasharp-native.git
synced 2024-11-23 05:59:48 +00:00
Added musl (Alpine build)
This commit is contained in:
parent
b93d4bdaee
commit
00f0bf48f6
@ -7,21 +7,21 @@
|
||||
<title>Jellyfin.SkiaSharp.NativeAssets.LinuxArm</title>
|
||||
<version>1.68.0</version>
|
||||
<description>
|
||||
This is a Raspbian tools built ARM32+ARM64 native library for SkiaSharp.
|
||||
|
||||
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
|
||||
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
|
||||
This is a Raspbian tools built ARM32+ARM64 native library for SkiaSharp.
|
||||
|
||||
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
|
||||
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
|
||||
</description>
|
||||
<summary>
|
||||
This is a Raspbian tools built ARM32+ARM64 native library for SkiaSharp.
|
||||
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
|
||||
This is a Raspbian tools built ARM32+ARM64 native library for SkiaSharp.
|
||||
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
|
||||
</summary>
|
||||
<projectUrl>https://github.com/Jellyfin/jellyfin-skiasharp-native</projectUrl>
|
||||
|
||||
|
||||
<tags>xamarin graphics linux arm cross-platform skiasharp</tags>
|
||||
|
||||
|
||||
<license type="expression">MIT</license>
|
||||
|
||||
<license type="expression">MIT</license>
|
||||
<!-- legal -->
|
||||
<authors>Microsoft</authors>
|
||||
<owners>Microsoft</owners>
|
||||
@ -35,11 +35,11 @@
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
<file src="build/net45/SkiaSharp.targets" target="build/net45/SkiaSharp.targets"/>
|
||||
<file src="build/net45/SkiaSharp.targets" target="build/net45/SkiaSharp.targets"/>
|
||||
<!-- the native file -->
|
||||
<file src="runtimes/linux-arm/native/libSkiaSharp.so" target="runtimes/linux-arm/native/libSkiaSharp.so"/>
|
||||
<file src="runtimes/linux-arm64/native/libSkiaSharp.so" target="runtimes/linux-arm64/native/libSkiaSharp.so"/>
|
||||
<file src="LICENSE.txt" />
|
||||
<file src="THIRD-PARTY-NOTICES.txt" />
|
||||
<file src="runtimes/linux-arm64/native/libSkiaSharp.so" target="runtimes/linux-arm64/native/libSkiaSharp.so"/>
|
||||
<file src="../LICENSE.txt" target="LICENSE.txt"/>
|
||||
<file src="../THIRD-PARTY-NOTICES.txt" target="THIRD-PARTY-NOTICES.txt"/>
|
||||
</files>
|
||||
</package>
|
7
Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/.gitignore
vendored
Normal file
7
Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
*.nupkg
|
||||
*.so
|
||||
|
||||
skia
|
||||
depot-tools
|
||||
tools
|
||||
gcc-linaro*
|
45
Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/Dockerfile
Normal file
45
Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/Dockerfile
Normal file
@ -0,0 +1,45 @@
|
||||
FROM alpine:3.8 as gn-builder
|
||||
|
||||
ARG GN_COMMIT=377ad0417d8f7df348fd865e21a0a905daa4b22c
|
||||
|
||||
RUN \
|
||||
apk add --update --virtual .gn-build-dependencies \
|
||||
alpine-sdk \
|
||||
binutils-gold \
|
||||
clang \
|
||||
curl \
|
||||
git \
|
||||
llvm4 \
|
||||
ninja \
|
||||
python \
|
||||
tar \
|
||||
xz \
|
||||
# Two quick fixes: we need the LLVM tooling in $PATH, and we
|
||||
# also have to use gold instead of ld.
|
||||
&& PATH=$PATH:/usr/lib/llvm4/bin \
|
||||
&& cp -f /usr/bin/ld.gold /usr/bin/ld \
|
||||
|
||||
# Clone and build gn
|
||||
&& git clone https://gn.googlesource.com/gn /tmp/gn \
|
||||
&& git -C /tmp/gn checkout ${GN_COMMIT} \
|
||||
&& cd /tmp/gn \
|
||||
&& python build/gen.py \
|
||||
&& ninja -C out \
|
||||
&& cp -f /tmp/gn/out/gn /usr/local/bin/gn \
|
||||
|
||||
# Remove build dependencies and temporary files
|
||||
&& apk del .gn-build-dependencies \
|
||||
&& rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
|
||||
|
||||
|
||||
FROM alpine:3.8
|
||||
|
||||
COPY --from=gn-builder /usr/local/bin/gn /build/buildtools/linux64/gn
|
||||
|
||||
RUN apk add --update alpine-sdk git ninja clang clang-dev python2 bash fontconfig-dev #libwebp-dev libpng-dev freetype-dev libjpeg-turbo-dev zlib-dev expat-dev
|
||||
|
||||
WORKDIR /build
|
||||
COPY compile-libSkiaSharp.sh compile-libSkiaSharp.sh
|
||||
|
||||
RUN chmod +x compile-libSkiaSharp.sh \
|
||||
&& bash compile-libSkiaSharp.sh 2>&1
|
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package>
|
||||
<metadata>
|
||||
|
||||
<!-- package -->
|
||||
<id>Jellyfin.SkiaSharp.NativeAssets.LinuxMusl</id>
|
||||
<title>Jellyfin.SkiaSharp.NativeAssets.LinuxMusl</title>
|
||||
<version>1.68.0</version>
|
||||
<description>
|
||||
This is a Alpine linux built native library for SkiaSharp.
|
||||
|
||||
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
|
||||
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
|
||||
</description>
|
||||
<summary>
|
||||
This is a Alpine linux built native library for SkiaSharp.
|
||||
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
|
||||
</summary>
|
||||
<projectUrl>https://github.com/Jellyfin/jellyfin-skiasharp-native</projectUrl>
|
||||
|
||||
<tags>xamarin graphics linux musl alpine cross-platform skiasharp</tags>
|
||||
|
||||
|
||||
<license type="expression">MIT</license>
|
||||
<!-- legal -->
|
||||
<authors>Microsoft</authors>
|
||||
<owners>Microsoft</owners>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
|
||||
<dependencies>
|
||||
<dependency id="SkiaSharp" version="1.68.0" />
|
||||
</dependencies>
|
||||
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
<file src="build/net45/SkiaSharp.targets" target="build/net45/SkiaSharp.targets"/>
|
||||
<!-- the native file -->
|
||||
<file src="runtimes/linux-arm/native/libSkiaSharp.so" target="runtimes/linux-arm/native/libSkiaSharp.so"/>
|
||||
<file src="runtimes/linux-arm64/native/libSkiaSharp.so" target="runtimes/linux-arm64/native/libSkiaSharp.so"/>
|
||||
<file src="../LICENSE.txt" target="LICENSE.txt"/>
|
||||
<file src="../THIRD-PARTY-NOTICES.txt" target="THIRD-PARTY-NOTICES.txt"/>
|
||||
</files>
|
||||
</package>
|
15
Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/README.md
Normal file
15
Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# SkiaSharp Native library for arm32 and arm64.
|
||||
|
||||
The 64-bit build runs with `-flax-vector-conversions` so, use at your own risk. Upstream issue: https://skia-review.googlesource.com/c/skia/+/84222 GCC seems to not support this.
|
||||
|
||||
## Build (Debian based) (Also WSL)
|
||||
|
||||
1. `cross-compile-libSkiaSharp.sh`
|
||||
2. `mkdir -p ./runtimes/linux-arm/native && mkdir -p ./runtimes/linux-arm64/native`
|
||||
3. `cp skia/out/linux-arm/libSkiaSharp.so ./runtimes/linux-arm/native/ && cp skia/out/linux-arm64/libSkiaSharp.so ./runtimes/linux-arm64/native/`
|
||||
4. `nuget pack`
|
||||
|
||||
## Build (non Debian) (uses docker)
|
||||
|
||||
1. `build-in-docker.sh`
|
||||
2. `nuget pack`
|
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker build -t libskiasharp-musllinux .
|
||||
mkdir -p ./runtimes/linux-musl-x64/native
|
||||
docker run --rm -v "./runtimes/linux-musl-x64/native:/temp" "libskiasharp-musllinux" cp /build/skia/out/linux-musl-x64/libSkiaSharp.so /temp/
|
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- if ShouldIncludeNativeSkiaSharp == False then don't include the native libSkiaSharp -->
|
||||
<PropertyGroup>
|
||||
<ShouldIncludeNativeSkiaSharp Condition=" '$(ShouldIncludeNativeSkiaSharp)' == '' ">True</ShouldIncludeNativeSkiaSharp>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- get the preferred architecture -->
|
||||
<PropertyGroup>
|
||||
<!-- handle VS 2017 live unit testing -->
|
||||
<PreferredNativeSkiaSharp Condition=" '$(PreferredNativeSkiaSharp)' == '' and '$(BuildingForLiveUnitTesting)' == 'true' and '$(PlatformTarget)' == '' ">x86</PreferredNativeSkiaSharp>
|
||||
|
||||
<!-- handle x86/x64 specifically -->
|
||||
<PreferredNativeSkiaSharp Condition=" '$(PreferredNativeSkiaSharp)' == '' and ( '$(PlatformTarget)' == 'x64' or '$(PlatformTarget)' == 'x86' ) ">$(PlatformTarget)</PreferredNativeSkiaSharp>
|
||||
<!-- handle Any CPU, considering Prefer32Bit -->
|
||||
<PreferredNativeSkiaSharp Condition=" '$(PreferredNativeSkiaSharp)' == '' and '$(Prefer32Bit)' == 'False' ">x64</PreferredNativeSkiaSharp>
|
||||
<PreferredNativeSkiaSharp Condition=" '$(PreferredNativeSkiaSharp)' == '' and '$(Prefer32Bit)' == 'True' ">x86</PreferredNativeSkiaSharp>
|
||||
<!-- fall back to x64 on 64-bit machines -->
|
||||
<PreferredNativeSkiaSharp Condition=" '$(PreferredNativeSkiaSharp)' == '' and $([System.Environment]::Is64BitOperatingSystem) ">x64</PreferredNativeSkiaSharp>
|
||||
<!-- fall back to x86 -->
|
||||
<PreferredNativeSkiaSharp Condition=" '$(PreferredNativeSkiaSharp)' == '' ">x86</PreferredNativeSkiaSharp>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- get the preferred paths -->
|
||||
<PropertyGroup>
|
||||
<PreferredWindowsNativeSkiaSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\win-$(PreferredNativeSkiaSharp)\native\libSkiaSharp.dll</PreferredWindowsNativeSkiaSharpPath>
|
||||
<PreferredOSXNativeSkiaSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\osx\native\libSkiaSharp.dylib</PreferredOSXNativeSkiaSharpPath>
|
||||
<PreferredLinuxNativeSkiaSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\linux-$(PreferredNativeSkiaSharp)\native\libSkiaSharp.so</PreferredLinuxNativeSkiaSharpPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(ShouldIncludeNativeSkiaSharp)' != 'False' ">
|
||||
<None Include="$(PreferredWindowsNativeSkiaSharpPath)" Condition=" Exists('$(PreferredWindowsNativeSkiaSharpPath)') ">
|
||||
<Link>$([System.IO.Path]::GetFilename('$(PreferredWindowsNativeSkiaSharpPath)'))</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(PreferredOSXNativeSkiaSharpPath)" Condition=" Exists('$(PreferredOSXNativeSkiaSharpPath)') ">
|
||||
<Link>$([System.IO.Path]::GetFilename('$(PreferredOSXNativeSkiaSharpPath)'))</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(PreferredLinuxNativeSkiaSharpPath)" Condition=" Exists('$(PreferredLinuxNativeSkiaSharpPath)') ">
|
||||
<Link>$([System.IO.Path]::GetFilename('$(PreferredLinuxNativeSkiaSharpPath)'))</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- a special case for Any CPU -->
|
||||
<ItemGroup Condition=" '$(ShouldIncludeNativeSkiaSharp)' != 'False' and ( '$(PlatformTarget)' != 'x64' and '$(PlatformTarget)' != 'x86' ) ">
|
||||
<!-- Windows -->
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libSkiaSharp.dll"
|
||||
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libSkiaSharp.dll')">
|
||||
<Link>x86\libSkiaSharp.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libSkiaSharp.dll"
|
||||
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libSkiaSharp.dll')">
|
||||
<Link>x64\libSkiaSharp.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<!-- Linux -->
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-x86\native\libSkiaSharp.so"
|
||||
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\linux-x86\native\libSkiaSharp.so')">
|
||||
<Link>x86\libSkiaSharp.so</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-x64\native\libSkiaSharp.so"
|
||||
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\linux-x64\native\libSkiaSharp.so')">
|
||||
<Link>x64\libSkiaSharp.so</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-arm\native\libSkiaSharp.so"
|
||||
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\linux-arm\native\libSkiaSharp.so')">
|
||||
<Link>arm\libSkiaSharp.so</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
set -e
|
||||
if [ ! -d "skia" ] ; then
|
||||
git clone https://github.com/mono/skia.git -b v1.68.0 --depth 1 skia
|
||||
fi
|
||||
|
||||
cd skia
|
||||
|
||||
python tools/git-sync-deps
|
||||
|
||||
/build/buildtools/linux64/gn gen 'out/linux-musl-x64' --args='
|
||||
is_official_build=true skia_enable_tools=false
|
||||
target_os="linux" target_cpu="x64"
|
||||
skia_use_icu=false skia_use_sfntly=false skia_use_piex=true
|
||||
skia_use_system_expat=false skia_use_system_freetype2=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false
|
||||
skia_enable_gpu=true
|
||||
extra_cflags=[ "-DSKIA_C_DLL", "-O3" ]
|
||||
linux_soname_version=""'
|
||||
|
||||
# compile
|
||||
ninja 'SkiaSharp' -C 'out/linux-musl-x64'
|
||||
|
||||
cd ..
|
@ -0,0 +1,27 @@
|
||||
--- skia/src/opts/SkRasterPipeline_opts.h 2019-01-09 18:19:10.865939300 +0100
|
||||
+++ skia/src/opts/SkRasterPipeline_opts_new.h 2019-01-09 18:51:42.634521900 +0100
|
||||
@@ -653,10 +653,7 @@
|
||||
}
|
||||
|
||||
SI F from_half(U16 h) {
|
||||
-#if defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary workaround for some Google3 builds.
|
||||
- return vcvt_f32_f16(h);
|
||||
-
|
||||
-#elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
|
||||
+#if defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
|
||||
return _mm256_cvtph_ps(h);
|
||||
|
||||
#else
|
||||
@@ -673,10 +670,7 @@
|
||||
}
|
||||
|
||||
SI U16 to_half(F f) {
|
||||
-#if defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary workaround for some Google3 builds.
|
||||
- return vcvt_f16_f32(f);
|
||||
-
|
||||
-#elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
|
||||
+#if defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
|
||||
return _mm256_cvtps_ph(f, _MM_FROUND_CUR_DIRECTION);
|
||||
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user