From 33f51f2217f0288ab9d6e0e3394b4fba29aac9bf Mon Sep 17 00:00:00 2001 From: kasperk81 <83082615+kasperk81@users.noreply.github.com> Date: Mon, 10 Mar 2025 13:46:03 +0000 Subject: [PATCH] add linux/musl-riscv64 build --- .github/workflows/ci.yml | 4 ++++ Dockerfile.linux | 2 +- Dockerfile.linux-musl | 4 ++-- README.md | 4 ++-- UpdateLibgit2ToSha.ps1 | 1 + dockerbuild.sh | 7 ++++++- nuget.package/libgit2/LibGit2Sharp.dll.config | 1 + 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5482c7d4..188bbfaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,12 +33,16 @@ jobs: name: linux-arm64 - os: ubuntu-24.04 name: linux-ppc64le + - os: ubuntu-24.04 + name: linux-riscv64 - os: ubuntu-24.04 name: linux-musl-x64 - os: ubuntu-24.04 name: linux-musl-arm - os: ubuntu-24.04 name: linux-musl-arm64 + - os: ubuntu-24.04 + name: linux-musl-riscv64 - os: macos-13 name: osx-x64 - os: macos-13 diff --git a/Dockerfile.linux b/Dockerfile.linux index 4421da3d..3daffa4e 100644 --- a/Dockerfile.linux +++ b/Dockerfile.linux @@ -6,4 +6,4 @@ RUN apt update && apt -y install pkg-config WORKDIR /nativebinaries COPY . /nativebinaries/ -CMD ["/bin/bash", "-c", "./build.libgit2.sh"] \ No newline at end of file +CMD ["/bin/bash", "-c", "./build.libgit2.sh"] diff --git a/Dockerfile.linux-musl b/Dockerfile.linux-musl index 1cfa1e4e..6cc69f37 100644 --- a/Dockerfile.linux-musl +++ b/Dockerfile.linux-musl @@ -1,8 +1,8 @@ ARG ARCH='amd64' -FROM multiarch/alpine:${ARCH}-v3.13 +FROM multiarch/alpine:${ARCH}-v{ALPINE_VERSION} RUN apk add --no-cache bash build-base cmake WORKDIR /nativebinaries COPY . /nativebinaries/ -CMD ["/bin/bash", "-c", "./build.libgit2.sh"] \ No newline at end of file +CMD ["/bin/bash", "-c", "./build.libgit2.sh"] diff --git a/README.md b/README.md index a6f68879..2b0e1131 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ the following platforms: - Windows (x86, x64, arm64) - macOS (x64, arm64) - Linux - - glibc: (x64, arm, arm64, ppc64le) - - musl: (x64, arm, arm64) + - glibc: (x64, arm, arm64, ppc64le, riscv64) + - musl: (x64, arm, arm64, riscv64) [lg2s-nb]: https://www.nuget.org/packages/LibGit2Sharp.NativeBinaries [lg2]: https://libgit2.github.com/ diff --git a/UpdateLibgit2ToSha.ps1 b/UpdateLibgit2ToSha.ps1 index a3111d3d..00ca2ace 100644 --- a/UpdateLibgit2ToSha.ps1 +++ b/UpdateLibgit2ToSha.ps1 @@ -124,6 +124,7 @@ Push-Location $libgit2Directory + diff --git a/dockerbuild.sh b/dockerbuild.sh index 4ee5a0a2..9c2be8af 100755 --- a/dockerbuild.sh +++ b/dockerbuild.sh @@ -3,12 +3,17 @@ set -e echo "building for $RID" +alpineVersion=3.13 + if [[ $RID =~ arm64 ]]; then arch="arm64" elif [[ $RID =~ arm ]]; then arch="armhf" elif [[ $RID =~ ppc64le ]]; then arch="powerpc64le" +elif [[ $RID =~ riscv64 ]]; then + arch="riscv64" + alpineVersion=3.20 # alpine 3.20 is the first version with official riscv64 support else arch="amd64" fi @@ -19,7 +24,7 @@ else dockerfile="Dockerfile.linux" fi -docker buildx build -t $RID -f $dockerfile --build-arg ARCH=$arch . +docker buildx build -t $RID -f $dockerfile --build-arg ARCH=$arch --build-arg ALPINE_VERSION=$alpineVersion . docker run -t -e RID=$RID --name=$RID $RID diff --git a/nuget.package/libgit2/LibGit2Sharp.dll.config b/nuget.package/libgit2/LibGit2Sharp.dll.config index 95f4b0bc..25074a9a 100644 --- a/nuget.package/libgit2/LibGit2Sharp.dll.config +++ b/nuget.package/libgit2/LibGit2Sharp.dll.config @@ -3,6 +3,7 @@ +