diff --git a/native/linux/build.cake b/native/linux/build.cake index cee25f4587..2ef0b1077f 100644 --- a/native/linux/build.cake +++ b/native/linux/build.cake @@ -60,6 +60,14 @@ Task("libSkiaSharp") var soname = GetVersion("libSkiaSharp", "soname"); var map = MakeAbsolute((FilePath)"libSkiaSharp/libSkiaSharp.map"); + // This is terrible! But, Alpine (musl) does not define this + // so we are forced to for dng_sdk. If this ever becomes a problem + // for other libraries, we will need to find a better solution. + var wordSize = ReduceArch(arch).EndsWith("64") ? "64" : "32"; + var wordSizeDefine = VARIANT.ToLower() == "alpine" + ? $", '-D__WORDSIZE={wordSize}'" + : $""; + GnNinja($"{VARIANT}/{arch}", "SkiaSharp", $"target_os='linux' " + $"target_cpu='{arch}' " + @@ -77,7 +85,7 @@ Task("libSkiaSharp") $"skia_enable_skottie=true " + $"skia_use_vulkan={SUPPORT_VULKAN} ".ToLower() + $"extra_asmflags=[] " + - $"extra_cflags=[ '-DSKIA_C_DLL', '-DHAVE_SYSCALL_GETRANDOM', '-DXML_DEV_URANDOM' ] " + + $"extra_cflags=[ '-DSKIA_C_DLL', '-DHAVE_SYSCALL_GETRANDOM', '-DXML_DEV_URANDOM' {wordSizeDefine} ] " + $"extra_ldflags=[ '-static-libstdc++', '-static-libgcc', '-Wl,--version-script={map}' ] " + COMPILERS + $"linux_soname_version='{soname}' " + diff --git a/scripts/Docker/alpine/amd64/Dockerfile b/scripts/Docker/alpine/amd64/Dockerfile index 220e7e34cb..85dc359864 100644 --- a/scripts/Docker/alpine/amd64/Dockerfile +++ b/scripts/Docker/alpine/amd64/Dockerfile @@ -1,33 +1,20 @@ -FROM amd64/alpine:3.9 - # Arguments: -# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 3.1.412 | * ] - -RUN apk add -X https://dl-cdn.alpinelinux.org/alpine/v3.16/main -u alpine-keys --allow-untrusted -RUN apk add --no-cache bash curl wget python python3 git build-base ninja fontconfig-dev libintl clang - -# use the specific commit before the tool switched to C++20 which is too new for this old alpine -RUN git clone https://gn.googlesource.com/gn /usr/share/gn \ - && cd /usr/share/gn \ - && git checkout d4be45bb28fbfc16a41a1e02c86137df6815f2dd \ - && python build/gen.py --allow-warning \ - && ninja -C out \ - && /usr/share/gn/out/gn --version +# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] -ARG DOTNET_SDK_VERSION=3.1.412 +FROM mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17 -RUN wget -O dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-musl-x64.tar.gz \ - && dotnet_sha512='f81ec24d3550bd414fb0fa154007f88a2e2956c73d033c2a82a6cea3402f0a842d1f32e8ffc199c0d9ed86faa8005a76b7c3b130e9cd0c1bea71d0631c9a1bcd' \ - && echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ - && mkdir -p /usr/share/dotnet \ - && tar -C /usr/share/dotnet -xzf dotnet.tar.gz \ - && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \ - && rm dotnet.tar.gz +# Install the skia build dependencies +RUN apk add --no-cache fontconfig-dev gn ninja +# Install the .NET SDK +ARG DOTNET_SDK_VERSION=8.0 ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1 +RUN wget https://dot.net/v1/dotnet-install.sh -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 -RUN dotnet help - -ENV GN_EXE=/usr/share/gn/out/gn +ENV CC=clang CXX=clang++ GN_EXE=/usr/bin/gn WORKDIR /work diff --git a/scripts/Docker/alpine/amd64/build-local.sh b/scripts/Docker/alpine/amd64/build-local.sh index 920fbfb093..d8b767cc38 100644 --- a/scripts/Docker/alpine/amd64/build-local.sh +++ b/scripts/Docker/alpine/amd64/build-local.sh @@ -3,8 +3,8 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -(cd $DIR && docker build --tag skiasharp-alpine .) +(cd $DIR && docker build --tag skiasharp-alpine-x64 .) (cd $DIR/../../../../ && \ - docker run --rm --name skiasharp-alpine --volume $(pwd):/work skiasharp-alpine /bin/bash -c "\ + docker run --rm --name skiasharp-alpine-x64 --volume $(pwd):/work skiasharp-alpine-x64 /bin/bash -c "\ dotnet tool restore ; \ dotnet cake --target=externals-linux --configuration=Release --buildarch=x64 --variant=alpine") diff --git a/scripts/Docker/debian9/amd64/.dockerignore b/scripts/Docker/alpine/arm64v8/.dockerignore similarity index 100% rename from scripts/Docker/debian9/amd64/.dockerignore rename to scripts/Docker/alpine/arm64v8/.dockerignore diff --git a/scripts/Docker/alpine/arm64v8/Dockerfile b/scripts/Docker/alpine/arm64v8/Dockerfile new file mode 100644 index 0000000000..2937674493 --- /dev/null +++ b/scripts/Docker/alpine/arm64v8/Dockerfile @@ -0,0 +1,20 @@ +# Arguments: +# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] + +FROM mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-arm64v8-local + +# Install the skia build dependencies +RUN apk add --no-cache fontconfig-dev gn ninja + +# Install the .NET SDK +ARG DOTNET_SDK_VERSION=8.0 +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1 +RUN wget https://dot.net/v1/dotnet-install.sh -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 + +ENV CC=clang CXX=clang++ GN_EXE=/usr/bin/gn + +WORKDIR /work diff --git a/scripts/Docker/alpine/arm64v8/build-local.sh b/scripts/Docker/alpine/arm64v8/build-local.sh new file mode 100644 index 0000000000..3d0645ee69 --- /dev/null +++ b/scripts/Docker/alpine/arm64v8/build-local.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +(cd $DIR && docker build --tag skiasharp-alpine-arm64 .) +(cd $DIR/../../../../ && \ + docker run --rm --name skiasharp-alpine-arm64 --volume $(pwd):/work skiasharp-alpine-arm64 /bin/bash -c "\ + dotnet tool restore ; \ + dotnet cake --target=externals-linux --configuration=Release --buildarch=arm64 --variant=alpine") diff --git a/scripts/Docker/debian9/clang-cross/.dockerignore b/scripts/Docker/debian/amd64/.dockerignore similarity index 100% rename from scripts/Docker/debian9/clang-cross/.dockerignore rename to scripts/Docker/debian/amd64/.dockerignore diff --git a/scripts/Docker/debian/amd64/Dockerfile b/scripts/Docker/debian/amd64/Dockerfile new file mode 100644 index 0000000000..db9f309ba9 --- /dev/null +++ b/scripts/Docker/debian/amd64/Dockerfile @@ -0,0 +1,22 @@ +# Arguments: +# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] + +FROM mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-amd64 + +# Install the skia build dependencies +RUN apt-get update \ + && apt-get install -y libfontconfig1-dev ninja-build \ + && rm -rf /var/lib/apt/lists/* + +# 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 + +ENV CC=clang CXX=clang++ + +WORKDIR /work diff --git a/scripts/Docker/debian9/amd64/build-local.sh b/scripts/Docker/debian/amd64/build-local.sh similarity index 60% rename from scripts/Docker/debian9/amd64/build-local.sh rename to scripts/Docker/debian/amd64/build-local.sh index f1cd926797..75fbebe3a4 100644 --- a/scripts/Docker/debian9/amd64/build-local.sh +++ b/scripts/Docker/debian/amd64/build-local.sh @@ -3,8 +3,8 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -(cd $DIR && docker build --tag skiasharp-linux .) +(cd $DIR && docker build --tag skiasharp-linux-x64 .) (cd $DIR/../../../../ && \ - docker run --rm --name skiasharp-linux --volume $(pwd):/work skiasharp-linux /bin/bash -c "\ + docker run --rm --name skiasharp-linux-x64 --volume $(pwd):/work skiasharp-linux-x64 /bin/bash -c "\ dotnet tool restore ; \ dotnet cake --target=externals-linux --configuration=Release --buildarch=x64") diff --git a/scripts/Docker/debian/arm64v8/.dockerignore b/scripts/Docker/debian/arm64v8/.dockerignore new file mode 100644 index 0000000000..3a09fc21d8 --- /dev/null +++ b/scripts/Docker/debian/arm64v8/.dockerignore @@ -0,0 +1 @@ +build-local.sh diff --git a/scripts/Docker/debian/arm64v8/Dockerfile b/scripts/Docker/debian/arm64v8/Dockerfile new file mode 100644 index 0000000000..23162cc553 --- /dev/null +++ b/scripts/Docker/debian/arm64v8/Dockerfile @@ -0,0 +1,22 @@ +# Arguments: +# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] + +FROM mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-arm64v8 + +# Install the skia build dependencies +RUN apt-get update \ + && apt-get install -y libfontconfig1-dev ninja-build \ + && rm -rf /var/lib/apt/lists/* + +# 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 + +ENV CC=clang CXX=clang++ + +WORKDIR /work diff --git a/scripts/Docker/debian/arm64v8/build-local.sh b/scripts/Docker/debian/arm64v8/build-local.sh new file mode 100644 index 0000000000..9ad9788721 --- /dev/null +++ b/scripts/Docker/debian/arm64v8/build-local.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +(cd $DIR && docker build --tag skiasharp-linux-arm64 .) +(cd $DIR/../../../../ && \ + docker run --rm --name skiasharp-linux-arm64 --volume $(pwd):/work skiasharp-linux-arm64 /bin/bash -c "\ + dotnet tool restore ; \ + dotnet cake --target=externals-linux --configuration=Release --buildarch=arm64") diff --git a/scripts/Docker/debian/clang-cross/.dockerignore b/scripts/Docker/debian/clang-cross/.dockerignore new file mode 100644 index 0000000000..3a09fc21d8 --- /dev/null +++ b/scripts/Docker/debian/clang-cross/.dockerignore @@ -0,0 +1 @@ +build-local.sh diff --git a/scripts/Docker/debian/clang-cross/Dockerfile b/scripts/Docker/debian/clang-cross/Dockerfile new file mode 100644 index 0000000000..5088e35b95 --- /dev/null +++ b/scripts/Docker/debian/clang-cross/Dockerfile @@ -0,0 +1,62 @@ +# Arguments: +# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 ] +# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] +# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 9 | * ] +# TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu] +# TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 ] +# FONTCONFIG_VERSION - the exact version of libfontconfig1 to use [ 2.13.1-2 | * ] + +ARG IMAGE_ARCH=amd64 +FROM mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-${IMAGE_ARCH} + +# Install the skia build dependencies +RUN apt-get update \ + && apt-get install -y ninja-build \ + && rm -rf /var/lib/apt/lists/* + +# Install the cross-compilation GCC toolchain +ARG TOOLCHAIN_VERSION=9 +ARG TOOLCHAIN_ARCH=arm-linux-gnueabihf +ARG TOOLCHAIN_ARCH_SHORT=armhf +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 \ + && 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.13.1-2 +RUN (mkdir -p /skia-utils/libfontconfig1-dev \ + && cd /skia-utils/libfontconfig1-dev \ + && curl http://deb.debian.org/debian/pool/main/f/fontconfig/libfontconfig1-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 http://deb.debian.org/debian/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 + +ENV CC=clang CXX=clang++ + +WORKDIR /work diff --git a/scripts/Docker/debian/clang-cross/build-local.sh b/scripts/Docker/debian/clang-cross/build-local.sh new file mode 100644 index 0000000000..4b30582f36 --- /dev/null +++ b/scripts/Docker/debian/clang-cross/build-local.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -ex + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +# the target architecture to build for +ARCH="${1:-arm}" +case $ARCH in + arm) BUILD_ARGS="--build-arg TOOLCHAIN_ARCH=arm-linux-gnueabihf --build-arg TOOLCHAIN_ARCH_SHORT=armhf" ;; + arm64) BUILD_ARGS="--build-arg TOOLCHAIN_ARCH=aarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=arm64" ;; + x86) BUILD_ARGS="--build-arg TOOLCHAIN_ARCH=i686-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=i386" ;; + x64) BUILD_ARGS="--build-arg TOOLCHAIN_ARCH=x86-64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=amd64" ;; + *) echo "Unsupported architecture: $ARCH" && exit 1 ;; +esac + +# the docker image architecture to use +IMAGE_ARCH="${2:-$([[ "$(uname -m)" == "arm64" ]] && echo "arm64v8" || echo "amd64")}" + +(cd $DIR && docker build --tag skiasharp-linux-cross-$ARCH $BUILD_ARGS --build-arg IMAGE_ARCH=$IMAGE_ARCH .) +(cd $DIR/../../../../ && + docker run --rm --name skiasharp-linux-cross-$ARCH --volume $(pwd):/work skiasharp-linux-cross-$ARCH /bin/bash -c "\ + dotnet tool restore ; \ + dotnet cake --target=externals-linux-clang-cross --configuration=Release --buildarch=$ARCH") diff --git a/scripts/Docker/debian9/amd64/Dockerfile b/scripts/Docker/debian9/amd64/Dockerfile deleted file mode 100644 index 37177b3776..0000000000 --- a/scripts/Docker/debian9/amd64/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM amd64/debian:10 - -# Arguments: -# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 7.0 | * ] -# CLANG_VERSION - the version of clang/llvm tools [ 12 | * ] -# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 8 | * ] - -RUN apt-get update \ - && apt-get install -y apt-transport-https curl wget python python3 git make dirmngr gnupg \ - && apt-get install -y libfontconfig1-dev ninja-build - -ARG TOOLCHAIN_VERSION=8 -RUN apt-get update \ - && apt-get install -y gcc-${TOOLCHAIN_VERSION} g++-${TOOLCHAIN_VERSION} -RUN gcc-${TOOLCHAIN_VERSION} --version - -ARG CLANG_VERSION=12 -RUN curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ - && echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-${CLANG_VERSION} main" | tee /etc/apt/sources.list.d/llvm.list \ - && apt-get update \ - && apt-get install -y clang-${CLANG_VERSION} -RUN clang-${CLANG_VERSION} --version - -ARG DOTNET_SDK_VERSION=7.0 -RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ - && dpkg -i packages-microsoft-prod.deb \ - && rm packages-microsoft-prod.deb \ - && apt-get update \ - && apt-get install -y dotnet-sdk-${DOTNET_SDK_VERSION} -ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1 -RUN dotnet --version - -RUN rm -rf /var/lib/apt/lists/* - -ENV CC=clang-${CLANG_VERSION} CXX=clang++-${CLANG_VERSION} - -WORKDIR /work diff --git a/scripts/Docker/debian9/clang-cross/Dockerfile b/scripts/Docker/debian9/clang-cross/Dockerfile deleted file mode 100644 index 75e442424a..0000000000 --- a/scripts/Docker/debian9/clang-cross/Dockerfile +++ /dev/null @@ -1,72 +0,0 @@ -FROM amd64/debian:10 - -# Arguments: -# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 7.0 | * ] -# CLANG_VERSION - the version of clang/llvm tools [ 12 | * ] -# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 8 | * ] -# TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu] -# TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 ] -# FONTCONFIG_VERSION - the exact version of libfontconfig1 to use [ 2.13.1-2 | * ] -# -# To build a arm image: -# --build-arg TOOLCHAIN_ARCH=arm-linux-gnueabihf --build-arg TOOLCHAIN_ARCH_SHORT=armhf -# To build a arm64 image: -# --build-arg TOOLCHAIN_ARCH=aarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=arm64 - -RUN apt-get update \ - && apt-get install -y apt-transport-https curl wget python python3 git make dirmngr gnupg \ - && apt-get install -y libfontconfig1-dev ninja-build - -ARG TOOLCHAIN_VERSION=8 -ARG TOOLCHAIN_ARCH=arm-linux-gnueabihf -ARG TOOLCHAIN_ARCH_SHORT=armhf -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} - -ARG CLANG_VERSION=12 -RUN curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ - && echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-${CLANG_VERSION} main" | tee /etc/apt/sources.list.d/llvm.list \ - && apt-get update \ - && apt-get install -y clang-${CLANG_VERSION} -RUN clang-${CLANG_VERSION} --version - -ARG DOTNET_SDK_VERSION=7.0 -RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ - && dpkg -i packages-microsoft-prod.deb \ - && rm packages-microsoft-prod.deb \ - && apt-get update \ - && apt-get install -y dotnet-sdk-${DOTNET_SDK_VERSION} -ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1 -RUN dotnet --version - -# 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 \ - && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so - -# skia dependencies (fontconfig) -ARG FONTCONFIG_VERSION=2.13.1-2 -RUN (mkdir -p /skia-utils/libfontconfig1-dev \ - && cd /skia-utils/libfontconfig1-dev \ - && wget -O libfontconfig1-dev.deb http://deb.debian.org/debian/pool/main/f/fontconfig/libfontconfig1-dev_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.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 \ - && wget -O libfontconfig1.deb http://deb.debian.org/debian/pool/main/f/fontconfig/libfontconfig1_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb \ - && ar vx libfontconfig1.deb \ - && tar -xJvf data.tar.xz \ - && rm libfontconfig1.deb \ - && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ ) - -RUN rm -rf /var/lib/apt/lists/* - -ENV CC=clang-${CLANG_VERSION} CXX=clang++-${CLANG_VERSION} - -WORKDIR /work diff --git a/scripts/Docker/debian9/clang-cross/build-local.sh b/scripts/Docker/debian9/clang-cross/build-local.sh deleted file mode 100644 index b07afe5138..0000000000 --- a/scripts/Docker/debian9/clang-cross/build-local.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -e - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -ARCH="arm" -BUILD_ARGS="--build-arg TOOLCHAIN_ARCH=arm-linux-gnueabihf --build-arg TOOLCHAIN_ARCH_SHORT=armhf" -if [ "$1" == "arm64" ]; then - ARCH="arm64" - BUILD_ARGS="--build-arg TOOLCHAIN_ARCH=aarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=arm64" -fi - -(cd $DIR && docker build --tag skiasharp-linux-$ARCH $BUILD_ARGS .) -(cd $DIR/../../../../ && - docker run --rm --name skiasharp-linux-$ARCH --volume $(pwd):/work skiasharp-linux-$ARCH /bin/bash -c "\ - dotnet tool restore ; \ - dotnet cake --target=externals-linux-clang-cross --configuration=Release --buildarch=$ARCH") diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml index 62fa82e413..aa736e049b 100644 --- a/scripts/azure-templates-stages.yml +++ b/scripts/azure-templates-stages.yml @@ -325,15 +325,15 @@ stages: gnArgs: skia_use_fontconfig=false matrix: - arch: x64 - docker: scripts/Docker/debian9/amd64 + docker: scripts/Docker/debian/amd64 - arch: x64 variant: alpine docker: scripts/Docker/alpine/amd64 - arch: arm - docker: scripts/Docker/debian9/clang-cross + docker: scripts/Docker/debian/clang-cross target: externals-linux-clang-cross - arch: arm64 - docker: scripts/Docker/debian9/clang-cross + docker: scripts/Docker/debian/clang-cross dockerArgs: --build-arg TOOLCHAIN_ARCH=aarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=arm64 target: externals-linux-clang-cross - template: /scripts/azure-templates-bootstrapper.yml@self # Build Native Tizen (Linux) diff --git a/scripts/cake/native-shared.cake b/scripts/cake/native-shared.cake index 8c3703e3e5..aac275db40 100644 --- a/scripts/cake/native-shared.cake +++ b/scripts/cake/native-shared.cake @@ -93,35 +93,42 @@ void GnNinja(DirectoryPath outDir, string target, string skiaArgs) RunNinja(SKIA_PATH, $"out/{outDir}", target); } -bool Skip(string arch) +string ReduceArch(string arch) { arch = arch?.ToLower() ?? ""; - if (BUILD_ARCH.Length == 0 || BUILD_ARCH.Contains("all")) - return false; - switch (arch) { case "win32": case "i386": case "i586": - arch = "x86"; - break; + case "x86": + return "x86"; case "x86_64": - arch = "x64"; - break; + case "x64": + return "x64"; case "armeabi-v7a": case "armel": case "armv7": case "armv7k": - arch = "arm"; - break; + case "arm": + return "arm"; case "arm64_32": case "arm64-v8a": case "aarch64": - arch = "arm64"; - break; + case "arm64": + return "arm64"; } + throw new Exception($"Unknown architecture: {arch}"); +} + +bool Skip(string arch) +{ + if (BUILD_ARCH.Length == 0 || BUILD_ARCH.Contains("all")) + return false; + + arch = ReduceArch(arch); + if (BUILD_ARCH.Contains(arch)) return false;