From ac44fca01dcbcfff17d3a21d73f261d1f5deb91e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 01:56:24 +0800
Subject: [PATCH 01/35] Add LoongArch64 build support

---
 .../HarfBuzzSharp.NativeAssets.Linux.csproj   | 54 ++++++-------
 .../net4/HarfBuzzSharp.targets                |  6 ++
 ...p.NativeAssets.Linux.NoDependencies.csproj | 78 ++++++++++---------
 .../buildTransitive/net4/SkiaSharp.targets    |  8 +-
 .../SkiaSharp.NativeAssets.Linux.csproj       | 56 ++++++-------
 .../buildTransitive/net4/SkiaSharp.targets    |  6 ++
 scripts/Docker/_clang-cross-common.sh         | 54 ++++++-------
 scripts/Docker/alpine/clang-cross/Dockerfile  | 69 ++++++----------
 .../Docker/alpine/clang-cross/build-local.sh  | 15 ++--
 .../Docker/debian/clang-cross/13/Dockerfile   | 64 +++++++++++++++
 .../Docker/debian/clang-cross/build-local.sh  | 18 +++--
 scripts/azure-templates-stages.yml            | 72 +++++++++++++----
 scripts/cake/native-shared.cake               |  2 +
 13 files changed, 311 insertions(+), 191 deletions(-)
 create mode 100644 scripts/Docker/debian/clang-cross/13/Dockerfile

diff --git a/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj b/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj
index 1c3ae7d00e..65c9e7747f 100644
--- a/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj
+++ b/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj
@@ -1,26 +1,28 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
-    <PackagingGroup>HarfBuzzSharp</PackagingGroup>
-    <Title>$(PackagingGroup) - Native Assets for Linux</Title>
-  </PropertyGroup>
-  <ItemGroup>
-    <!-- glibc -->
-    <PackageFile Include="..\..\output\native\linux\x64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\x86\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
-    <!-- Musl -->
-    <PackageFile Include="..\..\output\native\alpine\x64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\x86\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
-  </ItemGroup>
-  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
-    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
-      <TfmSpecificPackageFile Include="buildTransitive\net4\HarfBuzzSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
-    </ItemGroup>
-  </Target>
-</Project>
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
+    <PackagingGroup>HarfBuzzSharp</PackagingGroup>
+    <Title>$(PackagingGroup) - Native Assets for Linux</Title>
+  </PropertyGroup>
+  <ItemGroup>
+    <!-- glibc -->
+    <PackageFile Include="..\..\output\native\linux\x64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\x86\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\loongarch64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
+    <!-- Musl -->
+    <PackageFile Include="..\..\output\native\alpine\x64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\x86\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\loongarch64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
+  </ItemGroup>
+  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
+    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
+      <TfmSpecificPackageFile Include="buildTransitive\net4\HarfBuzzSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
+    </ItemGroup>
+  </Target>
+</Project>
diff --git a/binding/HarfBuzzSharp.NativeAssets.Linux/buildTransitive/net4/HarfBuzzSharp.targets b/binding/HarfBuzzSharp.NativeAssets.Linux/buildTransitive/net4/HarfBuzzSharp.targets
index e57e8091c4..06826d3c4b 100644
--- a/binding/HarfBuzzSharp.NativeAssets.Linux/buildTransitive/net4/HarfBuzzSharp.targets
+++ b/binding/HarfBuzzSharp.NativeAssets.Linux/buildTransitive/net4/HarfBuzzSharp.targets
@@ -25,6 +25,9 @@
         <_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-riscv64\native\libHarfBuzzSharp*.so">
             <Dir>riscv64\</Dir>
         </_NativeHarfBuzzSharpFile>
+        <_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-loongarch64\native\libHarfBuzzSharp*.so">
+            <Dir>loongarch64\</Dir>
+        </_NativeHarfBuzzSharpFile>
 
         <!-- Musl -->
         <_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-x86\native\libHarfBuzzSharp*.so">
@@ -42,6 +45,9 @@
         <_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-riscv64\native\libHarfBuzzSharp*.so">
             <Dir>musl-riscv64\</Dir>
         </_NativeHarfBuzzSharpFile>
+        <_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-loongarch64\native\libHarfBuzzSharp*.so">
+            <Dir>musl-loongarch64\</Dir>
+        </_NativeHarfBuzzSharpFile>
 
         <!-- include everything -->
         <Content Include="@(_NativeHarfBuzzSharpFile)">
diff --git a/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj b/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj
index d782128fdb..92bbd90306 100644
--- a/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj
+++ b/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj
@@ -1,38 +1,40 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
-    <PackagingGroup>SkiaSharp</PackagingGroup>
-    <Title>$(PackagingGroup) - Native Assets for Linux (No Dependencies)</Title>
-    <PackageNotes>This variation of the Linux native assets includes the build of libSkiaSharp.so that does not have any dependencies on third-party libraries.
-
-The complete dependency list is:
- - libpthread.so.0
- - libdl.so.2
- - libm.so.6
- - libc.so.6
- - ld-linux-x86-64.so.2
-
-The excluded dependencies are:
- - Fontconfig</PackageNotes>
-  </PropertyGroup>
-  <ItemGroup>
-    <!-- glibc -->
-    <PackageFile Include="..\..\output\native\linuxnodeps\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linuxnodeps\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linuxnodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linuxnodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linuxnodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
-    <!-- Musl -->
-    <PackageFile Include="..\..\output\native\alpinenodeps\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpinenodeps\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpinenodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpinenodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpinenodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
-  </ItemGroup>
-  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
-    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
-      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
-      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="build\$(NuGetShortFolderName)\$(PackageId).targets" />
-    </ItemGroup>
-  </Target>
-</Project>
\ No newline at end of file
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
+    <PackagingGroup>SkiaSharp</PackagingGroup>
+    <Title>$(PackagingGroup) - Native Assets for Linux (No Dependencies)</Title>
+    <PackageNotes>This variation of the Linux native assets includes the build of libSkiaSharp.so that does not have any dependencies on third-party libraries.
+
+The complete dependency list is:
+ - libpthread.so.0
+ - libdl.so.2
+ - libm.so.6
+ - libc.so.6
+ - ld-linux-x86-64.so.2
+
+The excluded dependencies are:
+ - Fontconfig</PackageNotes>
+  </PropertyGroup>
+  <ItemGroup>
+    <!-- glibc -->
+    <PackageFile Include="..\..\output\native\linuxnodeps\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
+    <!-- Musl -->
+    <PackageFile Include="..\..\output\native\alpinenodeps\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
+  </ItemGroup>
+  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
+    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
+      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
+      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="build\$(NuGetShortFolderName)\$(PackageId).targets" />
+    </ItemGroup>
+  </Target>
+</Project>
diff --git a/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/buildTransitive/net4/SkiaSharp.targets b/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/buildTransitive/net4/SkiaSharp.targets
index 816a0521bf..ffe1394d2b 100644
--- a/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/buildTransitive/net4/SkiaSharp.targets
+++ b/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/buildTransitive/net4/SkiaSharp.targets
@@ -25,6 +25,9 @@
         <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-riscv64\native\libSkiaSharp*.so">
             <Dir>riscv64\</Dir>
         </_NativeSkiaSharpFile>
+        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-loongarch64\native\libSkiaSharp*.so">
+            <Dir>loongarch64\</Dir>
+        </_NativeSkiaSharpFile>
 
         <!-- Musl -->
         <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-x86\native\libSkiaSharp*.so">
@@ -42,6 +45,9 @@
         <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-riscv64\native\libSkiaSharp*.so">
             <Dir>musl-riscv64\</Dir>
         </_NativeSkiaSharpFile>
+        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-loongarch64\native\libSkiaSharp*.so">
+            <Dir>musl-loongarch64\</Dir>
+        </_NativeSkiaSharpFile>
 
         <!-- include everything -->
         <Content Include="@(_NativeSkiaSharpFile)">
@@ -52,4 +58,4 @@
 
     </ItemGroup>
 
-</Project>
\ No newline at end of file
+</Project>
diff --git a/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj b/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj
index cb841711d4..edfd8d4033 100644
--- a/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj
+++ b/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj
@@ -1,27 +1,29 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
-    <PackagingGroup>SkiaSharp</PackagingGroup>
-    <Title>$(PackagingGroup) - Native Assets for Linux</Title>
-  </PropertyGroup>
-  <ItemGroup>
-    <!-- glibc -->
-    <PackageFile Include="..\..\output\native\linux\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
-    <!-- Musl -->
-    <PackageFile Include="..\..\output\native\alpine\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
-  </ItemGroup>
-  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
-    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
-      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
-      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="build\$(NuGetShortFolderName)\$(PackageId).targets" />
-    </ItemGroup>
-  </Target>
-</Project>
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
+    <PackagingGroup>SkiaSharp</PackagingGroup>
+    <Title>$(PackagingGroup) - Native Assets for Linux</Title>
+  </PropertyGroup>
+  <ItemGroup>
+    <!-- glibc -->
+    <PackageFile Include="..\..\output\native\linux\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
+    <!-- Musl -->
+    <PackageFile Include="..\..\output\native\alpine\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
+  </ItemGroup>
+  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
+    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
+      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
+      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="build\$(NuGetShortFolderName)\$(PackageId).targets" />
+    </ItemGroup>
+  </Target>
+</Project>
diff --git a/binding/SkiaSharp.NativeAssets.Linux/buildTransitive/net4/SkiaSharp.targets b/binding/SkiaSharp.NativeAssets.Linux/buildTransitive/net4/SkiaSharp.targets
index fa4eff2bb9..ffe1394d2b 100644
--- a/binding/SkiaSharp.NativeAssets.Linux/buildTransitive/net4/SkiaSharp.targets
+++ b/binding/SkiaSharp.NativeAssets.Linux/buildTransitive/net4/SkiaSharp.targets
@@ -25,6 +25,9 @@
         <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-riscv64\native\libSkiaSharp*.so">
             <Dir>riscv64\</Dir>
         </_NativeSkiaSharpFile>
+        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-loongarch64\native\libSkiaSharp*.so">
+            <Dir>loongarch64\</Dir>
+        </_NativeSkiaSharpFile>
 
         <!-- Musl -->
         <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-x86\native\libSkiaSharp*.so">
@@ -42,6 +45,9 @@
         <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-riscv64\native\libSkiaSharp*.so">
             <Dir>musl-riscv64\</Dir>
         </_NativeSkiaSharpFile>
+        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-loongarch64\native\libSkiaSharp*.so">
+            <Dir>musl-loongarch64\</Dir>
+        </_NativeSkiaSharpFile>
 
         <!-- include everything -->
         <Content Include="@(_NativeSkiaSharpFile)">
diff --git a/scripts/Docker/_clang-cross-common.sh b/scripts/Docker/_clang-cross-common.sh
index 57b32a8314..f5135ba2c1 100755
--- a/scripts/Docker/_clang-cross-common.sh
+++ b/scripts/Docker/_clang-cross-common.sh
@@ -1,43 +1,43 @@
 #!/usr/bin/env bash
 set -ex
 
-# Parameters:
-# $1 - The directory containing the Dockerfile  [ clang-cross/10 | clang-cross ]
-# $2 - The target architecture to build for     [ arm | arm64 | riscv64 | x86 | x64 ]
-# $3 - The ABI                                  [ gnu | musl ]
-# $4 - The variant                              [ "" | alpine ]
-
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
-
-# the directory containing the Dockerfile
 DOCKER_DIR="$1"
 
 # the target architecture to build for
-ARCH="$2"
+ARCH="${2:-arm}"
 
 # the docker image architecture to use
 MACHINE_ARCH="$(uname -m)"
-case $MACHINE_ARCH in
-  arm64) IMAGE_ARCH=arm64v8 ; MACHINE_ARCH=aarch64 ;;
-  *)     IMAGE_ARCH=amd64   ;;
+[ "$MACHINE_ARCH" = "arm64" ] && MACHINE_ARCH=aarch64
+IMAGE_ARCH="${3:-$([[ "$MACHINE_ARCH" == "aarch64" ]] && echo "arm64v8" || echo "amd64")}"
+
+DISTRO_VERSION=$4
+ABI=$5
+VENDOR=$6
+
+case $ARCH in
+  arm)           TOOLCHAIN_ARCH=arm$VENDOR-linux-${ABI}eabihf     ; TOOLCHAIN_ARCH_SHORT=armhf     ; TARGET_MACHINE_ARCH=armhf       ;;
+  arm64)         TOOLCHAIN_ARCH=aarch64$VENDOR-linux-$ABI         ; TOOLCHAIN_ARCH_SHORT=arm64     ; TARGET_MACHINE_ARCH=aarch64     ;;
+  loongarch64)   TOOLCHAIN_ARCH=loongarch64$VENDOR-linux-$ABI     ; TOOLCHAIN_ARCH_SHORT=loong64   ; TARGET_MACHINE_ARCH=loongarch64 ;;
+  riscv64)       TOOLCHAIN_ARCH=riscv64$VENDOR-linux-$ABI         ; TOOLCHAIN_ARCH_SHORT=riscv64   ; TARGET_MACHINE_ARCH=riscv64     ;;
+  x86)           TOOLCHAIN_ARCH=i686$VENDOR-linux-$ABI            ; TOOLCHAIN_ARCH_SHORT=i386      ; TARGET_MACHINE_ARCH=x86         ;;
+  x64)           TOOLCHAIN_ARCH=x86-64$VENDOR-linux-$ABI          ; TOOLCHAIN_ARCH_SHORT=amd64     ; TARGET_MACHINE_ARCH=x86_64      ;;
+  *) echo "Unsupported architecture: $ARCH" && exit 1 ;;
 esac
 
-# the ABI
-ABI=$3
-
-# the variant
-VARIANT=$4
-
-(cd $DIR && 
-  docker build --tag skiasharp-linux-$ABI-cross-$ARCH \
-    --build-arg BUILD_ARCH=$ARCH                      \
-    --build-arg IMAGE_ARCH=$IMAGE_ARCH                \
-    --build-arg MACHINE_ARCH=$MACHINE_ARCH            \
+(cd $DIR && docker build --tag skiasharp-linux-$ABI-cross-$ARCH \
+    --build-arg TOOLCHAIN_ARCH=$TOOLCHAIN_ARCH                  \
+    --build-arg TOOLCHAIN_ARCH_SHORT=$TOOLCHAIN_ARCH_SHORT      \
+    --build-arg IMAGE_ARCH=$IMAGE_ARCH                          \
+    --build-arg MACHINE_ARCH=$MACHINE_ARCH                      \
+    --build-arg TARGET_MACHINE_ARCH=$TARGET_MACHINE_ARCH        \
+    --build-arg DISTRO_VERSION=$DISTRO_VERSION                  \
     $DOCKER_DIR)
 
-[ -n "$VARIANT" ] && VARIANT="--variant=$VARIANT"
+if [ "$VENDOR" = "-alpine" ]; then vendor=alpine; fi
 
 (cd $DIR/../.. && 
-    docker run --rm --name skiasharp-linux-$ABI-cross-$ARCH --volume $(pwd):/work skiasharp-linux-$ABI-cross-$ARCH /bin/bash -c " \
-        dotnet tool restore ; \
-        dotnet cake --target=externals-linux-clang-cross --configuration=Release --buildarch=$ARCH $VARIANT ")
+    docker run --rm --name skiasharp-linux-$ABI-cross-$ARCH --volume $(pwd):/work skiasharp-linux-$ABI-cross-$ARCH /bin/bash -c "\
+        dotnet tool restore &&
+        dotnet cake --target=externals-linux-clang-cross --configuration=Release --buildarch=$ARCH --variant=$vendor")
diff --git a/scripts/Docker/alpine/clang-cross/Dockerfile b/scripts/Docker/alpine/clang-cross/Dockerfile
index c6ffe4431c..f302196e96 100644
--- a/scripts/Docker/alpine/clang-cross/Dockerfile
+++ b/scripts/Docker/alpine/clang-cross/Dockerfile
@@ -1,65 +1,44 @@
 # Arguments:
-#   IMAGE_ARCH           - the architecture of the image                    [ amd64 | arm64v8 | riscv64 ]
-#   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 8.0 | * ]
-#   LLVM_VERSION         - the version of the LLVM compiler                 [ 13 | * ]
-#   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 9 | * ]
-#   TOOLCHAIN_ARCH       - the architecture of the GCC toolchain            [ arm-alpine-linux-musleabihf | aarch64-alpine-linux-musl | riscv64-alpine-linux-musl ]
+#   IMAGE_ARCH           - the architecture of the image                    [ amd64 | arm64v8 | riscv64 | loongarch64 ]
+#   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 9.0 | * ]
+#   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 14 | * ]
+#   TOOLCHAIN_ARCH       - the architecture of the GCC toolchain            [ arm-alpine-linux-musleabihf | aarch64-alpine-linux-musl | riscv64-alpine-linux-musl | loongarch64-alpine-linux-musl ]
+#   TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 | loong64 ]
+#   FONTCONFIG_VERSION   - the exact version of libfontconfig1 to use       [ 2.13.1-2 | * ]
 
 ARG IMAGE_ARCH=amd64
 FROM ${IMAGE_ARCH}/debian:12
 
-# Set the architecture-specific variables based on the value of the BUILD_ARCH argument
-ARG BUILD_ARCH=arm64
-RUN case ${BUILD_ARCH} in \
-        arm)     TOOLCHAIN_ARCH=armv7-alpine-linux-musleabihf ; TOOLCHAIN_ARCH_TARGET=armv7-alpine-linux-musleabihf ;; \
-        arm64)   TOOLCHAIN_ARCH=aarch64-alpine-linux-musl     ; TOOLCHAIN_ARCH_TARGET=aarch64-alpine-linux-musl     ;; \
-        riscv64) TOOLCHAIN_ARCH=riscv64-alpine-linux-musl     ; TOOLCHAIN_ARCH_TARGET=riscv64-alpine-linux-musl     ;; \
-        x86)     TOOLCHAIN_ARCH=i586-alpine-linux-musl        ; TOOLCHAIN_ARCH_TARGET=i586-alpine-linux-musl        ;; \
-        x64)     TOOLCHAIN_ARCH=x86_64-alpine-linux-musl      ; TOOLCHAIN_ARCH_TARGET=x86_64-alpine-linux-musl      ;; \
-        *) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
-    esac \
-    && echo "export TOOLCHAIN_ARCH=${TOOLCHAIN_ARCH}" > /etc/skia-env \
-    && echo "export TOOLCHAIN_ARCH_TARGET=${TOOLCHAIN_ARCH_TARGET}" >> /etc/skia-env
-
 # Install the required packages
-ARG LLVM_VERSION=19
 RUN apt-get update \
     && apt-get install -y \
-        curl python3 git clang-${LLVM_VERSION} lld-${LLVM_VERSION} ninja-build xz-utils \
+        curl python3 git clang-19 lld-19 ninja-build xz-utils curl \
     && rm -rf /var/lib/apt/lists/*
 
 # Install the cross-compilation musl toolchain
-# First, obtain apk.static from https://gitlab.alpinelinux.org/alpine/apk-tools/-/releases/v2.12.14
+ARG DISTRO_VERSION=3.17
+ARG TOOLCHAIN_ARCH_SHORT=armhf
 ARG MACHINE_ARCH=x86_64
-RUN . /etc/skia-env \
-    && case "${BUILD_ARCH}" in \
-         arm)     APK_ARCH=armv7   ;; \
-         arm64)   APK_ARCH=aarch64 ;; \
-         riscv64) APK_ARCH=riscv64 ;; \
-         x86)     APK_ARCH=x86     ;; \
-         x64)     APK_ARCH=x86_64  ;; \
-         *) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
-         esac \
-    && case "${BUILD_ARCH}" in \
-         riscv64) DISTRO_VERSION=3.20 ;; \
-         *)       DISTRO_VERSION=3.17 ;; \
-         esac \
-    && APK_DIR="$(mktemp -d)" \
-    && curl -SLO --create-dirs --output-dir "$APK_DIR" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.12.14/$MACHINE_ARCH/apk.static" \
-    && chmod +x "$APK_DIR/apk.static" \
-    && "$APK_DIR/apk.static" \
+ARG TARGET_MACHINE_ARCH=armhf
+
+# obtain apk.static from gitlab.alpinelinux.org/alpine/apk-tools/-/releases/v2.14.6
+# apk.static for loongarch64 can be download in http://dl-cdn.alpinelinux.org/alpine/v3.21/main/loongarch64/apk-tools-static-2.14.6-r3.apk.
+RUN APK_DIR="$(mktemp -d)" && \
+    curl -SLO --create-dirs --output-dir "$APK_DIR" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.6/$MACHINE_ARCH/apk.static" && \
+    chmod +x "$APK_DIR/apk.static" && \
+    "$APK_DIR/apk.static" \
         -X "http://dl-cdn.alpinelinux.org/alpine/v$DISTRO_VERSION/main" \
         -X "http://dl-cdn.alpinelinux.org/alpine/v$DISTRO_VERSION/community" \
-        -U --allow-untrusted --root /alpine --arch "$APK_ARCH" --initdb add \
-    && "$APK_DIR/apk.static" \
+        -U --allow-untrusted --root /alpine --arch "$TARGET_MACHINE_ARCH" --initdb add && \
+    "$APK_DIR/apk.static" \
         -X "http://dl-cdn.alpinelinux.org/alpine/v$DISTRO_VERSION/main" \
         -X "http://dl-cdn.alpinelinux.org/alpine/v$DISTRO_VERSION/community" \
-        -U --allow-untrusted --root /alpine --arch "$APK_ARCH" --no-scripts \
+        -U --allow-untrusted --root /alpine --arch "$TARGET_MACHINE_ARCH" --no-scripts \
         add fontconfig-dev build-base linux-headers
 
 # Install the .NET SDK
 ARG DOTNET_SDK_VERSION=8.0
-ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
+ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1
 RUN curl https://dot.net/v1/dotnet-install.sh -L -o dotnet-install.sh \
     && bash dotnet-install.sh --channel ${DOTNET_SDK_VERSION} --install-dir /usr/share/dotnet --verbose \
     && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
@@ -67,10 +46,6 @@ RUN curl https://dot.net/v1/dotnet-install.sh -L -o dotnet-install.sh \
     && dotnet help \
     && dotnet --info
 
-ENV CC=clang-${LLVM_VERSION} CXX=clang++-${LLVM_VERSION}
+ENV CC=clang-19 CXX=clang++-19
 
 WORKDIR /work
-
-COPY ./startup.sh /
-RUN chmod +x /startup.sh
-ENTRYPOINT [ "/startup.sh" ]
diff --git a/scripts/Docker/alpine/clang-cross/build-local.sh b/scripts/Docker/alpine/clang-cross/build-local.sh
index 591b9d2d64..4c73ad7ff9 100755
--- a/scripts/Docker/alpine/clang-cross/build-local.sh
+++ b/scripts/Docker/alpine/clang-cross/build-local.sh
@@ -1,11 +1,16 @@
 #!/usr/bin/env bash
 set -ex
 
-# Parameters:
-# $1 - The target architecture to build for     [ arm | arm64 | riscv64 | x86 | x64 ]
-
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 
-ARCH="${1:-arm}"
+ARCH=$1
+ALPINE_VERSION=$3
+if [ -z "$ALPINE_VERSION" ]; then
+  case $ARCH in
+    loongarch64) ALPINE_VERSION=3.21 ;;
+    riscv64) ALPINE_VERSION=3.20     ;;
+    *) ALPINE_VERSION=3.17           ;;
+  esac
+fi
 
-$DIR/../../_clang-cross-common.sh "$DIR" "$ARCH" "musl" "alpine"
+$DIR/../../_clang-cross-common.sh "$DIR" "$ARCH" "$2" "$ALPINE_VERSION" "musl" "-alpine"
diff --git a/scripts/Docker/debian/clang-cross/13/Dockerfile b/scripts/Docker/debian/clang-cross/13/Dockerfile
new file mode 100644
index 0000000000..76a1789269
--- /dev/null
+++ b/scripts/Docker/debian/clang-cross/13/Dockerfile
@@ -0,0 +1,64 @@
+# Arguments:
+#   IMAGE_ARCH           - the architecture of the image                    [ amd64 | arm64v8 | riscv64 | loongarch64 ]
+#   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 9.0 | * ]
+#   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 14 | * ]
+#   TOOLCHAIN_ARCH       - the architecture of the GCC toolchain            [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu | loongarch64-linux-gnu ]
+#   TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | loong64 ]
+#   FONTCONFIG_VERSION   - the exact version of libfontconfig1 to use       [ 2.15.0-1 | * ]
+
+ARG IMAGE_ARCH=amd64
+FROM ${IMAGE_ARCH}/debian:12
+
+# Install the required packages (needs to add ftp.debian.org source)
+RUN apt-get update \
+    && apt-get install -y \
+        curl python3 git clang-19 ninja-build xz-utils \
+    && rm -rf /var/lib/apt/lists/*
+
+# Install the cross-compilation GCC toolchain (loongarch64 use GCC cross ports)
+ARG TOOLCHAIN_VERSION=14
+ARG TOOLCHAIN_ARCH=loongarch64-linux-gnu
+ARG TOOLCHAIN_ARCH_SHORT=loong64
+RUN apt-get update \
+    && apt-get install -y \
+       libstdc++-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
+       libgcc-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
+       binutils-${TOOLCHAIN_ARCH} \
+    && rm -rf /var/lib/apt/lists/*
+
+# Make the script more flexible and use "current" instead of the actual version
+RUN ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION} /usr/${TOOLCHAIN_ARCH}/include/c++/current \
+    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so || true \
+    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so
+
+# Install the cross-compilation skia build dependencies (fontconfig)
+ARG FONTCONFIG_VERSION=2.15.0-1.1
+RUN (mkdir -p /skia-utils/libfontconfig1-dev \
+    && cd /skia-utils/libfontconfig1-dev \
+    && curl https://pkg.loongnix.cn/loongnix/25/pool/main/f/fontconfig/libfontconfig-dev_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig1-dev.deb \
+    && ar vx libfontconfig1-dev.deb \
+    && tar -xJvf data.tar.xz \
+    && rm libfontconfig1-dev.deb \
+    && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ \
+    && cp -R usr/include/* /usr/${TOOLCHAIN_ARCH}/include/ )
+RUN (mkdir -p /skia-utils/libfontconfig1 \
+    && cd /skia-utils/libfontconfig1 \
+    && curl https://pkg.loongnix.cn/loongnix/25/pool/main/f/fontconfig/libfontconfig1_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig1.deb \
+    && ar vx libfontconfig1.deb \
+    && tar -xJvf data.tar.xz \
+    && rm libfontconfig1.deb \
+    && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ )
+
+# Install the .NET SDK
+ARG DOTNET_SDK_VERSION=8.0
+ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1
+RUN curl https://dot.net/v1/dotnet-install.sh -L -o dotnet-install.sh \
+    && bash dotnet-install.sh --channel ${DOTNET_SDK_VERSION} --install-dir /usr/share/dotnet --verbose \
+    && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
+    && rm dotnet-install.sh \
+    && dotnet help \
+    && dotnet --info
+
+ENV CC=clang-19 CXX=clang++-19
+
+WORKDIR /work
diff --git a/scripts/Docker/debian/clang-cross/build-local.sh b/scripts/Docker/debian/clang-cross/build-local.sh
index e1f5249d93..c7983a87e0 100644
--- a/scripts/Docker/debian/clang-cross/build-local.sh
+++ b/scripts/Docker/debian/clang-cross/build-local.sh
@@ -1,13 +1,17 @@
 #!/usr/bin/env bash
 set -ex
 
-# Parameters:
-# $1 - The target architecture to build for     [ arm | arm64 | riscv64 | x86 | x64 ]
-# $2 - The Debian distro version                [ 10 | 12 ]
-
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 
-ARCH="${1:-arm}"
-DEBIAN_VERSION="${2:-10}"
+# the target architecture to build for
+ARCH=$1
+DEBIAN_VERSION=$3
+if [ -z "$DEBIAN_VERSION" ]; then
+  case $ARCH in
+    loongarch64) DEBIAN_VERSION=13 ;;
+    riscv64) DEBIAN_VERSION=12     ;;
+    *) DEBIAN_VERSION=11           ;;
+  esac
+fi
 
-$DIR/../../_clang-cross-common.sh "$DIR/$DEBIAN_VERSION" "$ARCH" "gnu"
+$DIR/../../_clang-cross-common.sh "$DIR/$DEBIAN_VERSION" "$ARCH" "$2" "$DEBIAN_VERSION" "gnu"
diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index f49bc35c0c..c409a58f49 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -362,15 +362,39 @@ stages:
             matrix:
               - arch: x64
                 docker: scripts/Docker/debian/amd64
-              - ${{ each arch in split('arm,arm64,x86,riscv64', ',') }}: # separate x64 as it fails when cross-compiling
-                - arch: ${{ arch }}
-                  docker: scripts/Docker/debian/clang-cross/10
-                  target: externals-linux-clang-cross
-              - ${{ each arch in split('arm,arm64,x64,riscv64', ',') }}: # removed x86 as it is having issues building
-                - arch: ${{ arch }}
-                  variant: alpine
-                  docker: scripts/Docker/alpine/clang-cross
-                  target: externals-linux-clang-cross
+              - arch: x64
+                variant: alpine
+                docker: scripts/Docker/alpine/amd64
+              - arch: arm
+                docker: scripts/Docker/debian/clang-cross/11
+                target: externals-linux-clang-cross
+              - arch: arm64
+                docker: scripts/Docker/debian/clang-cross/11
+                dockerArgs: --build-arg TOOLCHAIN_ARCH=aarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=arm64
+                target: externals-linux-clang-cross
+              - arch: riscv64
+                docker: scripts/Docker/debian/clang-cross/12
+                dockerArgs: --build-arg TOOLCHAIN_ARCH=riscv64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=riscv64 --build-arg DISTRO_VERSION=12
+                target: externals-linux-clang-cross
+              - arch: arm64
+                variant: alpine
+                docker: scripts/Docker/alpine/clang-cross
+                dockerArgs: --build-arg TOOLCHAIN_ARCH=aarch64-alpine-linux-musl --build-arg TOOLCHAIN_ARCH_SHORT=arm64 --build-arg TARGET_MACHINE_ARCH=aarch64
+                target: externals-linux-clang-cross
+              - arch: riscv64
+                variant: alpine
+                docker: scripts/Docker/alpine/clang-cross
+                dockerArgs: --build-arg TOOLCHAIN_ARCH=riscv64-alpine-linux-musl --build-arg TOOLCHAIN_ARCH_SHORT=riscv64 --build-arg TARGET_MACHINE_ARCH=riscv64 --build-arg DISTRO_VERSION=3.20
+                target: externals-linux-clang-cross
+              - arch: loongarch64
+                docker: scripts/Docker/debian/clang-cross/13
+                dockerArgs: --build-arg TOOLCHAIN_ARCH=loongarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=loong64
+                target: externals-linux-clang-cross
+              - arch: loongarch64
+                variant: alpine
+                docker: scripts/Docker/alpine/clang-cross
+                dockerArgs: --build-arg TOOLCHAIN_ARCH=loongarch64-alpine-linux-musl --build-arg TOOLCHAIN_ARCH_SHORT=loong64 --build-arg TARGET_MACHINE_ARCH=loongarch64 --build-arg DISTRO_VERSION=3.21
+                target: externals-linux-clang-cross
         - template: /scripts/azure-templates-bootstrapper.yml@self # Build Native Tizen (Linux)
           parameters:
             name: native_tizen_linux
@@ -517,10 +541,12 @@ stages:
               - name: native_linux_arm64_alpine_nodeps_linux
               - name: native_linux_arm64_linux
               - name: native_linux_arm64_nodeps_linux
-              - name: native_linux_arm_alpine_linux
-              - name: native_linux_arm_alpine_nodeps_linux
               - name: native_linux_arm_linux
               - name: native_linux_arm_nodeps_linux
+              - name: native_linux_loongarch64_alpine_linux
+              - name: native_linux_loongarch64_alpine_nodeps_linux
+              - name: native_linux_loongarch64_linux
+              - name: native_linux_loongarch64_nodeps_linux
               - name: native_linux_riscv64_alpine_linux
               - name: native_linux_riscv64_alpine_nodeps_linux
               - name: native_linux_riscv64_linux
@@ -529,8 +555,6 @@ stages:
               - name: native_linux_x64_alpine_nodeps_linux
               - name: native_linux_x64_linux
               - name: native_linux_x64_nodeps_linux
-              - name: native_linux_x86_linux
-              - name: native_linux_x86_nodeps_linux
               # WASM
               - name: native_wasm_2_0_23_linux
               - name: native_wasm_2_0_6_linux
@@ -561,6 +585,26 @@ stages:
             buildPipelineType: ${{ parameters.buildPipelineType }}
             buildAgent: ${{ parameters.buildAgentHost }}
             requiredArtifacts:
+              # Linux
+              - name: native_linux_arm64_linux
+              - name: native_linux_arm64_nodeps_linux
+              - name: native_linux_arm64_alpine_linux
+              - name: native_linux_arm64_alpine_nodeps_linux
+              - name: native_linux_arm_linux
+              - name: native_linux_arm_nodeps_linux
+              - name: native_linux_loongarch64_alpine_linux
+              - name: native_linux_loongarch64_alpine_nodeps_linux
+              - name: native_linux_loongarch64_linux
+              - name: native_linux_loongarch64_nodeps_linux
+              - name: native_linux_riscv64_alpine_linux
+              - name: native_linux_riscv64_alpine_nodeps_linux
+              - name: native_linux_riscv64_linux
+              - name: native_linux_riscv64_nodeps_linux
+              - name: native_linux_x64_alpine_linux
+              - name: native_linux_x64_alpine_nodeps_linux
+              - name: native_linux_x64_linux
+              - name: native_linux_x64_nodeps_linux
+              # WASM
               - name: native_wasm_2_0_23_linux
               - name: native_wasm_2_0_6_linux
               - name: native_wasm_3_1_12_linux
@@ -883,6 +927,8 @@ stages:
             requiredArtifacts:
               - name: native_linux_x64_linux
               - name: native_linux_arm64_linux
+              - name: native_linux_riscv64_linux
+              - name: native_linux_loongarch64_linux
             postBuildSteps:
               - task: PublishTestResults@2
                 displayName: Publish the .NET Core test results
diff --git a/scripts/cake/native-shared.cake b/scripts/cake/native-shared.cake
index 860be68d29..b8c32d4f48 100644
--- a/scripts/cake/native-shared.cake
+++ b/scripts/cake/native-shared.cake
@@ -119,6 +119,8 @@ string ReduceArch(string arch)
             return "arm64";
         case "riscv64":
             return "riscv64";
+        case "loongarch64":
+            return "loongarch64";
     }
 
     throw new Exception($"Unknown architecture: {arch}");

From 18ee00f7c58356118fd750f2f5084f2e09a0a234 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:10:17 +0800
Subject: [PATCH 02/35] Delete
 binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj

---
 .../HarfBuzzSharp.NativeAssets.Linux.csproj   | 28 -------------------
 1 file changed, 28 deletions(-)
 delete mode 100644 binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj

diff --git a/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj b/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj
deleted file mode 100644
index 65c9e7747f..0000000000
--- a/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj
+++ /dev/null
@@ -1,28 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
-    <PackagingGroup>HarfBuzzSharp</PackagingGroup>
-    <Title>$(PackagingGroup) - Native Assets for Linux</Title>
-  </PropertyGroup>
-  <ItemGroup>
-    <!-- glibc -->
-    <PackageFile Include="..\..\output\native\linux\x64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\x86\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\loongarch64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
-    <!-- Musl -->
-    <PackageFile Include="..\..\output\native\alpine\x64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\x86\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\loongarch64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
-  </ItemGroup>
-  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
-    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
-      <TfmSpecificPackageFile Include="buildTransitive\net4\HarfBuzzSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
-    </ItemGroup>
-  </Target>
-</Project>

From ffc55e61bb80a1edaa6659b98b1eda50f963a01d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:14:11 +0800
Subject: [PATCH 03/35] Create HarfBuzzSharp.NativeAssets.Linux.csproj

---
 .../HarfBuzzSharp.NativeAssets.Linux.csproj   | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj

diff --git a/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj b/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj
new file mode 100644
index 0000000000..afaeedbfa0
--- /dev/null
+++ b/binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj
@@ -0,0 +1,28 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
+    <PackagingGroup>HarfBuzzSharp</PackagingGroup>
+    <Title>$(PackagingGroup) - Native Assets for Linux</Title>
+  </PropertyGroup>
+  <ItemGroup>
+    <!-- glibc -->
+    <PackageFile Include="..\..\output\native\linux\x64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\x86\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\loongarch64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
+    <!-- Musl -->
+    <PackageFile Include="..\..\output\native\alpine\x64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\x86\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\loongarch64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
+  </ItemGroup>
+  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
+    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
+      <TfmSpecificPackageFile Include="buildTransitive\net4\HarfBuzzSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
+    </ItemGroup>
+  </Target>
+</Project>

From 245e08dfd2536f08e039da219544ae0d5eb9d2ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:16:12 +0800
Subject: [PATCH 04/35] Delete
 binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj

---
 ...p.NativeAssets.Linux.NoDependencies.csproj | 40 -------------------
 1 file changed, 40 deletions(-)
 delete mode 100644 binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj

diff --git a/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj b/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj
deleted file mode 100644
index 92bbd90306..0000000000
--- a/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
-    <PackagingGroup>SkiaSharp</PackagingGroup>
-    <Title>$(PackagingGroup) - Native Assets for Linux (No Dependencies)</Title>
-    <PackageNotes>This variation of the Linux native assets includes the build of libSkiaSharp.so that does not have any dependencies on third-party libraries.
-
-The complete dependency list is:
- - libpthread.so.0
- - libdl.so.2
- - libm.so.6
- - libc.so.6
- - ld-linux-x86-64.so.2
-
-The excluded dependencies are:
- - Fontconfig</PackageNotes>
-  </PropertyGroup>
-  <ItemGroup>
-    <!-- glibc -->
-    <PackageFile Include="..\..\output\native\linuxnodeps\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linuxnodeps\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linuxnodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linuxnodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linuxnodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linuxnodeps\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
-    <!-- Musl -->
-    <PackageFile Include="..\..\output\native\alpinenodeps\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpinenodeps\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpinenodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpinenodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpinenodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpinenodeps\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
-  </ItemGroup>
-  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
-    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
-      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
-      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="build\$(NuGetShortFolderName)\$(PackageId).targets" />
-    </ItemGroup>
-  </Target>
-</Project>

From ee617c9a56502b75be3c19bb9a2115ea1cc1665b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:18:04 +0800
Subject: [PATCH 05/35] Create
 SkiaSharp.NativeAssets.Linux.NoDependencies.csproj

---
 ...p.NativeAssets.Linux.NoDependencies.csproj | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj

diff --git a/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj b/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj
new file mode 100644
index 0000000000..3de0a3fdde
--- /dev/null
+++ b/binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj
@@ -0,0 +1,40 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
+    <PackagingGroup>SkiaSharp</PackagingGroup>
+    <Title>$(PackagingGroup) - Native Assets for Linux (No Dependencies)</Title>
+    <PackageNotes>This variation of the Linux native assets includes the build of libSkiaSharp.so that does not have any dependencies on third-party libraries.
+
+The complete dependency list is:
+ - libpthread.so.0
+ - libdl.so.2
+ - libm.so.6
+ - libc.so.6
+ - ld-linux-x86-64.so.2
+
+The excluded dependencies are:
+ - Fontconfig</PackageNotes>
+  </PropertyGroup>
+  <ItemGroup>
+    <!-- glibc -->
+    <PackageFile Include="..\..\output\native\linuxnodeps\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linuxnodeps\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
+    <!-- Musl -->
+    <PackageFile Include="..\..\output\native\alpinenodeps\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpinenodeps\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
+  </ItemGroup>
+  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
+    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
+      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
+      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="build\$(NuGetShortFolderName)\$(PackageId).targets" />
+    </ItemGroup>
+  </Target>
+</Project>

From 451375cc2032f35bd9a4602bdfe309e2f3c7e9aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:18:59 +0800
Subject: [PATCH 06/35] Delete
 binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj

---
 .../SkiaSharp.NativeAssets.Linux.csproj       | 29 -------------------
 1 file changed, 29 deletions(-)
 delete mode 100644 binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj

diff --git a/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj b/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj
deleted file mode 100644
index edfd8d4033..0000000000
--- a/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj
+++ /dev/null
@@ -1,29 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
-    <PackagingGroup>SkiaSharp</PackagingGroup>
-    <Title>$(PackagingGroup) - Native Assets for Linux</Title>
-  </PropertyGroup>
-  <ItemGroup>
-    <!-- glibc -->
-    <PackageFile Include="..\..\output\native\linux\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\linux\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
-    <!-- Musl -->
-    <PackageFile Include="..\..\output\native\alpine\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
-    <PackageFile Include="..\..\output\native\alpine\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
-  </ItemGroup>
-  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
-    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
-      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
-      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="build\$(NuGetShortFolderName)\$(PackageId).targets" />
-    </ItemGroup>
-  </Target>
-</Project>

From 144e3dc11621e45a3ef0994f83bc2afdb86288cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:20:36 +0800
Subject: [PATCH 07/35] Create SkiaSharp.NativeAssets.Linux.csproj

---
 .../SkiaSharp.NativeAssets.Linux.csproj       | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj

diff --git a/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj b/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj
new file mode 100644
index 0000000000..1555c37d87
--- /dev/null
+++ b/binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj
@@ -0,0 +1,29 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFrameworks>$(BasicTargetFrameworks)</TargetFrameworks>
+    <PackagingGroup>SkiaSharp</PackagingGroup>
+    <Title>$(PackagingGroup) - Native Assets for Linux</Title>
+  </PropertyGroup>
+  <ItemGroup>
+    <!-- glibc -->
+    <PackageFile Include="..\..\output\native\linux\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\linux\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
+    <!-- Musl -->
+    <PackageFile Include="..\..\output\native\alpine\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
+    <PackageFile Include="..\..\output\native\alpine\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
+  </ItemGroup>
+  <Target Name="IncludeAdditionalTfmSpecificPackageFiles">
+    <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
+      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
+      <TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="build\$(NuGetShortFolderName)\$(PackageId).targets" />
+    </ItemGroup>
+  </Target>
+</Project>

From 018d6b4c3ced26e0f7781c4eb28abb0a8dcce1cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:23:40 +0800
Subject: [PATCH 08/35] Update _clang-cross-common.sh

---
 scripts/Docker/_clang-cross-common.sh | 54 +++++++++++++--------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/scripts/Docker/_clang-cross-common.sh b/scripts/Docker/_clang-cross-common.sh
index f5135ba2c1..cad0b6c535 100755
--- a/scripts/Docker/_clang-cross-common.sh
+++ b/scripts/Docker/_clang-cross-common.sh
@@ -1,43 +1,43 @@
 #!/usr/bin/env bash
 set -ex
 
+# Parameters:
+# $1 - The directory containing the Dockerfile  [ clang-cross/10 | clang-cross ]
+# $2 - The target architecture to build for     [ arm | arm64 | riscv64 | x86 | x64 | loongarch64 ]
+# $3 - The ABI                                  [ gnu | musl ]
+# $4 - The variant                              [ "" | alpine ]
+
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+
+# the directory containing the Dockerfile
 DOCKER_DIR="$1"
 
 # the target architecture to build for
-ARCH="${2:-arm}"
+ARCH="$2"
 
 # the docker image architecture to use
 MACHINE_ARCH="$(uname -m)"
-[ "$MACHINE_ARCH" = "arm64" ] && MACHINE_ARCH=aarch64
-IMAGE_ARCH="${3:-$([[ "$MACHINE_ARCH" == "aarch64" ]] && echo "arm64v8" || echo "amd64")}"
-
-DISTRO_VERSION=$4
-ABI=$5
-VENDOR=$6
-
-case $ARCH in
-  arm)           TOOLCHAIN_ARCH=arm$VENDOR-linux-${ABI}eabihf     ; TOOLCHAIN_ARCH_SHORT=armhf     ; TARGET_MACHINE_ARCH=armhf       ;;
-  arm64)         TOOLCHAIN_ARCH=aarch64$VENDOR-linux-$ABI         ; TOOLCHAIN_ARCH_SHORT=arm64     ; TARGET_MACHINE_ARCH=aarch64     ;;
-  loongarch64)   TOOLCHAIN_ARCH=loongarch64$VENDOR-linux-$ABI     ; TOOLCHAIN_ARCH_SHORT=loong64   ; TARGET_MACHINE_ARCH=loongarch64 ;;
-  riscv64)       TOOLCHAIN_ARCH=riscv64$VENDOR-linux-$ABI         ; TOOLCHAIN_ARCH_SHORT=riscv64   ; TARGET_MACHINE_ARCH=riscv64     ;;
-  x86)           TOOLCHAIN_ARCH=i686$VENDOR-linux-$ABI            ; TOOLCHAIN_ARCH_SHORT=i386      ; TARGET_MACHINE_ARCH=x86         ;;
-  x64)           TOOLCHAIN_ARCH=x86-64$VENDOR-linux-$ABI          ; TOOLCHAIN_ARCH_SHORT=amd64     ; TARGET_MACHINE_ARCH=x86_64      ;;
-  *) echo "Unsupported architecture: $ARCH" && exit 1 ;;
+case $MACHINE_ARCH in
+  arm64) IMAGE_ARCH=arm64v8 ; MACHINE_ARCH=aarch64 ;;
+  *)     IMAGE_ARCH=amd64   ;;
 esac
 
-(cd $DIR && docker build --tag skiasharp-linux-$ABI-cross-$ARCH \
-    --build-arg TOOLCHAIN_ARCH=$TOOLCHAIN_ARCH                  \
-    --build-arg TOOLCHAIN_ARCH_SHORT=$TOOLCHAIN_ARCH_SHORT      \
-    --build-arg IMAGE_ARCH=$IMAGE_ARCH                          \
-    --build-arg MACHINE_ARCH=$MACHINE_ARCH                      \
-    --build-arg TARGET_MACHINE_ARCH=$TARGET_MACHINE_ARCH        \
-    --build-arg DISTRO_VERSION=$DISTRO_VERSION                  \
+# the ABI
+ABI=$3
+
+# the variant
+VARIANT=$4
+
+(cd $DIR && 
+  docker build --tag skiasharp-linux-$ABI-cross-$ARCH \
+    --build-arg BUILD_ARCH=$ARCH                      \
+    --build-arg IMAGE_ARCH=$IMAGE_ARCH                \
+    --build-arg MACHINE_ARCH=$MACHINE_ARCH            \
     $DOCKER_DIR)
 
-if [ "$VENDOR" = "-alpine" ]; then vendor=alpine; fi
+[ -n "$VARIANT" ] && VARIANT="--variant=$VARIANT"
 
 (cd $DIR/../.. && 
-    docker run --rm --name skiasharp-linux-$ABI-cross-$ARCH --volume $(pwd):/work skiasharp-linux-$ABI-cross-$ARCH /bin/bash -c "\
-        dotnet tool restore &&
-        dotnet cake --target=externals-linux-clang-cross --configuration=Release --buildarch=$ARCH --variant=$vendor")
+    docker run --rm --name skiasharp-linux-$ABI-cross-$ARCH --volume $(pwd):/work skiasharp-linux-$ABI-cross-$ARCH /bin/bash -c " \
+        dotnet tool restore ; \
+        dotnet cake --target=externals-linux-clang-cross --configuration=Release --buildarch=$ARCH $VARIANT ")

From e0fac5c7deebead81f23f623682ad7cc9760779c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:31:26 +0800
Subject: [PATCH 09/35] Update Dockerfile

---
 scripts/Docker/alpine/clang-cross/Dockerfile | 66 ++++++++++++++------
 1 file changed, 47 insertions(+), 19 deletions(-)

diff --git a/scripts/Docker/alpine/clang-cross/Dockerfile b/scripts/Docker/alpine/clang-cross/Dockerfile
index f302196e96..95e29b26e8 100644
--- a/scripts/Docker/alpine/clang-cross/Dockerfile
+++ b/scripts/Docker/alpine/clang-cross/Dockerfile
@@ -1,44 +1,68 @@
 # Arguments:
 #   IMAGE_ARCH           - the architecture of the image                    [ amd64 | arm64v8 | riscv64 | loongarch64 ]
-#   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 9.0 | * ]
+#   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 8.0 | * ]
+#   LLVM_VERSION         - the version of the LLVM compiler                 [ 13 | * ]
 #   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 14 | * ]
 #   TOOLCHAIN_ARCH       - the architecture of the GCC toolchain            [ arm-alpine-linux-musleabihf | aarch64-alpine-linux-musl | riscv64-alpine-linux-musl | loongarch64-alpine-linux-musl ]
-#   TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 | loong64 ]
-#   FONTCONFIG_VERSION   - the exact version of libfontconfig1 to use       [ 2.13.1-2 | * ]
 
 ARG IMAGE_ARCH=amd64
 FROM ${IMAGE_ARCH}/debian:12
 
+# Set the architecture-specific variables based on the value of the BUILD_ARCH argument
+ARG BUILD_ARCH=arm64
+RUN case ${BUILD_ARCH} in \
+        arm)         TOOLCHAIN_ARCH=armv7-alpine-linux-musleabihf     ; TOOLCHAIN_ARCH_TARGET=armv7-alpine-linux-musleabihf     ;; \
+        arm64)       TOOLCHAIN_ARCH=aarch64-alpine-linux-musl         ; TOOLCHAIN_ARCH_TARGET=aarch64-alpine-linux-musl         ;; \
+        loongarch64) TOOLCHAIN_ARCH=loongarch64-alpine-linux-musl     ; TOOLCHAIN_ARCH_TARGET=loongarch64-alpine-linux-musl     ;; \
+        riscv64)     TOOLCHAIN_ARCH=riscv64-alpine-linux-musl         ; TOOLCHAIN_ARCH_TARGET=riscv64-alpine-linux-musl         ;; \
+        x86)         TOOLCHAIN_ARCH=i586-alpine-linux-musl            ; TOOLCHAIN_ARCH_TARGET=i586-alpine-linux-musl            ;; \
+        x64)         TOOLCHAIN_ARCH=x86_64-alpine-linux-musl          ; TOOLCHAIN_ARCH_TARGET=x86_64-alpine-linux-musl          ;; \
+        *) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
+    esac \
+    && echo "export TOOLCHAIN_ARCH=${TOOLCHAIN_ARCH}" > /etc/skia-env \
+    && echo "export TOOLCHAIN_ARCH_TARGET=${TOOLCHAIN_ARCH_TARGET}" >> /etc/skia-env
+
 # Install the required packages
+ARG LLVM_VERSION=19
 RUN apt-get update \
     && apt-get install -y \
-        curl python3 git clang-19 lld-19 ninja-build xz-utils curl \
+        curl python3 git clang-${LLVM_VERSION} lld-${LLVM_VERSION} ninja-build xz-utils \
     && rm -rf /var/lib/apt/lists/*
 
 # Install the cross-compilation musl toolchain
-ARG DISTRO_VERSION=3.17
-ARG TOOLCHAIN_ARCH_SHORT=armhf
+# First, obtain apk.static from https://gitlab.alpinelinux.org/alpine/apk-tools/-/releases/v2.12.14
 ARG MACHINE_ARCH=x86_64
-ARG TARGET_MACHINE_ARCH=armhf
-
-# obtain apk.static from gitlab.alpinelinux.org/alpine/apk-tools/-/releases/v2.14.6
-# apk.static for loongarch64 can be download in http://dl-cdn.alpinelinux.org/alpine/v3.21/main/loongarch64/apk-tools-static-2.14.6-r3.apk.
-RUN APK_DIR="$(mktemp -d)" && \
-    curl -SLO --create-dirs --output-dir "$APK_DIR" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.6/$MACHINE_ARCH/apk.static" && \
-    chmod +x "$APK_DIR/apk.static" && \
-    "$APK_DIR/apk.static" \
+RUN . /etc/skia-env \
+    && case "${BUILD_ARCH}" in \
+         arm)           APK_ARCH=armv7       ;; \
+         arm64)         APK_ARCH=aarch64     ;; \
+         loongarch64)   APK_ARCH=loongarch64 ;; \
+         riscv64)       APK_ARCH=riscv64     ;; \
+         x86)           APK_ARCH=x86         ;; \
+         x64)           APK_ARCH=x86_64      ;; \
+         *) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
+         esac \
+    && case "${BUILD_ARCH}" in \
+         loongarch64) DISTRO_VERSION=3.21 ;; \
+         riscv64)     DISTRO_VERSION=3.20 ;; \
+         *)           DISTRO_VERSION=3.17 ;; \
+         esac \
+    && APK_DIR="$(mktemp -d)" \
+    && curl -SLO --create-dirs --output-dir "$APK_DIR" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.12.14/$MACHINE_ARCH/apk.static" \
+    && chmod +x "$APK_DIR/apk.static" \
+    && "$APK_DIR/apk.static" \
         -X "http://dl-cdn.alpinelinux.org/alpine/v$DISTRO_VERSION/main" \
         -X "http://dl-cdn.alpinelinux.org/alpine/v$DISTRO_VERSION/community" \
-        -U --allow-untrusted --root /alpine --arch "$TARGET_MACHINE_ARCH" --initdb add && \
-    "$APK_DIR/apk.static" \
+        -U --allow-untrusted --root /alpine --arch "$APK_ARCH" --initdb add \
+    && "$APK_DIR/apk.static" \
         -X "http://dl-cdn.alpinelinux.org/alpine/v$DISTRO_VERSION/main" \
         -X "http://dl-cdn.alpinelinux.org/alpine/v$DISTRO_VERSION/community" \
-        -U --allow-untrusted --root /alpine --arch "$TARGET_MACHINE_ARCH" --no-scripts \
+        -U --allow-untrusted --root /alpine --arch "$APK_ARCH" --no-scripts \
         add fontconfig-dev build-base linux-headers
 
 # Install the .NET SDK
 ARG DOTNET_SDK_VERSION=8.0
-ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1
+ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
 RUN curl https://dot.net/v1/dotnet-install.sh -L -o dotnet-install.sh \
     && bash dotnet-install.sh --channel ${DOTNET_SDK_VERSION} --install-dir /usr/share/dotnet --verbose \
     && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
@@ -46,6 +70,10 @@ RUN curl https://dot.net/v1/dotnet-install.sh -L -o dotnet-install.sh \
     && dotnet help \
     && dotnet --info
 
-ENV CC=clang-19 CXX=clang++-19
+ENV CC=clang-${LLVM_VERSION} CXX=clang++-${LLVM_VERSION}
 
 WORKDIR /work
+
+COPY ./startup.sh /
+RUN chmod +x /startup.sh
+ENTRYPOINT [ "/startup.sh" ]

From 5bc0ec74ae6507d9758313249affcd4e208e9aa9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:33:38 +0800
Subject: [PATCH 10/35] Update build-local.sh

---
 scripts/Docker/alpine/clang-cross/build-local.sh | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/scripts/Docker/alpine/clang-cross/build-local.sh b/scripts/Docker/alpine/clang-cross/build-local.sh
index 4c73ad7ff9..88ba2c33bf 100755
--- a/scripts/Docker/alpine/clang-cross/build-local.sh
+++ b/scripts/Docker/alpine/clang-cross/build-local.sh
@@ -1,16 +1,11 @@
 #!/usr/bin/env bash
 set -ex
 
+# Parameters:
+# $1 - The target architecture to build for     [ arm | arm64 | riscv64 | x86 | x64 | loongarch64 ]
+
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 
-ARCH=$1
-ALPINE_VERSION=$3
-if [ -z "$ALPINE_VERSION" ]; then
-  case $ARCH in
-    loongarch64) ALPINE_VERSION=3.21 ;;
-    riscv64) ALPINE_VERSION=3.20     ;;
-    *) ALPINE_VERSION=3.17           ;;
-  esac
-fi
+ARCH="${1:-arm}"
 
-$DIR/../../_clang-cross-common.sh "$DIR" "$ARCH" "$2" "$ALPINE_VERSION" "musl" "-alpine"
+$DIR/../../_clang-cross-common.sh "$DIR" "$ARCH" "musl" "alpine"

From 7812abde492969e88cb906450544f2e069135e3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:36:18 +0800
Subject: [PATCH 11/35] Update build-local.sh

---
 .../Docker/debian/clang-cross/build-local.sh   | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/scripts/Docker/debian/clang-cross/build-local.sh b/scripts/Docker/debian/clang-cross/build-local.sh
index c7983a87e0..caeb8c661c 100644
--- a/scripts/Docker/debian/clang-cross/build-local.sh
+++ b/scripts/Docker/debian/clang-cross/build-local.sh
@@ -1,17 +1,13 @@
 #!/usr/bin/env bash
 set -ex
 
+# Parameters:
+# $1 - The target architecture to build for     [ arm | arm64 | riscv64 | x86 | x64 | loongarch64 ]
+# $2 - The Debian distro version                [ 10 | 12 | 13(Loongnix 25) ]
+
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 
-# the target architecture to build for
-ARCH=$1
-DEBIAN_VERSION=$3
-if [ -z "$DEBIAN_VERSION" ]; then
-  case $ARCH in
-    loongarch64) DEBIAN_VERSION=13 ;;
-    riscv64) DEBIAN_VERSION=12     ;;
-    *) DEBIAN_VERSION=11           ;;
-  esac
-fi
+ARCH="${1:-arm}"
+DEBIAN_VERSION="${2:-10}"
 
-$DIR/../../_clang-cross-common.sh "$DIR/$DEBIAN_VERSION" "$ARCH" "$2" "$DEBIAN_VERSION" "gnu"
+$DIR/../../_clang-cross-common.sh "$DIR/$DEBIAN_VERSION" "$ARCH" "gnu"

From 28b79a06f53f0678354cba1b0737941af2928b91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:41:33 +0800
Subject: [PATCH 12/35] azure-templates-stages.yml:updated to add loong

---
 scripts/azure-templates-stages.yml | 68 ++++++------------------------
 1 file changed, 13 insertions(+), 55 deletions(-)

diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index c409a58f49..f73e3424b6 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -362,39 +362,15 @@ stages:
             matrix:
               - arch: x64
                 docker: scripts/Docker/debian/amd64
-              - arch: x64
-                variant: alpine
-                docker: scripts/Docker/alpine/amd64
-              - arch: arm
-                docker: scripts/Docker/debian/clang-cross/11
-                target: externals-linux-clang-cross
-              - arch: arm64
-                docker: scripts/Docker/debian/clang-cross/11
-                dockerArgs: --build-arg TOOLCHAIN_ARCH=aarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=arm64
-                target: externals-linux-clang-cross
-              - arch: riscv64
-                docker: scripts/Docker/debian/clang-cross/12
-                dockerArgs: --build-arg TOOLCHAIN_ARCH=riscv64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=riscv64 --build-arg DISTRO_VERSION=12
-                target: externals-linux-clang-cross
-              - arch: arm64
-                variant: alpine
-                docker: scripts/Docker/alpine/clang-cross
-                dockerArgs: --build-arg TOOLCHAIN_ARCH=aarch64-alpine-linux-musl --build-arg TOOLCHAIN_ARCH_SHORT=arm64 --build-arg TARGET_MACHINE_ARCH=aarch64
-                target: externals-linux-clang-cross
-              - arch: riscv64
-                variant: alpine
-                docker: scripts/Docker/alpine/clang-cross
-                dockerArgs: --build-arg TOOLCHAIN_ARCH=riscv64-alpine-linux-musl --build-arg TOOLCHAIN_ARCH_SHORT=riscv64 --build-arg TARGET_MACHINE_ARCH=riscv64 --build-arg DISTRO_VERSION=3.20
-                target: externals-linux-clang-cross
-              - arch: loongarch64
-                docker: scripts/Docker/debian/clang-cross/13
-                dockerArgs: --build-arg TOOLCHAIN_ARCH=loongarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=loong64
-                target: externals-linux-clang-cross
-              - arch: loongarch64
-                variant: alpine
-                docker: scripts/Docker/alpine/clang-cross
-                dockerArgs: --build-arg TOOLCHAIN_ARCH=loongarch64-alpine-linux-musl --build-arg TOOLCHAIN_ARCH_SHORT=loong64 --build-arg TARGET_MACHINE_ARCH=loongarch64 --build-arg DISTRO_VERSION=3.21
-                target: externals-linux-clang-cross
+              - ${{ each arch in split('arm,arm64,x86,riscv64,loongarch64,loong64', ',') }}: # separate x64 as it fails when cross-compiling
+                - arch: ${{ arch }}
+                  docker: scripts/Docker/debian/clang-cross/10
+                  target: externals-linux-clang-cross
+              - ${{ each arch in split('arm,arm64,x64,riscv64,loongarch64,loong64', ',') }}: # removed x86 as it is having issues building
+                - arch: ${{ arch }}
+                  variant: alpine
+                  docker: scripts/Docker/alpine/clang-cross
+                  target: externals-linux-clang-cross
         - template: /scripts/azure-templates-bootstrapper.yml@self # Build Native Tizen (Linux)
           parameters:
             name: native_tizen_linux
@@ -541,6 +517,8 @@ stages:
               - name: native_linux_arm64_alpine_nodeps_linux
               - name: native_linux_arm64_linux
               - name: native_linux_arm64_nodeps_linux
+              - name: native_linux_arm_alpine_linux
+              - name: native_linux_arm_alpine_nodeps_linux
               - name: native_linux_arm_linux
               - name: native_linux_arm_nodeps_linux
               - name: native_linux_loongarch64_alpine_linux
@@ -555,6 +533,8 @@ stages:
               - name: native_linux_x64_alpine_nodeps_linux
               - name: native_linux_x64_linux
               - name: native_linux_x64_nodeps_linux
+              - name: native_linux_x86_linux
+              - name: native_linux_x86_nodeps_linux
               # WASM
               - name: native_wasm_2_0_23_linux
               - name: native_wasm_2_0_6_linux
@@ -585,26 +565,6 @@ stages:
             buildPipelineType: ${{ parameters.buildPipelineType }}
             buildAgent: ${{ parameters.buildAgentHost }}
             requiredArtifacts:
-              # Linux
-              - name: native_linux_arm64_linux
-              - name: native_linux_arm64_nodeps_linux
-              - name: native_linux_arm64_alpine_linux
-              - name: native_linux_arm64_alpine_nodeps_linux
-              - name: native_linux_arm_linux
-              - name: native_linux_arm_nodeps_linux
-              - name: native_linux_loongarch64_alpine_linux
-              - name: native_linux_loongarch64_alpine_nodeps_linux
-              - name: native_linux_loongarch64_linux
-              - name: native_linux_loongarch64_nodeps_linux
-              - name: native_linux_riscv64_alpine_linux
-              - name: native_linux_riscv64_alpine_nodeps_linux
-              - name: native_linux_riscv64_linux
-              - name: native_linux_riscv64_nodeps_linux
-              - name: native_linux_x64_alpine_linux
-              - name: native_linux_x64_alpine_nodeps_linux
-              - name: native_linux_x64_linux
-              - name: native_linux_x64_nodeps_linux
-              # WASM
               - name: native_wasm_2_0_23_linux
               - name: native_wasm_2_0_6_linux
               - name: native_wasm_3_1_12_linux
@@ -927,8 +887,6 @@ stages:
             requiredArtifacts:
               - name: native_linux_x64_linux
               - name: native_linux_arm64_linux
-              - name: native_linux_riscv64_linux
-              - name: native_linux_loongarch64_linux
             postBuildSteps:
               - task: PublishTestResults@2
                 displayName: Publish the .NET Core test results

From 2d786bef2412dd99bbaacbb59489222cdda8083e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 02:59:58 +0800
Subject: [PATCH 13/35] azure-templates-stages.yml:LoongArch64

---
 scripts/azure-templates-stages.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index f73e3424b6..5e8a32cc7d 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -362,11 +362,11 @@ stages:
             matrix:
               - arch: x64
                 docker: scripts/Docker/debian/amd64
-              - ${{ each arch in split('arm,arm64,x86,riscv64,loongarch64,loong64', ',') }}: # separate x64 as it fails when cross-compiling
+              - ${{ each arch in split('arm,arm64,x86,riscv64,loongarch64', ',') }}: # separate x64 as it fails when cross-compiling
                 - arch: ${{ arch }}
                   docker: scripts/Docker/debian/clang-cross/10
                   target: externals-linux-clang-cross
-              - ${{ each arch in split('arm,arm64,x64,riscv64,loongarch64,loong64', ',') }}: # removed x86 as it is having issues building
+              - ${{ each arch in split('arm,arm64,x64,riscv64,loongarch64', ',') }}: # removed x86 as it is having issues building
                 - arch: ${{ arch }}
                   variant: alpine
                   docker: scripts/Docker/alpine/clang-cross

From 6a4e95e77c737813dffb301b7ddc770362bef913 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 11:41:06 +0800
Subject: [PATCH 14/35] Dockerfile:Changed to trixie docker and back to gcc13

---
 .../Docker/debian/clang-cross/13/Dockerfile   | 81 ++++++++++++-------
 1 file changed, 51 insertions(+), 30 deletions(-)

diff --git a/scripts/Docker/debian/clang-cross/13/Dockerfile b/scripts/Docker/debian/clang-cross/13/Dockerfile
index 76a1789269..52946f46f6 100644
--- a/scripts/Docker/debian/clang-cross/13/Dockerfile
+++ b/scripts/Docker/debian/clang-cross/13/Dockerfile
@@ -1,25 +1,40 @@
 # Arguments:
 #   IMAGE_ARCH           - the architecture of the image                    [ amd64 | arm64v8 | riscv64 | loongarch64 ]
-#   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 9.0 | * ]
-#   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 14 | * ]
+#   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 8.0 | * ]
+#   LLVM_VERSION         - the version of the LLVM compiler                 [ 19 | * ]
+#   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 13 | * ]
 #   TOOLCHAIN_ARCH       - the architecture of the GCC toolchain            [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu | loongarch64-linux-gnu ]
-#   TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | loong64 ]
-#   FONTCONFIG_VERSION   - the exact version of libfontconfig1 to use       [ 2.15.0-1 | * ]
+#   TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 | loong64 ]
 
 ARG IMAGE_ARCH=amd64
-FROM ${IMAGE_ARCH}/debian:12
+FROM ${IMAGE_ARCH}/debian:trixie
 
-# Install the required packages (needs to add ftp.debian.org source)
+# Set the architecture-specific variables based on the value of the BUILD_ARCH argument
+ARG BUILD_ARCH=arm64
+RUN case ${BUILD_ARCH} in \
+        arm)         TOOLCHAIN_ARCH=arm-linux-gnueabihf       ; TOOLCHAIN_ARCH_SHORT=armhf   ; TOOLCHAIN_ARCH_TARGET=armv7a-linux-gnueabihf     ;; \
+        arm64)       TOOLCHAIN_ARCH=aarch64-linux-gnu         ; TOOLCHAIN_ARCH_SHORT=arm64   ; TOOLCHAIN_ARCH_TARGET=aarch64-linux-gnu          ;; \
+        loongarch64) TOOLCHAIN_ARCH=loongarch64-linux-gnu     ; TOOLCHAIN_ARCH_SHORT=loong64 ; TOOLCHAIN_ARCH_TARGET=loongarch64-linux-gnu      ;; \
+        riscv64)     TOOLCHAIN_ARCH=riscv64-linux-gnu         ; TOOLCHAIN_ARCH_SHORT=riscv64 ; TOOLCHAIN_ARCH_TARGET=riscv64-linux-gnu          ;; \
+        x86)         TOOLCHAIN_ARCH=i686-linux-gnu            ; TOOLCHAIN_ARCH_SHORT=i386    ; TOOLCHAIN_ARCH_TARGET=i686-linux-gnu             ;; \
+        x64)         TOOLCHAIN_ARCH=x86-64-linux-gnu          ; TOOLCHAIN_ARCH_SHORT=amd64   ; TOOLCHAIN_ARCH_TARGET=x86_64-linux-gnu           ;; \
+        *) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
+    esac \
+    && echo "export TOOLCHAIN_ARCH=${TOOLCHAIN_ARCH}" > /etc/skia-env \
+    && echo "export TOOLCHAIN_ARCH_SHORT=${TOOLCHAIN_ARCH_SHORT}" >> /etc/skia-env \
+    && echo "export TOOLCHAIN_ARCH_TARGET=${TOOLCHAIN_ARCH_TARGET}" >> /etc/skia-env
+
+# Install the required packages
+ARG LLVM_VERSION=19
 RUN apt-get update \
     && apt-get install -y \
-        curl python3 git clang-19 ninja-build xz-utils \
+        curl python3 git clang-${LLVM_VERSION} ninja-build xz-utils \
     && rm -rf /var/lib/apt/lists/*
 
-# Install the cross-compilation GCC toolchain (loongarch64 use GCC cross ports)
-ARG TOOLCHAIN_VERSION=14
-ARG TOOLCHAIN_ARCH=loongarch64-linux-gnu
-ARG TOOLCHAIN_ARCH_SHORT=loong64
-RUN apt-get update \
+# Install the cross-compilation GCC toolchain
+ARG TOOLCHAIN_VERSION=13
+RUN . /etc/skia-env \
+    && apt-get update \
     && apt-get install -y \
        libstdc++-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
        libgcc-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
@@ -27,31 +42,33 @@ RUN apt-get update \
     && rm -rf /var/lib/apt/lists/*
 
 # Make the script more flexible and use "current" instead of the actual version
-RUN ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION} /usr/${TOOLCHAIN_ARCH}/include/c++/current \
-    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so || true \
+RUN . /etc/skia-env \
+    && TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
+    && ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION} /usr/${TOOLCHAIN_ARCH}/include/c++/current \
+    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so \
     && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so
 
 # Install the cross-compilation skia build dependencies (fontconfig)
-ARG FONTCONFIG_VERSION=2.15.0-1.1
-RUN (mkdir -p /skia-utils/libfontconfig1-dev \
-    && cd /skia-utils/libfontconfig1-dev \
-    && curl https://pkg.loongnix.cn/loongnix/25/pool/main/f/fontconfig/libfontconfig-dev_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig1-dev.deb \
-    && ar vx libfontconfig1-dev.deb \
+RUN . /etc/skia-env \
+    && mkdir -p /skia-utils/libfontconfig-dev \
+    && cd /skia-utils/libfontconfig-dev \
+    && APT_REPO=http://deb.debian.org/debian \
+    && case "${TOOLCHAIN_ARCH_SHORT}" in \
+         loong64) FC_VERSION=2.15.0-1.1 ; FC_PKG=libfontconfig-dev  ; APT_REPO=https://pkg.loongnix.cn/loongnix/25  ;; \
+         riscv64) FC_VERSION=2.15.0-2.1 ; FC_PKG=libfontconfig-dev  ;; \
+         *)       FC_VERSION=2.13.1-2   ; FC_PKG=libfontconfig1-dev ;; \
+       esac \
+    && curl ${APT_REPO}/pool/main/f/fontconfig/${FC_PKG}_${FC_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig-dev.deb \
+    && ar vx libfontconfig-dev.deb \
     && tar -xJvf data.tar.xz \
-    && rm libfontconfig1-dev.deb \
+    && rm libfontconfig-dev.deb \
+    && TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
     && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ \
-    && cp -R usr/include/* /usr/${TOOLCHAIN_ARCH}/include/ )
-RUN (mkdir -p /skia-utils/libfontconfig1 \
-    && cd /skia-utils/libfontconfig1 \
-    && curl https://pkg.loongnix.cn/loongnix/25/pool/main/f/fontconfig/libfontconfig1_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig1.deb \
-    && ar vx libfontconfig1.deb \
-    && tar -xJvf data.tar.xz \
-    && rm libfontconfig1.deb \
-    && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ )
+    && cp -R usr/include/* /usr/${TOOLCHAIN_ARCH}/include/
 
 # Install the .NET SDK
 ARG DOTNET_SDK_VERSION=8.0
-ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1
+ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
 RUN curl https://dot.net/v1/dotnet-install.sh -L -o dotnet-install.sh \
     && bash dotnet-install.sh --channel ${DOTNET_SDK_VERSION} --install-dir /usr/share/dotnet --verbose \
     && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
@@ -59,6 +76,10 @@ RUN curl https://dot.net/v1/dotnet-install.sh -L -o dotnet-install.sh \
     && dotnet help \
     && dotnet --info
 
-ENV CC=clang-19 CXX=clang++-19
+ENV CC=clang-${LLVM_VERSION} CXX=clang++-${LLVM_VERSION}
 
 WORKDIR /work
+
+COPY ./startup.sh /
+RUN chmod +x /startup.sh
+ENTRYPOINT [ "/startup.sh" ]

From f5348994ce7c68346d60298bb9e148fb5bd0a870 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 11:47:31 +0800
Subject: [PATCH 15/35] build-local.sh:update instruction

---
 scripts/Docker/debian/clang-cross/build-local.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/Docker/debian/clang-cross/build-local.sh b/scripts/Docker/debian/clang-cross/build-local.sh
index caeb8c661c..e4155cd9e6 100644
--- a/scripts/Docker/debian/clang-cross/build-local.sh
+++ b/scripts/Docker/debian/clang-cross/build-local.sh
@@ -3,7 +3,8 @@ set -ex
 
 # Parameters:
 # $1 - The target architecture to build for     [ arm | arm64 | riscv64 | x86 | x64 | loongarch64 ]
-# $2 - The Debian distro version                [ 10 | 12 | 13(Loongnix 25) ]
+# $2 - The Debian distro version                [ 10 | 12 | 13 ]
+# LoongArch needs to get the packages from loongnix25
 
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 

From a4c53a11604d52efb949ffbc88925edd187d4f3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 11:52:01 +0800
Subject: [PATCH 16/35] azure-templates-stages.yml:Fix loongarch64 build

---
 scripts/azure-templates-stages.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index 5e8a32cc7d..d5a5f5256f 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -362,7 +362,10 @@ stages:
             matrix:
               - arch: x64
                 docker: scripts/Docker/debian/amd64
-              - ${{ each arch in split('arm,arm64,x86,riscv64,loongarch64', ',') }}: # separate x64 as it fails when cross-compiling
+              - arch: loongarch64
+                docker: scripts/Docker/debian/clang-cross/13
+                target: externals-linux-clang-cross
+              - ${{ each arch in split('arm,arm64,x86,riscv64', ',') }}: # separate x64 as it fails when cross-compiling
                 - arch: ${{ arch }}
                   docker: scripts/Docker/debian/clang-cross/10
                   target: externals-linux-clang-cross

From cf0a58ad81ddcadc85cf33ed77e0cc817a9cf329 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 11:54:36 +0800
Subject: [PATCH 17/35] azure-templates-stages.yml:Fix loongarch64 build 2

---
 scripts/azure-templates-stages.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index d5a5f5256f..2789cdbc09 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -365,11 +365,15 @@ stages:
               - arch: loongarch64
                 docker: scripts/Docker/debian/clang-cross/13
                 target: externals-linux-clang-cross
+              - arch: loongarch64
+                variant: alpine
+                docker: scripts/Docker/alpine/clang-cross
+                target: externals-linux-clang-cross
               - ${{ each arch in split('arm,arm64,x86,riscv64', ',') }}: # separate x64 as it fails when cross-compiling
                 - arch: ${{ arch }}
                   docker: scripts/Docker/debian/clang-cross/10
                   target: externals-linux-clang-cross
-              - ${{ each arch in split('arm,arm64,x64,riscv64,loongarch64', ',') }}: # removed x86 as it is having issues building
+              - ${{ each arch in split('arm,arm64,x64,riscv64', ',') }}: # removed x86 as it is having issues building
                 - arch: ${{ arch }}
                   variant: alpine
                   docker: scripts/Docker/alpine/clang-cross

From 7f8dcd88a7119c35ab252391c83de081b14a9c50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 12:02:20 +0800
Subject: [PATCH 18/35] Create startup.sh

---
 scripts/Docker/debian/clang-cross/13/startup.sh | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 scripts/Docker/debian/clang-cross/13/startup.sh

diff --git a/scripts/Docker/debian/clang-cross/13/startup.sh b/scripts/Docker/debian/clang-cross/13/startup.sh
new file mode 100644
index 0000000000..512bb431bf
--- /dev/null
+++ b/scripts/Docker/debian/clang-cross/13/startup.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -e
+
+source /etc/skia-env
+
+exec "$@"

From 012f3ddf2388e2244b4757f0bf92af388eb1be36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 13:12:04 +0800
Subject: [PATCH 19/35] Dockerfile:changes libpthread.so to libpthread.so.0

---
 scripts/Docker/debian/clang-cross/13/Dockerfile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/Docker/debian/clang-cross/13/Dockerfile b/scripts/Docker/debian/clang-cross/13/Dockerfile
index 52946f46f6..712adabcf1 100644
--- a/scripts/Docker/debian/clang-cross/13/Dockerfile
+++ b/scripts/Docker/debian/clang-cross/13/Dockerfile
@@ -42,13 +42,15 @@ RUN . /etc/skia-env \
     && rm -rf /var/lib/apt/lists/*
 
 # Make the script more flexible and use "current" instead of the actual version
+# libpthread.so.0 for loong64 is in https://packages.debian.org/trixie/all/libc6-loong64-cross/filelist
 RUN . /etc/skia-env \
     && TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
     && ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION} /usr/${TOOLCHAIN_ARCH}/include/c++/current \
-    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so \
+    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so.0 \
     && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so
 
 # Install the cross-compilation skia build dependencies (fontconfig)
+# In order to compat Loongnix 25, LoongArch APT_REPO use loongnix 25 mirrors.
 RUN . /etc/skia-env \
     && mkdir -p /skia-utils/libfontconfig-dev \
     && cd /skia-utils/libfontconfig-dev \

From 4072be58417eaf109592f08deacecdb521287132 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 13:17:17 +0800
Subject: [PATCH 20/35] azure-templates-stages.yml:Revert because alpine
 official support loong

---
 scripts/azure-templates-stages.yml | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index 2789cdbc09..d5a5f5256f 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -365,15 +365,11 @@ stages:
               - arch: loongarch64
                 docker: scripts/Docker/debian/clang-cross/13
                 target: externals-linux-clang-cross
-              - arch: loongarch64
-                variant: alpine
-                docker: scripts/Docker/alpine/clang-cross
-                target: externals-linux-clang-cross
               - ${{ each arch in split('arm,arm64,x86,riscv64', ',') }}: # separate x64 as it fails when cross-compiling
                 - arch: ${{ arch }}
                   docker: scripts/Docker/debian/clang-cross/10
                   target: externals-linux-clang-cross
-              - ${{ each arch in split('arm,arm64,x64,riscv64', ',') }}: # removed x86 as it is having issues building
+              - ${{ each arch in split('arm,arm64,x64,riscv64,loongarch64', ',') }}: # removed x86 as it is having issues building
                 - arch: ${{ arch }}
                   variant: alpine
                   docker: scripts/Docker/alpine/clang-cross

From 49bcb75650b952d8f1dbe1f3ceeb0e2a0f50eaea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 14:16:30 +0800
Subject: [PATCH 21/35] Dockerfile:Back to GCC 14 to compat libc6-loong64-cross

---
 scripts/Docker/debian/clang-cross/13/Dockerfile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/Docker/debian/clang-cross/13/Dockerfile b/scripts/Docker/debian/clang-cross/13/Dockerfile
index 712adabcf1..c74acf954c 100644
--- a/scripts/Docker/debian/clang-cross/13/Dockerfile
+++ b/scripts/Docker/debian/clang-cross/13/Dockerfile
@@ -2,7 +2,7 @@
 #   IMAGE_ARCH           - the architecture of the image                    [ amd64 | arm64v8 | riscv64 | loongarch64 ]
 #   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 8.0 | * ]
 #   LLVM_VERSION         - the version of the LLVM compiler                 [ 19 | * ]
-#   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 13 | * ]
+#   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 14 | * ]
 #   TOOLCHAIN_ARCH       - the architecture of the GCC toolchain            [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu | loongarch64-linux-gnu ]
 #   TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 | loong64 ]
 
@@ -32,17 +32,18 @@ RUN apt-get update \
     && rm -rf /var/lib/apt/lists/*
 
 # Install the cross-compilation GCC toolchain
-ARG TOOLCHAIN_VERSION=13
+ARG TOOLCHAIN_VERSION=14
 RUN . /etc/skia-env \
     && apt-get update \
     && apt-get install -y \
+       libc6-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
        libstdc++-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
        libgcc-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
        binutils-${TOOLCHAIN_ARCH} \
     && rm -rf /var/lib/apt/lists/*
 
 # Make the script more flexible and use "current" instead of the actual version
-# libpthread.so.0 for loong64 is in https://packages.debian.org/trixie/all/libc6-loong64-cross/filelist
+# libpthread.so.0 for loong64 is in https://packages.debian.org/trixie/all/libc6-loong64-cross/filelist that use GCC 14 and Glibc 2.41 to programmed
 RUN . /etc/skia-env \
     && TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
     && ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION} /usr/${TOOLCHAIN_ARCH}/include/c++/current \

From 2abe60c5870f52fdddcb51ebb91f160e9c0493e7 Mon Sep 17 00:00:00 2001
From: Matthew Leibowitz <mattleibow@live.com>
Date: Mon, 24 Mar 2025 13:38:53 +0400
Subject: [PATCH 22/35] Update scripts/azure-templates-stages.yml

---
 scripts/azure-templates-stages.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index d5a5f5256f..c34c14af3e 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -365,6 +365,7 @@ stages:
               - arch: loongarch64
                 docker: scripts/Docker/debian/clang-cross/13
                 target: externals-linux-clang-cross
+                additionalArgs: --verifyGlibcMax=2.36
               - ${{ each arch in split('arm,arm64,x86,riscv64', ',') }}: # separate x64 as it fails when cross-compiling
                 - arch: ${{ arch }}
                   docker: scripts/Docker/debian/clang-cross/10

From 7c128961ae952d3ab3711c9f72c06a6bef77e97e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 18:04:07 +0800
Subject: [PATCH 23/35] 
 azure-templates-stages.yml:https://packages.debian.org/trixie/binutils-loongarch64-linux-gnu
 needs glibc at least 2.38

---
 scripts/azure-templates-stages.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index c34c14af3e..8a47256c53 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -365,7 +365,7 @@ stages:
               - arch: loongarch64
                 docker: scripts/Docker/debian/clang-cross/13
                 target: externals-linux-clang-cross
-                additionalArgs: --verifyGlibcMax=2.36
+                additionalArgs: --verifyGlibcMax=2.38
               - ${{ each arch in split('arm,arm64,x86,riscv64', ',') }}: # separate x64 as it fails when cross-compiling
                 - arch: ${{ arch }}
                   docker: scripts/Docker/debian/clang-cross/10

From 73b62c71883b79881b47cc3643b9cfc752fc2d4a Mon Sep 17 00:00:00 2001
From: Matthew Leibowitz <mattleibow@live.com>
Date: Mon, 24 Mar 2025 15:39:43 +0400
Subject: [PATCH 24/35] Update scripts/Docker/debian/clang-cross/13/Dockerfile

---
 scripts/Docker/debian/clang-cross/13/Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Docker/debian/clang-cross/13/Dockerfile b/scripts/Docker/debian/clang-cross/13/Dockerfile
index c74acf954c..82117ac81c 100644
--- a/scripts/Docker/debian/clang-cross/13/Dockerfile
+++ b/scripts/Docker/debian/clang-cross/13/Dockerfile
@@ -72,7 +72,7 @@ RUN . /etc/skia-env \
 # Install the .NET SDK
 ARG DOTNET_SDK_VERSION=8.0
 ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
-RUN curl https://dot.net/v1/dotnet-install.sh -L -o dotnet-install.sh \
+RUN curl https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh -L -o dotnet-install.sh \
     && bash dotnet-install.sh --channel ${DOTNET_SDK_VERSION} --install-dir /usr/share/dotnet --verbose \
     && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
     && rm dotnet-install.sh \

From bab37abda3a52a6424ceb0e5a2b855d1a712bcb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 20:49:43 +0800
Subject: [PATCH 25/35] Create deepin 23 Dockerfile for backup purposes

---
 .../Docker/deepin/clang-cross/23/Dockerfile   | 85 +++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 scripts/Docker/deepin/clang-cross/23/Dockerfile

diff --git a/scripts/Docker/deepin/clang-cross/23/Dockerfile b/scripts/Docker/deepin/clang-cross/23/Dockerfile
new file mode 100644
index 0000000000..d204c51d1b
--- /dev/null
+++ b/scripts/Docker/deepin/clang-cross/23/Dockerfile
@@ -0,0 +1,85 @@
+# Arguments:
+#   IMAGE_ARCH           - the architecture of the image                    [ amd64 | arm64v8 | riscv64 | loongarch64 ]
+#   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 8.0 | * ]
+#   LLVM_VERSION         - the version of the LLVM compiler                 [ 19 | * ]
+#   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 12 | * ]
+#   TOOLCHAIN_ARCH       - the architecture of the GCC toolchain            [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu | loongarch64-linux-gnu ]
+#   TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 | loong64 ]
+
+ARG IMAGE_ARCH=amd64
+FROM linuxdeepin/deepin:23
+
+# Set the architecture-specific variables based on the value of the BUILD_ARCH argument
+ARG BUILD_ARCH=arm64
+RUN case ${BUILD_ARCH} in \
+        arm)         TOOLCHAIN_ARCH=arm-linux-gnueabihf       ; TOOLCHAIN_ARCH_SHORT=armhf   ; TOOLCHAIN_ARCH_TARGET=armv7a-linux-gnueabihf     ;; \
+        arm64)       TOOLCHAIN_ARCH=aarch64-linux-gnu         ; TOOLCHAIN_ARCH_SHORT=arm64   ; TOOLCHAIN_ARCH_TARGET=aarch64-linux-gnu          ;; \
+        loongarch64) TOOLCHAIN_ARCH=loongarch64-linux-gnu     ; TOOLCHAIN_ARCH_SHORT=loong64 ; TOOLCHAIN_ARCH_TARGET=loongarch64-linux-gnu      ;; \
+        riscv64)     TOOLCHAIN_ARCH=riscv64-linux-gnu         ; TOOLCHAIN_ARCH_SHORT=riscv64 ; TOOLCHAIN_ARCH_TARGET=riscv64-linux-gnu          ;; \
+        x86)         TOOLCHAIN_ARCH=i686-linux-gnu            ; TOOLCHAIN_ARCH_SHORT=i386    ; TOOLCHAIN_ARCH_TARGET=i686-linux-gnu             ;; \
+        x64)         TOOLCHAIN_ARCH=x86-64-linux-gnu          ; TOOLCHAIN_ARCH_SHORT=amd64   ; TOOLCHAIN_ARCH_TARGET=x86_64-linux-gnu           ;; \
+        *) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
+    esac \
+    && echo "export TOOLCHAIN_ARCH=${TOOLCHAIN_ARCH}" > /etc/skia-env \
+    && echo "export TOOLCHAIN_ARCH_SHORT=${TOOLCHAIN_ARCH_SHORT}" >> /etc/skia-env \
+    && echo "export TOOLCHAIN_ARCH_TARGET=${TOOLCHAIN_ARCH_TARGET}" >> /etc/skia-env
+
+# Install the required packages
+ARG LLVM_VERSION=19
+RUN apt-get update \
+    && apt-get install -y \
+        curl python3 git clang-${LLVM_VERSION} ninja-build xz-utils \
+    && rm -rf /var/lib/apt/lists/*
+
+# Install the cross-compilation GCC toolchain
+ARG TOOLCHAIN_VERSION=12
+RUN . /etc/skia-env \
+    && apt-get update \
+    && apt-get install -y \
+       libc6-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
+       libstdc++-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
+       libgcc-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
+       binutils-${TOOLCHAIN_ARCH} \
+    && rm -rf /var/lib/apt/lists/*
+
+# Make the script more flexible and use "current" instead of the actual version
+# libpthread.so.0 for loong64 is in https://ci.deepin.com/repo/deepin/deepin-community/stable/pool/main/c/cross-toolchain-base
+RUN . /etc/skia-env \
+    && TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
+    && ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION} /usr/${TOOLCHAIN_ARCH}/include/c++/current \
+    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so.0 \
+    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so
+
+# Install the cross-compilation skia build dependencies (fontconfig)
+# In https://ci.deepin.com/repo/deepin/deepin-community/stable/pool/main/f/fontconfig
+RUN . /etc/skia-env \
+    && mkdir -p /skia-utils/libfontconfig-dev \
+    && cd /skia-utils/libfontconfig-dev \
+    && APT_REPO=http://deb.debian.org/debian \
+    && FC_VERSION=2.14.2-6
+    && FC_PKG=libfontconfig-dev
+    && curl https://ci.deepin.com/repo/deepin/deepin-community/stable/pool/main/f/fontconfig/${FC_PKG}_${FC_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig-dev.deb \
+    && ar vx libfontconfig-dev.deb \
+    && tar -xJvf data.tar.xz \
+    && rm libfontconfig-dev.deb \
+    && TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
+    && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ \
+    && cp -R usr/include/* /usr/${TOOLCHAIN_ARCH}/include/
+
+# Install the .NET SDK
+ARG DOTNET_SDK_VERSION=8.0
+ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
+RUN curl https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh -L -o dotnet-install.sh \
+    && bash dotnet-install.sh --channel ${DOTNET_SDK_VERSION} --install-dir /usr/share/dotnet --verbose \
+    && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
+    && rm dotnet-install.sh \
+    && dotnet help \
+    && dotnet --info
+
+ENV CC=clang-${LLVM_VERSION} CXX=clang++-${LLVM_VERSION}
+
+WORKDIR /work
+
+COPY ./startup.sh /
+RUN chmod +x /startup.sh
+ENTRYPOINT [ "/startup.sh" ]

From 0b5c745a396d2c5786fbde8dce2cdb9b63b1a85e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 20:53:49 +0800
Subject: [PATCH 26/35] Dockerfile:Use stable version LLVM 18

---
 scripts/Docker/deepin/clang-cross/23/Dockerfile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/Docker/deepin/clang-cross/23/Dockerfile b/scripts/Docker/deepin/clang-cross/23/Dockerfile
index d204c51d1b..3f342e9572 100644
--- a/scripts/Docker/deepin/clang-cross/23/Dockerfile
+++ b/scripts/Docker/deepin/clang-cross/23/Dockerfile
@@ -1,7 +1,7 @@
 # Arguments:
 #   IMAGE_ARCH           - the architecture of the image                    [ amd64 | arm64v8 | riscv64 | loongarch64 ]
 #   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 8.0 | * ]
-#   LLVM_VERSION         - the version of the LLVM compiler                 [ 19 | * ]
+#   LLVM_VERSION         - the version of the LLVM compiler                 [ 18 | * ]
 #   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 12 | * ]
 #   TOOLCHAIN_ARCH       - the architecture of the GCC toolchain            [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu | loongarch64-linux-gnu ]
 #   TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 | loong64 ]
@@ -25,7 +25,7 @@ RUN case ${BUILD_ARCH} in \
     && echo "export TOOLCHAIN_ARCH_TARGET=${TOOLCHAIN_ARCH_TARGET}" >> /etc/skia-env
 
 # Install the required packages
-ARG LLVM_VERSION=19
+ARG LLVM_VERSION=18
 RUN apt-get update \
     && apt-get install -y \
         curl python3 git clang-${LLVM_VERSION} ninja-build xz-utils \

From 7ea22af214aac5a1200d16259788ae8064afa537 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 21:12:58 +0800
Subject: [PATCH 27/35] Create startup.sh

---
 scripts/Docker/deepin/clang-cross/23/startup.sh | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 scripts/Docker/deepin/clang-cross/23/startup.sh

diff --git a/scripts/Docker/deepin/clang-cross/23/startup.sh b/scripts/Docker/deepin/clang-cross/23/startup.sh
new file mode 100644
index 0000000000..512bb431bf
--- /dev/null
+++ b/scripts/Docker/deepin/clang-cross/23/startup.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -e
+
+source /etc/skia-env
+
+exec "$@"

From 3eaea334e6195c5db7c55d8ad0b021ab065e8b71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 21:14:22 +0800
Subject: [PATCH 28/35] Create .dockerignore

---
 scripts/Docker/deepin/clang-cross/.dockerignore | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 scripts/Docker/deepin/clang-cross/.dockerignore

diff --git a/scripts/Docker/deepin/clang-cross/.dockerignore b/scripts/Docker/deepin/clang-cross/.dockerignore
new file mode 100644
index 0000000000..3a09fc21d8
--- /dev/null
+++ b/scripts/Docker/deepin/clang-cross/.dockerignore
@@ -0,0 +1 @@
+build-local.sh

From 43e52aa394fe516fe4f0855afd503cfca10eca5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 21:17:02 +0800
Subject: [PATCH 29/35] Create Deepin 23 build-local.sh

---
 scripts/Docker/deepin/clang-cross/build-local.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 scripts/Docker/deepin/clang-cross/build-local.sh

diff --git a/scripts/Docker/deepin/clang-cross/build-local.sh b/scripts/Docker/deepin/clang-cross/build-local.sh
new file mode 100644
index 0000000000..48b9d0ebbe
--- /dev/null
+++ b/scripts/Docker/deepin/clang-cross/build-local.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+set -ex
+
+# Parameters:
+# $1 - The target architecture to build for     [ arm | arm64 | riscv64 | x86 | x64 | loongarch64 ]
+# $2 - The Deepin distro version                [ 23 ]
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+
+ARCH="${1:-arm}"
+DEEPIN_VERSION="${2:-23}"
+
+$DIR/../../_clang-cross-common.sh "$DIR/$DEEPIN_VERSION" "$ARCH" "gnu"

From eed9a941ddcdabb4941bafc53d1d0eeaf9760b9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 21:20:04 +0800
Subject: [PATCH 30/35] azure-templates-stages.yml:Try to use deepin 23 to
 build

---
 scripts/azure-templates-stages.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index 8a47256c53..18a4c4f553 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -363,7 +363,7 @@ stages:
               - arch: x64
                 docker: scripts/Docker/debian/amd64
               - arch: loongarch64
-                docker: scripts/Docker/debian/clang-cross/13
+                docker: scripts/Docker/deepin/clang-cross/23
                 target: externals-linux-clang-cross
                 additionalArgs: --verifyGlibcMax=2.38
               - ${{ each arch in split('arm,arm64,x86,riscv64', ',') }}: # separate x64 as it fails when cross-compiling

From df36e4340dbc44ec32f26e9e2345ce36ad3b718d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 21:57:54 +0800
Subject: [PATCH 31/35] azure-templates-stages.yml:Revert to debian trixie

---
 scripts/azure-templates-stages.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml
index 18a4c4f553..8a47256c53 100644
--- a/scripts/azure-templates-stages.yml
+++ b/scripts/azure-templates-stages.yml
@@ -363,7 +363,7 @@ stages:
               - arch: x64
                 docker: scripts/Docker/debian/amd64
               - arch: loongarch64
-                docker: scripts/Docker/deepin/clang-cross/23
+                docker: scripts/Docker/debian/clang-cross/13
                 target: externals-linux-clang-cross
                 additionalArgs: --verifyGlibcMax=2.38
               - ${{ each arch in split('arm,arm64,x86,riscv64', ',') }}: # separate x64 as it fails when cross-compiling

From 281389fda085e4da5d09a2722fe9b97aa2fe987e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 22:01:12 +0800
Subject: [PATCH 32/35] Delete scripts/Docker/deepin/clang-cross/23/Dockerfile

---
 .../Docker/deepin/clang-cross/23/Dockerfile   | 85 -------------------
 1 file changed, 85 deletions(-)
 delete mode 100644 scripts/Docker/deepin/clang-cross/23/Dockerfile

diff --git a/scripts/Docker/deepin/clang-cross/23/Dockerfile b/scripts/Docker/deepin/clang-cross/23/Dockerfile
deleted file mode 100644
index 3f342e9572..0000000000
--- a/scripts/Docker/deepin/clang-cross/23/Dockerfile
+++ /dev/null
@@ -1,85 +0,0 @@
-# Arguments:
-#   IMAGE_ARCH           - the architecture of the image                    [ amd64 | arm64v8 | riscv64 | loongarch64 ]
-#   DOTNET_SDK_VERSION   - the version of dotnet for the Cake script        [ 8.0 | * ]
-#   LLVM_VERSION         - the version of the LLVM compiler                 [ 18 | * ]
-#   TOOLCHAIN_VERSION    - the version of the GCC toolchain                 [ 12 | * ]
-#   TOOLCHAIN_ARCH       - the architecture of the GCC toolchain            [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu | loongarch64-linux-gnu ]
-#   TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 | loong64 ]
-
-ARG IMAGE_ARCH=amd64
-FROM linuxdeepin/deepin:23
-
-# Set the architecture-specific variables based on the value of the BUILD_ARCH argument
-ARG BUILD_ARCH=arm64
-RUN case ${BUILD_ARCH} in \
-        arm)         TOOLCHAIN_ARCH=arm-linux-gnueabihf       ; TOOLCHAIN_ARCH_SHORT=armhf   ; TOOLCHAIN_ARCH_TARGET=armv7a-linux-gnueabihf     ;; \
-        arm64)       TOOLCHAIN_ARCH=aarch64-linux-gnu         ; TOOLCHAIN_ARCH_SHORT=arm64   ; TOOLCHAIN_ARCH_TARGET=aarch64-linux-gnu          ;; \
-        loongarch64) TOOLCHAIN_ARCH=loongarch64-linux-gnu     ; TOOLCHAIN_ARCH_SHORT=loong64 ; TOOLCHAIN_ARCH_TARGET=loongarch64-linux-gnu      ;; \
-        riscv64)     TOOLCHAIN_ARCH=riscv64-linux-gnu         ; TOOLCHAIN_ARCH_SHORT=riscv64 ; TOOLCHAIN_ARCH_TARGET=riscv64-linux-gnu          ;; \
-        x86)         TOOLCHAIN_ARCH=i686-linux-gnu            ; TOOLCHAIN_ARCH_SHORT=i386    ; TOOLCHAIN_ARCH_TARGET=i686-linux-gnu             ;; \
-        x64)         TOOLCHAIN_ARCH=x86-64-linux-gnu          ; TOOLCHAIN_ARCH_SHORT=amd64   ; TOOLCHAIN_ARCH_TARGET=x86_64-linux-gnu           ;; \
-        *) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
-    esac \
-    && echo "export TOOLCHAIN_ARCH=${TOOLCHAIN_ARCH}" > /etc/skia-env \
-    && echo "export TOOLCHAIN_ARCH_SHORT=${TOOLCHAIN_ARCH_SHORT}" >> /etc/skia-env \
-    && echo "export TOOLCHAIN_ARCH_TARGET=${TOOLCHAIN_ARCH_TARGET}" >> /etc/skia-env
-
-# Install the required packages
-ARG LLVM_VERSION=18
-RUN apt-get update \
-    && apt-get install -y \
-        curl python3 git clang-${LLVM_VERSION} ninja-build xz-utils \
-    && rm -rf /var/lib/apt/lists/*
-
-# Install the cross-compilation GCC toolchain
-ARG TOOLCHAIN_VERSION=12
-RUN . /etc/skia-env \
-    && apt-get update \
-    && apt-get install -y \
-       libc6-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
-       libstdc++-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
-       libgcc-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
-       binutils-${TOOLCHAIN_ARCH} \
-    && rm -rf /var/lib/apt/lists/*
-
-# Make the script more flexible and use "current" instead of the actual version
-# libpthread.so.0 for loong64 is in https://ci.deepin.com/repo/deepin/deepin-community/stable/pool/main/c/cross-toolchain-base
-RUN . /etc/skia-env \
-    && TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
-    && ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION} /usr/${TOOLCHAIN_ARCH}/include/c++/current \
-    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so.0 \
-    && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so
-
-# Install the cross-compilation skia build dependencies (fontconfig)
-# In https://ci.deepin.com/repo/deepin/deepin-community/stable/pool/main/f/fontconfig
-RUN . /etc/skia-env \
-    && mkdir -p /skia-utils/libfontconfig-dev \
-    && cd /skia-utils/libfontconfig-dev \
-    && APT_REPO=http://deb.debian.org/debian \
-    && FC_VERSION=2.14.2-6
-    && FC_PKG=libfontconfig-dev
-    && curl https://ci.deepin.com/repo/deepin/deepin-community/stable/pool/main/f/fontconfig/${FC_PKG}_${FC_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig-dev.deb \
-    && ar vx libfontconfig-dev.deb \
-    && tar -xJvf data.tar.xz \
-    && rm libfontconfig-dev.deb \
-    && TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
-    && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ \
-    && cp -R usr/include/* /usr/${TOOLCHAIN_ARCH}/include/
-
-# Install the .NET SDK
-ARG DOTNET_SDK_VERSION=8.0
-ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
-RUN curl https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh -L -o dotnet-install.sh \
-    && bash dotnet-install.sh --channel ${DOTNET_SDK_VERSION} --install-dir /usr/share/dotnet --verbose \
-    && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
-    && rm dotnet-install.sh \
-    && dotnet help \
-    && dotnet --info
-
-ENV CC=clang-${LLVM_VERSION} CXX=clang++-${LLVM_VERSION}
-
-WORKDIR /work
-
-COPY ./startup.sh /
-RUN chmod +x /startup.sh
-ENTRYPOINT [ "/startup.sh" ]

From 9c17cd197dfdaa732eee71fd4cdac2da9c97ed77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 22:03:35 +0800
Subject: [PATCH 33/35] Delete scripts/Docker/deepin/clang-cross/23/startup.sh

---
 scripts/Docker/deepin/clang-cross/23/startup.sh | 6 ------
 1 file changed, 6 deletions(-)
 delete mode 100644 scripts/Docker/deepin/clang-cross/23/startup.sh

diff --git a/scripts/Docker/deepin/clang-cross/23/startup.sh b/scripts/Docker/deepin/clang-cross/23/startup.sh
deleted file mode 100644
index 512bb431bf..0000000000
--- a/scripts/Docker/deepin/clang-cross/23/startup.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-source /etc/skia-env
-
-exec "$@"

From 2dc5921d67d7e182750bf54ef705f1ad3770699c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 22:03:46 +0800
Subject: [PATCH 34/35] Delete scripts/Docker/deepin/clang-cross/.dockerignore

---
 scripts/Docker/deepin/clang-cross/.dockerignore | 1 -
 1 file changed, 1 deletion(-)
 delete mode 100644 scripts/Docker/deepin/clang-cross/.dockerignore

diff --git a/scripts/Docker/deepin/clang-cross/.dockerignore b/scripts/Docker/deepin/clang-cross/.dockerignore
deleted file mode 100644
index 3a09fc21d8..0000000000
--- a/scripts/Docker/deepin/clang-cross/.dockerignore
+++ /dev/null
@@ -1 +0,0 @@
-build-local.sh

From 7303ccb9504d577072fe88830db858df294fb0f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B1=E9=9B=B2=E3=81=AA=E3=81=AE?=
 <87938880+4Darmygeometry@users.noreply.github.com>
Date: Mon, 24 Mar 2025 22:03:54 +0800
Subject: [PATCH 35/35] Delete scripts/Docker/deepin/clang-cross/build-local.sh

---
 scripts/Docker/deepin/clang-cross/build-local.sh | 13 -------------
 1 file changed, 13 deletions(-)
 delete mode 100644 scripts/Docker/deepin/clang-cross/build-local.sh

diff --git a/scripts/Docker/deepin/clang-cross/build-local.sh b/scripts/Docker/deepin/clang-cross/build-local.sh
deleted file mode 100644
index 48b9d0ebbe..0000000000
--- a/scripts/Docker/deepin/clang-cross/build-local.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-set -ex
-
-# Parameters:
-# $1 - The target architecture to build for     [ arm | arm64 | riscv64 | x86 | x64 | loongarch64 ]
-# $2 - The Deepin distro version                [ 23 ]
-
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
-
-ARCH="${1:-arm}"
-DEEPIN_VERSION="${2:-23}"
-
-$DIR/../../_clang-cross-common.sh "$DIR/$DEEPIN_VERSION" "$ARCH" "gnu"