Skip to content

Commit cefe0e6

Browse files
Add LoongArch64 build support (#3198)
* Add LoongArch64 build support * Delete binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj * Create HarfBuzzSharp.NativeAssets.Linux.csproj * Delete binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj * Create SkiaSharp.NativeAssets.Linux.NoDependencies.csproj * Delete binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj * Create SkiaSharp.NativeAssets.Linux.csproj * Update _clang-cross-common.sh * Update Dockerfile * Update build-local.sh * Update build-local.sh * azure-templates-stages.yml:updated to add loong * azure-templates-stages.yml:LoongArch64 * Dockerfile:Changed to trixie docker and back to gcc13 * build-local.sh:update instruction * azure-templates-stages.yml:Fix loongarch64 build * azure-templates-stages.yml:Fix loongarch64 build 2 * Create startup.sh * Dockerfile:changes libpthread.so to libpthread.so.0 * azure-templates-stages.yml:Revert because alpine official support loong * Dockerfile:Back to GCC 14 to compat libc6-loong64-cross * Update scripts/azure-templates-stages.yml * azure-templates-stages.yml:https://packages.debian.org/trixie/binutils-loongarch64-linux-gnu needs glibc at least 2.38 * Update scripts/Docker/debian/clang-cross/13/Dockerfile * Create deepin 23 Dockerfile for backup purposes * Dockerfile:Use stable version LLVM 18 * Create startup.sh * Create .dockerignore * Create Deepin 23 build-local.sh * azure-templates-stages.yml:Try to use deepin 23 to build * azure-templates-stages.yml:Revert to debian trixie * Delete scripts/Docker/deepin/clang-cross/23/Dockerfile * Delete scripts/Docker/deepin/clang-cross/23/startup.sh * Delete scripts/Docker/deepin/clang-cross/.dockerignore * Delete scripts/Docker/deepin/clang-cross/build-local.sh --------- Co-authored-by: Matthew Leibowitz <[email protected]>
1 parent 8597e16 commit cefe0e6

File tree

14 files changed

+154
-22
lines changed

14 files changed

+154
-22
lines changed

binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
<PackageFile Include="..\..\output\native\linux\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
1212
<PackageFile Include="..\..\output\native\linux\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
1313
<PackageFile Include="..\..\output\native\linux\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
14+
<PackageFile Include="..\..\output\native\linux\loongarch64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
1415
<!-- Musl -->
1516
<PackageFile Include="..\..\output\native\alpine\x64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
1617
<PackageFile Include="..\..\output\native\alpine\x86\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
1718
<PackageFile Include="..\..\output\native\alpine\arm64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
1819
<PackageFile Include="..\..\output\native\alpine\arm\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
1920
<PackageFile Include="..\..\output\native\alpine\riscv64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
21+
<PackageFile Include="..\..\output\native\alpine\loongarch64\libHarfBuzzSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
2022
</ItemGroup>
2123
<Target Name="IncludeAdditionalTfmSpecificPackageFiles">
2224
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">

binding/HarfBuzzSharp.NativeAssets.Linux/buildTransitive/net4/HarfBuzzSharp.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-riscv64\native\libHarfBuzzSharp*.so">
2626
<Dir>riscv64\</Dir>
2727
</_NativeHarfBuzzSharpFile>
28+
<_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-loongarch64\native\libHarfBuzzSharp*.so">
29+
<Dir>loongarch64\</Dir>
30+
</_NativeHarfBuzzSharpFile>
2831

2932
<!-- Musl -->
3033
<_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-x86\native\libHarfBuzzSharp*.so">
@@ -42,6 +45,9 @@
4245
<_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-riscv64\native\libHarfBuzzSharp*.so">
4346
<Dir>musl-riscv64\</Dir>
4447
</_NativeHarfBuzzSharpFile>
48+
<_NativeHarfBuzzSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-loongarch64\native\libHarfBuzzSharp*.so">
49+
<Dir>musl-loongarch64\</Dir>
50+
</_NativeHarfBuzzSharpFile>
4551

4652
<!-- include everything -->
4753
<Content Include="@(_NativeHarfBuzzSharpFile)">

binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ The excluded dependencies are:
2222
<PackageFile Include="..\..\output\native\linuxnodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
2323
<PackageFile Include="..\..\output\native\linuxnodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
2424
<PackageFile Include="..\..\output\native\linuxnodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
25+
<PackageFile Include="..\..\output\native\linuxnodeps\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
2526
<!-- Musl -->
2627
<PackageFile Include="..\..\output\native\alpinenodeps\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
2728
<PackageFile Include="..\..\output\native\alpinenodeps\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
2829
<PackageFile Include="..\..\output\native\alpinenodeps\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
2930
<PackageFile Include="..\..\output\native\alpinenodeps\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
3031
<PackageFile Include="..\..\output\native\alpinenodeps\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
32+
<PackageFile Include="..\..\output\native\alpinenodeps\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
3133
</ItemGroup>
3234
<Target Name="IncludeAdditionalTfmSpecificPackageFiles">
3335
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
3436
<TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="buildTransitive\$(NuGetShortFolderName)\$(PackageId).targets" />
3537
<TfmSpecificPackageFile Include="buildTransitive\net4\SkiaSharp.targets" PackagePath="build\$(NuGetShortFolderName)\$(PackageId).targets" />
3638
</ItemGroup>
3739
</Target>
38-
</Project>
40+
</Project>

binding/SkiaSharp.NativeAssets.Linux.NoDependencies/buildTransitive/net4/SkiaSharp.targets

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-riscv64\native\libSkiaSharp*.so">
2626
<Dir>riscv64\</Dir>
2727
</_NativeSkiaSharpFile>
28+
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-loongarch64\native\libSkiaSharp*.so">
29+
<Dir>loongarch64\</Dir>
30+
</_NativeSkiaSharpFile>
2831

2932
<!-- Musl -->
3033
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-x86\native\libSkiaSharp*.so">
@@ -42,6 +45,9 @@
4245
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-riscv64\native\libSkiaSharp*.so">
4346
<Dir>musl-riscv64\</Dir>
4447
</_NativeSkiaSharpFile>
48+
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-loongarch64\native\libSkiaSharp*.so">
49+
<Dir>musl-loongarch64\</Dir>
50+
</_NativeSkiaSharpFile>
4551

4652
<!-- include everything -->
4753
<Content Include="@(_NativeSkiaSharpFile)">
@@ -52,4 +58,4 @@
5258

5359
</ItemGroup>
5460

55-
</Project>
61+
</Project>

binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
<PackageFile Include="..\..\output\native\linux\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-arm64\native\%(Filename)%(Extension)" />
1212
<PackageFile Include="..\..\output\native\linux\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-arm\native\%(Filename)%(Extension)" />
1313
<PackageFile Include="..\..\output\native\linux\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-riscv64\native\%(Filename)%(Extension)" />
14+
<PackageFile Include="..\..\output\native\linux\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-loongarch64\native\%(Filename)%(Extension)" />
1415
<!-- Musl -->
1516
<PackageFile Include="..\..\output\native\alpine\x64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x64\native\%(Filename)%(Extension)" />
1617
<PackageFile Include="..\..\output\native\alpine\x86\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-x86\native\%(Filename)%(Extension)" />
1718
<PackageFile Include="..\..\output\native\alpine\arm64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm64\native\%(Filename)%(Extension)" />
1819
<PackageFile Include="..\..\output\native\alpine\arm\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-arm\native\%(Filename)%(Extension)" />
1920
<PackageFile Include="..\..\output\native\alpine\riscv64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-riscv64\native\%(Filename)%(Extension)" />
21+
<PackageFile Include="..\..\output\native\alpine\loongarch64\libSkiaSharp*.so" PackagePath="runtimes\linux-musl-loongarch64\native\%(Filename)%(Extension)" />
2022
</ItemGroup>
2123
<Target Name="IncludeAdditionalTfmSpecificPackageFiles">
2224
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">

binding/SkiaSharp.NativeAssets.Linux/buildTransitive/net4/SkiaSharp.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-riscv64\native\libSkiaSharp*.so">
2626
<Dir>riscv64\</Dir>
2727
</_NativeSkiaSharpFile>
28+
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-loongarch64\native\libSkiaSharp*.so">
29+
<Dir>loongarch64\</Dir>
30+
</_NativeSkiaSharpFile>
2831

2932
<!-- Musl -->
3033
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-x86\native\libSkiaSharp*.so">
@@ -42,6 +45,9 @@
4245
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-riscv64\native\libSkiaSharp*.so">
4346
<Dir>musl-riscv64\</Dir>
4447
</_NativeSkiaSharpFile>
48+
<_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-loongarch64\native\libSkiaSharp*.so">
49+
<Dir>musl-loongarch64\</Dir>
50+
</_NativeSkiaSharpFile>
4551

4652
<!-- include everything -->
4753
<Content Include="@(_NativeSkiaSharpFile)">

scripts/Docker/_clang-cross-common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -ex
33

44
# Parameters:
55
# $1 - The directory containing the Dockerfile [ clang-cross/10 | clang-cross ]
6-
# $2 - The target architecture to build for [ arm | arm64 | riscv64 | x86 | x64 ]
6+
# $2 - The target architecture to build for [ arm | arm64 | riscv64 | x86 | x64 | loongarch64 ]
77
# $3 - The ABI [ gnu | musl ]
88
# $4 - The variant [ "" | alpine ]
99

scripts/Docker/alpine/clang-cross/Dockerfile

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
# Arguments:
2-
# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 ]
2+
# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 | loongarch64 ]
33
# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ]
44
# LLVM_VERSION - the version of the LLVM compiler [ 13 | * ]
5-
# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 9 | * ]
6-
# TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-alpine-linux-musleabihf | aarch64-alpine-linux-musl | riscv64-alpine-linux-musl ]
5+
# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 14 | * ]
6+
# TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-alpine-linux-musleabihf | aarch64-alpine-linux-musl | riscv64-alpine-linux-musl | loongarch64-alpine-linux-musl ]
77

88
ARG IMAGE_ARCH=amd64
99
FROM ${IMAGE_ARCH}/debian:12
1010

1111
# Set the architecture-specific variables based on the value of the BUILD_ARCH argument
1212
ARG BUILD_ARCH=arm64
1313
RUN case ${BUILD_ARCH} in \
14-
arm) TOOLCHAIN_ARCH=armv7-alpine-linux-musleabihf ; TOOLCHAIN_ARCH_TARGET=armv7-alpine-linux-musleabihf ;; \
15-
arm64) TOOLCHAIN_ARCH=aarch64-alpine-linux-musl ; TOOLCHAIN_ARCH_TARGET=aarch64-alpine-linux-musl ;; \
16-
riscv64) TOOLCHAIN_ARCH=riscv64-alpine-linux-musl ; TOOLCHAIN_ARCH_TARGET=riscv64-alpine-linux-musl ;; \
17-
x86) TOOLCHAIN_ARCH=i586-alpine-linux-musl ; TOOLCHAIN_ARCH_TARGET=i586-alpine-linux-musl ;; \
18-
x64) TOOLCHAIN_ARCH=x86_64-alpine-linux-musl ; TOOLCHAIN_ARCH_TARGET=x86_64-alpine-linux-musl ;; \
14+
arm) TOOLCHAIN_ARCH=armv7-alpine-linux-musleabihf ; TOOLCHAIN_ARCH_TARGET=armv7-alpine-linux-musleabihf ;; \
15+
arm64) TOOLCHAIN_ARCH=aarch64-alpine-linux-musl ; TOOLCHAIN_ARCH_TARGET=aarch64-alpine-linux-musl ;; \
16+
loongarch64) TOOLCHAIN_ARCH=loongarch64-alpine-linux-musl ; TOOLCHAIN_ARCH_TARGET=loongarch64-alpine-linux-musl ;; \
17+
riscv64) TOOLCHAIN_ARCH=riscv64-alpine-linux-musl ; TOOLCHAIN_ARCH_TARGET=riscv64-alpine-linux-musl ;; \
18+
x86) TOOLCHAIN_ARCH=i586-alpine-linux-musl ; TOOLCHAIN_ARCH_TARGET=i586-alpine-linux-musl ;; \
19+
x64) TOOLCHAIN_ARCH=x86_64-alpine-linux-musl ; TOOLCHAIN_ARCH_TARGET=x86_64-alpine-linux-musl ;; \
1920
*) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
2021
esac \
2122
&& echo "export TOOLCHAIN_ARCH=${TOOLCHAIN_ARCH}" > /etc/skia-env \
@@ -33,16 +34,18 @@ RUN apt-get update \
3334
ARG MACHINE_ARCH=x86_64
3435
RUN . /etc/skia-env \
3536
&& case "${BUILD_ARCH}" in \
36-
arm) APK_ARCH=armv7 ;; \
37-
arm64) APK_ARCH=aarch64 ;; \
38-
riscv64) APK_ARCH=riscv64 ;; \
39-
x86) APK_ARCH=x86 ;; \
40-
x64) APK_ARCH=x86_64 ;; \
37+
arm) APK_ARCH=armv7 ;; \
38+
arm64) APK_ARCH=aarch64 ;; \
39+
loongarch64) APK_ARCH=loongarch64 ;; \
40+
riscv64) APK_ARCH=riscv64 ;; \
41+
x86) APK_ARCH=x86 ;; \
42+
x64) APK_ARCH=x86_64 ;; \
4143
*) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
4244
esac \
4345
&& case "${BUILD_ARCH}" in \
44-
riscv64) DISTRO_VERSION=3.20 ;; \
45-
*) DISTRO_VERSION=3.17 ;; \
46+
loongarch64) DISTRO_VERSION=3.21 ;; \
47+
riscv64) DISTRO_VERSION=3.20 ;; \
48+
*) DISTRO_VERSION=3.17 ;; \
4649
esac \
4750
&& APK_DIR="$(mktemp -d)" \
4851
&& 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" \

scripts/Docker/alpine/clang-cross/build-local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -ex
33

44
# Parameters:
5-
# $1 - The target architecture to build for [ arm | arm64 | riscv64 | x86 | x64 ]
5+
# $1 - The target architecture to build for [ arm | arm64 | riscv64 | x86 | x64 | loongarch64 ]
66

77
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
88

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Arguments:
2+
# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 | loongarch64 ]
3+
# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ]
4+
# LLVM_VERSION - the version of the LLVM compiler [ 19 | * ]
5+
# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 14 | * ]
6+
# TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu | loongarch64-linux-gnu ]
7+
# TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 | loong64 ]
8+
9+
ARG IMAGE_ARCH=amd64
10+
FROM ${IMAGE_ARCH}/debian:trixie
11+
12+
# Set the architecture-specific variables based on the value of the BUILD_ARCH argument
13+
ARG BUILD_ARCH=arm64
14+
RUN case ${BUILD_ARCH} in \
15+
arm) TOOLCHAIN_ARCH=arm-linux-gnueabihf ; TOOLCHAIN_ARCH_SHORT=armhf ; TOOLCHAIN_ARCH_TARGET=armv7a-linux-gnueabihf ;; \
16+
arm64) TOOLCHAIN_ARCH=aarch64-linux-gnu ; TOOLCHAIN_ARCH_SHORT=arm64 ; TOOLCHAIN_ARCH_TARGET=aarch64-linux-gnu ;; \
17+
loongarch64) TOOLCHAIN_ARCH=loongarch64-linux-gnu ; TOOLCHAIN_ARCH_SHORT=loong64 ; TOOLCHAIN_ARCH_TARGET=loongarch64-linux-gnu ;; \
18+
riscv64) TOOLCHAIN_ARCH=riscv64-linux-gnu ; TOOLCHAIN_ARCH_SHORT=riscv64 ; TOOLCHAIN_ARCH_TARGET=riscv64-linux-gnu ;; \
19+
x86) TOOLCHAIN_ARCH=i686-linux-gnu ; TOOLCHAIN_ARCH_SHORT=i386 ; TOOLCHAIN_ARCH_TARGET=i686-linux-gnu ;; \
20+
x64) TOOLCHAIN_ARCH=x86-64-linux-gnu ; TOOLCHAIN_ARCH_SHORT=amd64 ; TOOLCHAIN_ARCH_TARGET=x86_64-linux-gnu ;; \
21+
*) echo "Unsupported architecture: ${BUILD_ARCH}" && exit 1 ;; \
22+
esac \
23+
&& echo "export TOOLCHAIN_ARCH=${TOOLCHAIN_ARCH}" > /etc/skia-env \
24+
&& echo "export TOOLCHAIN_ARCH_SHORT=${TOOLCHAIN_ARCH_SHORT}" >> /etc/skia-env \
25+
&& echo "export TOOLCHAIN_ARCH_TARGET=${TOOLCHAIN_ARCH_TARGET}" >> /etc/skia-env
26+
27+
# Install the required packages
28+
ARG LLVM_VERSION=19
29+
RUN apt-get update \
30+
&& apt-get install -y \
31+
curl python3 git clang-${LLVM_VERSION} ninja-build xz-utils \
32+
&& rm -rf /var/lib/apt/lists/*
33+
34+
# Install the cross-compilation GCC toolchain
35+
ARG TOOLCHAIN_VERSION=14
36+
RUN . /etc/skia-env \
37+
&& apt-get update \
38+
&& apt-get install -y \
39+
libc6-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
40+
libstdc++-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
41+
libgcc-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \
42+
binutils-${TOOLCHAIN_ARCH} \
43+
&& rm -rf /var/lib/apt/lists/*
44+
45+
# Make the script more flexible and use "current" instead of the actual version
46+
# 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
47+
RUN . /etc/skia-env \
48+
&& TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
49+
&& ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION} /usr/${TOOLCHAIN_ARCH}/include/c++/current \
50+
&& sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so.0 \
51+
&& sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so
52+
53+
# Install the cross-compilation skia build dependencies (fontconfig)
54+
# In order to compat Loongnix 25, LoongArch APT_REPO use loongnix 25 mirrors.
55+
RUN . /etc/skia-env \
56+
&& mkdir -p /skia-utils/libfontconfig-dev \
57+
&& cd /skia-utils/libfontconfig-dev \
58+
&& APT_REPO=http://deb.debian.org/debian \
59+
&& case "${TOOLCHAIN_ARCH_SHORT}" in \
60+
loong64) FC_VERSION=2.15.0-1.1 ; FC_PKG=libfontconfig-dev ; APT_REPO=https://pkg.loongnix.cn/loongnix/25 ;; \
61+
riscv64) FC_VERSION=2.15.0-2.1 ; FC_PKG=libfontconfig-dev ;; \
62+
*) FC_VERSION=2.13.1-2 ; FC_PKG=libfontconfig1-dev ;; \
63+
esac \
64+
&& curl ${APT_REPO}/pool/main/f/fontconfig/${FC_PKG}_${FC_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig-dev.deb \
65+
&& ar vx libfontconfig-dev.deb \
66+
&& tar -xJvf data.tar.xz \
67+
&& rm libfontconfig-dev.deb \
68+
&& TOOLCHAIN_ARCH=$(echo ${TOOLCHAIN_ARCH} | sed 's/x86-64/x86_64/g') \
69+
&& cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ \
70+
&& cp -R usr/include/* /usr/${TOOLCHAIN_ARCH}/include/
71+
72+
# Install the .NET SDK
73+
ARG DOTNET_SDK_VERSION=8.0
74+
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
75+
RUN curl https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh -L -o dotnet-install.sh \
76+
&& bash dotnet-install.sh --channel ${DOTNET_SDK_VERSION} --install-dir /usr/share/dotnet --verbose \
77+
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
78+
&& rm dotnet-install.sh \
79+
&& dotnet help \
80+
&& dotnet --info
81+
82+
ENV CC=clang-${LLVM_VERSION} CXX=clang++-${LLVM_VERSION}
83+
84+
WORKDIR /work
85+
86+
COPY ./startup.sh /
87+
RUN chmod +x /startup.sh
88+
ENTRYPOINT [ "/startup.sh" ]

0 commit comments

Comments
 (0)