|
| 1 | +# Arguments: |
| 2 | +# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 ] |
| 3 | +# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] |
| 4 | +# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 9 | * ] |
| 5 | +# TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu ] |
| 6 | +# TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 ] |
| 7 | +# FONTCONFIG_VERSION - the exact version of libfontconfig1 to use [ 2.13.1-2 | * ] |
| 8 | + |
| 9 | +ARG IMAGE_ARCH=amd64 |
| 10 | +FROM ${IMAGE_ARCH}/debian:12 |
| 11 | + |
| 12 | +# Install the required packages |
| 13 | +RUN apt-get update \ |
| 14 | + && apt-get install -y \ |
| 15 | + curl python3 git clang-19 ninja-build xz-utils \ |
| 16 | + && rm -rf /var/lib/apt/lists/* |
| 17 | + |
| 18 | +# Install the cross-compilation GCC toolchain |
| 19 | +ARG TOOLCHAIN_VERSION=12 |
| 20 | +ARG TOOLCHAIN_ARCH=arm-linux-gnueabihf |
| 21 | +ARG TOOLCHAIN_ARCH_SHORT=armhf |
| 22 | +RUN apt-get update \ |
| 23 | + && apt-get install -y \ |
| 24 | + libstdc++-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \ |
| 25 | + libgcc-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \ |
| 26 | + binutils-${TOOLCHAIN_ARCH} \ |
| 27 | + && rm -rf /var/lib/apt/lists/* |
| 28 | + |
| 29 | +# Make the script more flexible and use "current" instead of the actual version |
| 30 | +RUN ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION} /usr/${TOOLCHAIN_ARCH}/include/c++/current \ |
| 31 | + && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so || true \ |
| 32 | + && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so |
| 33 | + |
| 34 | +# Install the cross-compilation skia build dependencies (fontconfig) |
| 35 | +ARG FONTCONFIG_VERSION=2.15.0-2 |
| 36 | +RUN (mkdir -p /skia-utils/libfontconfig1-dev \ |
| 37 | + && cd /skia-utils/libfontconfig1-dev \ |
| 38 | + && curl http://deb.debian.org/debian/pool/main/f/fontconfig/libfontconfig-dev_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig1-dev.deb \ |
| 39 | + && ar vx libfontconfig1-dev.deb \ |
| 40 | + && tar -xJvf data.tar.xz \ |
| 41 | + && rm libfontconfig1-dev.deb \ |
| 42 | + && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ \ |
| 43 | + && cp -R usr/include/* /usr/${TOOLCHAIN_ARCH}/include/ ) |
| 44 | +RUN (mkdir -p /skia-utils/libfontconfig1 \ |
| 45 | + && cd /skia-utils/libfontconfig1 \ |
| 46 | + && curl http://deb.debian.org/debian/pool/main/f/fontconfig/libfontconfig1_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb -L -o libfontconfig1.deb \ |
| 47 | + && ar vx libfontconfig1.deb \ |
| 48 | + && tar -xJvf data.tar.xz \ |
| 49 | + && rm libfontconfig1.deb \ |
| 50 | + && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ ) |
| 51 | + |
| 52 | +# Install the .NET SDK |
| 53 | +ARG DOTNET_SDK_VERSION=8.0 |
| 54 | +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1 |
| 55 | +RUN curl https://dot.net/v1/dotnet-install.sh -L -o dotnet-install.sh \ |
| 56 | + && bash dotnet-install.sh --channel ${DOTNET_SDK_VERSION} --install-dir /usr/share/dotnet --verbose \ |
| 57 | + && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \ |
| 58 | + && rm dotnet-install.sh \ |
| 59 | + && dotnet help \ |
| 60 | + && dotnet --info |
| 61 | + |
| 62 | +ENV CC=clang-19 CXX=clang++-19 |
| 63 | + |
| 64 | +WORKDIR /work |
0 commit comments