Skip to content

Commit

Permalink
Simplify build of .NET pakages, including Windows/arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Apr 27, 2024
1 parent bf972ef commit 9279f68
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Install Zig
uses: goto-bus-stop/setup-zig@d866436887ad1b24590684f9d00480376663dd36
with:
version: 0.11.0
version: 0.12.0

- name: Autogen
run: ./autogen.sh -s
Expand Down
127 changes: 41 additions & 86 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- next

jobs:
build-windows:
build-windows-msvc:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -24,44 +24,50 @@ jobs:
name: build-win-x86
path: bin/Win32/Release/v143/dynamic/libsodium.dll

build-linux-glibc:
build-others:
runs-on: ubuntu-latest
steps:
- name: Install Zig
uses: goto-bus-stop/setup-zig@d866436887ad1b24590684f9d00480376663dd36
uses: goto-bus-stop/setup-zig@2a9625d550eefc3a9b1a43d342ad655f563f8241
with:
version: 0.11.0
version: 0.12.0
- uses: actions/checkout@v3
- name: build

- name: build-win-arm64
run: |
zig build -Doptimize=ReleaseFast -Dtarget=x86_64-linux-gnu.2.17 -Dcpu=sandybridge
rm -fr zig-out zig-cache; zig build -Doptimize=ReleaseFast -Dtarget=aarch64-windows
- uses: actions/upload-artifact@v3
with:
name: build-win-arm64
path: zig-out/lib/libsodium.dll

- name: build-linux-x64
run: |
rm -fr zig-out zig-cache; zig build -Doptimize=ReleaseFast -Dtarget=x86_64-linux-gnu.2.17
- name: tests
run: cd zig-out/bin && ./run.sh
- uses: actions/upload-artifact@v3
with:
name: build-linux-x64
path: zig-out/lib/libsodium.so

build-linux-glibc-arm:
runs-on: ubuntu-latest
steps:
- name: Install Zig
uses: goto-bus-stop/setup-zig@d866436887ad1b24590684f9d00480376663dd36
with:
version: 0.11.0
- name: Set up emulation environment
- name: Set up arm and aarch64 emulation environment
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y build-essential qemu binfmt-support qemu-user-static qemu-system-arm gcc-arm-linux-gnueabihf libc6-armhf-cross
sudo apt-get install -y build-essential qemu binfmt-support qemu-user-static qemu-system-arm gcc-arm-linux-gnueabihf libc6-armhf-cross gcc-aarch64-linux-gnu libc6-arm64-cross
sudo dpkg --add-architecture armhf
sudo update-binfmts --enable qemu-arm
sudo update-binfmts --display
sudo ln -s /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.* /lib
- uses: actions/checkout@v3
- name: build
sudo dpkg --add-architecture arm64
sudo update-binfmts --enable qemu-aarch64
sudo update-binfmts --display
sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.* /lib
- name: build-linux-arm
run: |
zig build -Doptimize=ReleaseFast -Dtarget=arm-linux-gnueabihf.2.23 -Dcpu=baseline
rm -fr zig-out zig-cache; zig build -Doptimize=ReleaseFast -Dtarget=arm-linux-gnueabihf.2.23
- name: tests
run: |
cd zig-out/bin && env LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib ./run.sh
Expand All @@ -70,26 +76,9 @@ jobs:
name: build-linux-arm
path: zig-out/lib/libsodium.so

build-linux-glibc-arm64:
runs-on: ubuntu-latest
steps:
- name: Install Zig
uses: goto-bus-stop/setup-zig@d866436887ad1b24590684f9d00480376663dd36
with:
version: 0.11.0
- name: Set up emulation environment
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y qemu binfmt-support qemu-user-static qemu-system-arm gcc-aarch64-linux-gnu libc6-arm64-cross
sudo dpkg --add-architecture arm64
sudo update-binfmts --enable qemu-aarch64
sudo update-binfmts --display
sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.* /lib
- uses: actions/checkout@v3
- name: build
- name: build-linux-arm64
run: |
zig build -Doptimize=ReleaseFast -Dtarget=aarch64-linux-gnu.2.23 -Dcpu=baseline
rm -fr zig-out zig-cache; zig build -Doptimize=ReleaseFast -Dtarget=aarch64-linux-gnu.2.23
- name: tests
run: |
cd zig-out/bin && env LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib ./run.sh
Expand All @@ -98,62 +87,29 @@ jobs:
name: build-linux-arm64
path: zig-out/lib/libsodium.so

build-linux-musl:
runs-on: ubuntu-latest
container:
image: alpine:3.13
steps:
- name: Set up build environment
- name: build-linux-musl-x64
run: |
apk update
apk add alpine-sdk ca-certificates xz
- name: Install Zig
uses: goto-bus-stop/setup-zig@d866436887ad1b24590684f9d00480376663dd36
with:
version: 0.11.0
- uses: actions/checkout@v3
- name: build
run: |
zig build -Doptimize=ReleaseFast -Dtarget=x86_64-linux-musl -Dcpu=sandybridge
- name: tests
run: |
cd zig-out/bin && ./run.sh
rm -fr zig-out zig-cache; zig build -Doptimize=ReleaseFast -Dtarget=x86_64-linux-musl
- uses: actions/upload-artifact@v3
with:
name: build-linux-musl-x64
path: zig-out/lib/libsodium.so
path: zig-out/lib/libsodium.a

build-linux-musl-arm:
runs-on: ubuntu-latest
steps:
- name: Install Zig
uses: goto-bus-stop/setup-zig@d866436887ad1b24590684f9d00480376663dd36
with:
version: 0.11.0
- uses: actions/checkout@v3
- name: build
- name: build-linux-musl-arm
run: |
zig build -Doptimize=ReleaseFast -Dtarget=arm-linux-musleabihf -Dcpu=baseline
rm -fr zig-out zig-cache; zig build -Doptimize=ReleaseFast -Dtarget=arm-linux-musleabihf
- uses: actions/upload-artifact@v3
with:
name: build-linux-musl-arm
path: zig-out/lib/libsodium.so
path: zig-out/lib/libsodium.a

build-linux-musl-arm64:
runs-on: ubuntu-latest
steps:
- name: Install Zig
uses: goto-bus-stop/setup-zig@d866436887ad1b24590684f9d00480376663dd36
with:
version: 0.11.0
- uses: actions/checkout@v3
- name: build
- name: build-linux-musl-arm64
run: |
zig build -Doptimize=ReleaseFast -Dtarget=aarch64-linux-musl -Dcpu=baseline
rm -fr zig-out zig-cache; zig build -Doptimize=ReleaseFast -Dtarget=aarch64-linux-musl
- uses: actions/upload-artifact@v3
with:
name: build-linux-musl-arm64
path: zig-out/lib/libsodium.so
path: zig-out/lib/libsodium.a

build-macos-x64:
runs-on: macos-latest
Expand Down Expand Up @@ -190,13 +146,8 @@ jobs:
pack:
runs-on: ubuntu-latest
needs:
- build-windows
- build-linux-glibc
- build-linux-glibc-arm
- build-linux-glibc-arm64
- build-linux-musl
- build-linux-musl-arm
- build-linux-musl-arm64
- build-windows-msvc
- build-others
- build-macos-x64
- build-macos-arm64
container:
Expand All @@ -215,6 +166,10 @@ jobs:
with:
name: build-win-x86
path: .libsodium-pack/runtimes/win-x86/native/
- uses: actions/download-artifact@v3
with:
name: build-win-arm64
path: .libsodium-pack/runtimes/win-arm64/native/
- uses: actions/download-artifact@v3
with:
name: build-linux-x64
Expand Down
7 changes: 4 additions & 3 deletions packaging/dotnet-core/libsodium.pkgproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
<Content Include="ChangeLog" PackagePath="" />
<Content Include="runtimes/win-x64/native/libsodium.dll" PackagePath="runtimes/win-x64/native/" />
<Content Include="runtimes/win-x86/native/libsodium.dll" PackagePath="runtimes/win-x86/native/" />
<Content Include="runtimes/win-arm64/native/libsodium.dll" PackagePath="runtimes/win-arm64/native/" />
<Content Include="runtimes/linux-x64/native/libsodium.so" PackagePath="runtimes/linux-x64/native/" />
<Content Include="runtimes/linux-arm/native/libsodium.so" PackagePath="runtimes/linux-arm/native/" />
<Content Include="runtimes/linux-arm64/native/libsodium.so" PackagePath="runtimes/linux-arm64/native/" />
<Content Include="runtimes/linux-musl-x64/native/libsodium.so" PackagePath="runtimes/linux-musl-x64/native/" />
<Content Include="runtimes/linux-musl-arm/native/libsodium.so" PackagePath="runtimes/linux-musl-arm/native/" />
<Content Include="runtimes/linux-musl-arm64/native/libsodium.so" PackagePath="runtimes/linux-musl-arm64/native/" />
<Content Include="runtimes/linux-musl-x64/native/libsodium.a" PackagePath="runtimes/linux-musl-x64/native/" />
<Content Include="runtimes/linux-musl-arm/native/libsodium.a" PackagePath="runtimes/linux-musl-arm/native/" />
<Content Include="runtimes/linux-musl-arm64/native/libsodium.a" PackagePath="runtimes/linux-musl-arm64/native/" />
<Content Include="runtimes/osx-x64/native/libsodium.dylib" PackagePath="runtimes/osx-x64/native/" />
<Content Include="runtimes/osx-arm64/native/libsodium.dylib" PackagePath="runtimes/osx-arm64/native/" />
</ItemGroup>
Expand Down

0 comments on commit 9279f68

Please sign in to comment.