-
Notifications
You must be signed in to change notification settings - Fork 643
Extend clang-cross to support alpine #3200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b785521
Extend clang-cross to support alpine
kasperk81 159d70d
Merge branch 'main' into main-musl
kasperk81 80fe135
add variant
kasperk81 b02c7c1
fix target machine arch
kasperk81 1766d87
fix arm64
kasperk81 9fcff57
Update native/linux-clang-cross/build.cake
kasperk81 84d227c
feedback
kasperk81 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
| DOCKER_DIR="$1" | ||
|
|
||
| # the target architecture to build for | ||
| ARCH="${2:-arm}" | ||
|
|
||
| # the docker image architecture to use | ||
| MACHINE_ARCH="$(uname -m)" | ||
| IMAGE_ARCH="${3:-$([[ "$MACHINE_ARCH" == "arm64" || "$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 ;; | ||
| arm64) TOOLCHAIN_ARCH=aarch64$VENDOR-linux-$ABI; TOOLCHAIN_ARCH_SHORT=arm64 ;; | ||
| riscv64) TOOLCHAIN_ARCH=riscv64$VENDOR-linux-$ABI; TOOLCHAIN_ARCH_SHORT=riscv64 ;; | ||
| x86) TOOLCHAIN_ARCH=i686$VENDOR-linux-$ABI; TOOLCHAIN_ARCH_SHORT=i386 ;; | ||
| x64) TOOLCHAIN_ARCH=x86-64$VENDOR-linux-$ABI; TOOLCHAIN_ARCH_SHORT=amd64 ;; | ||
| *) echo "Unsupported architecture: $ARCH" && exit 1 ;; | ||
| 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 DISTRO_VERSION=$DISTRO_VERSION \ | ||
| $DOCKER_DIR) | ||
|
|
||
| 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=$vendor") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| build-local.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Arguments: | ||
| # IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 ] | ||
| # 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-alpine-linux-musleabihf | aarch64-alpine-linux-musl | riscv64-alpine-linux-musl ] | ||
| # 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 ${IMAGE_ARCH}/debian:12 | ||
|
|
||
| # Install the required packages | ||
| RUN apt-get update \ | ||
| && apt-get install -y \ | ||
| curl python3 git clang-19 lld-19 ninja-build xz-utils curl \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install the cross-compilation musl toolchain | ||
| ARG DISTRO_VERSION=3.17 | ||
| ARG TOOLCHAIN_ARCH_SHORT=armhf | ||
| ARG MACHINE_ARCH=x86_64 | ||
| RUN APK_DIR="$(mktemp -d)" && \ | ||
| curl -SLO --create-dirs --output-dir "$APK_DIR" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.12.11/$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 "$TOOLCHAIN_ARCH_SHORT" --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 "$TOOLCHAIN_ARCH_SHORT" --no-scripts \ | ||
| add fontconfig-dev build-base | ||
|
|
||
| # 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
|
||
| ARCH=$1 | ||
| ALPINE_VERSION=$3 | ||
| if [ -z "$ALPINE_VERSION" ]; then | ||
| case $ARCH in | ||
| riscv64) ALPINE_VERSION=3.20 ;; | ||
| *) ALPINE_VERSION=3.17 ;; | ||
| esac | ||
| fi | ||
|
|
||
| $DIR/../../_clang-cross-common.sh "$DIR" "$ARCH" "$2" "$ALPINE_VERSION" "musl" "-alpine" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.