diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxArm/Jellyfin.SkiaSharp.NativeAssets.LinuxArm.nuspec b/Jellyfin.SkiaSharp.NativeAssets.LinuxArm/Jellyfin.SkiaSharp.NativeAssets.LinuxArm.nuspec index 52f0aca..7868c09 100644 --- a/Jellyfin.SkiaSharp.NativeAssets.LinuxArm/Jellyfin.SkiaSharp.NativeAssets.LinuxArm.nuspec +++ b/Jellyfin.SkiaSharp.NativeAssets.LinuxArm/Jellyfin.SkiaSharp.NativeAssets.LinuxArm.nuspec @@ -7,21 +7,21 @@ Jellyfin.SkiaSharp.NativeAssets.LinuxArm 1.68.0 - 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. - 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. https://github.com/Jellyfin/jellyfin-skiasharp-native - + xamarin graphics linux arm cross-platform skiasharp - - MIT + + MIT Microsoft Microsoft @@ -35,11 +35,11 @@ - + - - - + + + \ No newline at end of file diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/.gitignore b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/.gitignore new file mode 100644 index 0000000..cfa2896 --- /dev/null +++ b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/.gitignore @@ -0,0 +1,7 @@ +*.nupkg +*.so + +skia +depot-tools +tools +gcc-linaro* \ No newline at end of file diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/Dockerfile b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/Dockerfile new file mode 100644 index 0000000..56eb660 --- /dev/null +++ b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/Dockerfile @@ -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 \ No newline at end of file diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl.nuspec b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl.nuspec new file mode 100644 index 0000000..87a9cbf --- /dev/null +++ b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl.nuspec @@ -0,0 +1,45 @@ + + + + + + Jellyfin.SkiaSharp.NativeAssets.LinuxMusl + Jellyfin.SkiaSharp.NativeAssets.LinuxMusl + 1.68.0 + + 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. + + + 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. + + https://github.com/Jellyfin/jellyfin-skiasharp-native + + xamarin graphics linux musl alpine cross-platform skiasharp + + + MIT + + Microsoft + Microsoft + true + © Microsoft Corporation. All rights reserved. + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/README.md b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/README.md new file mode 100644 index 0000000..b581373 --- /dev/null +++ b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/README.md @@ -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` \ No newline at end of file diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/build-in-docker.sh b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/build-in-docker.sh new file mode 100644 index 0000000..d39018c --- /dev/null +++ b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/build-in-docker.sh @@ -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/ \ No newline at end of file diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/build/net45/SkiaSharp.targets b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/build/net45/SkiaSharp.targets new file mode 100644 index 0000000..38c0de7 --- /dev/null +++ b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/build/net45/SkiaSharp.targets @@ -0,0 +1,78 @@ + + + + + + True + + + + + + x86 + + + $(PlatformTarget) + + x64 + x86 + + x64 + + x86 + + + + + $(MSBuildThisFileDirectory)..\..\runtimes\win-$(PreferredNativeSkiaSharp)\native\libSkiaSharp.dll + $(MSBuildThisFileDirectory)..\..\runtimes\osx\native\libSkiaSharp.dylib + $(MSBuildThisFileDirectory)..\..\runtimes\linux-$(PreferredNativeSkiaSharp)\native\libSkiaSharp.so + + + + + $([System.IO.Path]::GetFilename('$(PreferredWindowsNativeSkiaSharpPath)')) + PreserveNewest + + + $([System.IO.Path]::GetFilename('$(PreferredOSXNativeSkiaSharpPath)')) + PreserveNewest + + + $([System.IO.Path]::GetFilename('$(PreferredLinuxNativeSkiaSharpPath)')) + PreserveNewest + + + + + + + + x86\libSkiaSharp.dll + PreserveNewest + + + x64\libSkiaSharp.dll + PreserveNewest + + + + x86\libSkiaSharp.so + PreserveNewest + + + x64\libSkiaSharp.so + PreserveNewest + + + arm\libSkiaSharp.so + PreserveNewest + + + + \ No newline at end of file diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/compile-libSkiaSharp.sh b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/compile-libSkiaSharp.sh new file mode 100644 index 0000000..bcbbcc4 --- /dev/null +++ b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/compile-libSkiaSharp.sh @@ -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 .. diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/patches/aarch64-skia-build-fix.patch b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/patches/aarch64-skia-build-fix.patch new file mode 100644 index 0000000..7395a4f --- /dev/null +++ b/Jellyfin.SkiaSharp.NativeAssets.LinuxMusl/patches/aarch64-skia-build-fix.patch @@ -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 + \ No newline at end of file diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxArm/LICENSE.txt b/LICENSE.txt similarity index 100% rename from Jellyfin.SkiaSharp.NativeAssets.LinuxArm/LICENSE.txt rename to LICENSE.txt diff --git a/Jellyfin.SkiaSharp.NativeAssets.LinuxArm/THIRD-PARTY-NOTICES.txt b/THIRD-PARTY-NOTICES.txt similarity index 100% rename from Jellyfin.SkiaSharp.NativeAssets.LinuxArm/THIRD-PARTY-NOTICES.txt rename to THIRD-PARTY-NOTICES.txt