1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-23 12:05:11 -07:00

.NET: compile Linux targets with Zig

This commit is contained in:
Frank Denis 2022-11-28 00:08:25 +01:00
parent e484cf4959
commit e3c88ff0be

View File

@ -26,146 +26,144 @@ jobs:
build-linux-glibc:
runs-on: ubuntu-latest
container:
image: ubuntu:16.04
steps:
- name: Set up build environment
run: |
apt-get update && apt-get install -y build-essential
- name: Install Zig
uses: goto-bus-stop/setup-zig@869a4299cf8ac7db4ebffaec36ad82a682f88acb
with:
version: master
- uses: actions/checkout@v3
- name: configure
run: ./configure --disable-dependency-tracking --prefix=$PWD/.libsodium-build
- name: make
run: make
- name: make check
run: make check
- name: make install
run: make install
- name: strip
run: strip --strip-all .libsodium-build/lib/libsodium.so
- name: build
run: |
zig build -Drelease-fast -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: .libsodium-build/lib/libsodium.so
build-linux-glibc-arm64:
runs-on: ubuntu-latest
container:
image: ubuntu:16.04
options: --privileged
steps:
- name: Set up build environment
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get install -y build-essential qemu binfmt-support qemu-user-static qemu-system-arm gcc-aarch64-linux-gnu libc6-arm64-cross
dpkg --add-architecture arm64
update-binfmts --enable qemu-aarch64
update-binfmts --display
ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.* /lib
- uses: actions/checkout@v3
- name: configure
run: ./configure --disable-dependency-tracking --prefix=$PWD/.libsodium-build --host=aarch64-linux-gnu
- name: make
run: make -j $(nproc)
- name: make check
run: |
env LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib make check
- name: make install
run: make install
- name: strip
run: aarch64-linux-gnu-strip --strip-all .libsodium-build/lib/libsodium.so
- uses: actions/upload-artifact@v3
with:
name: build-linux-arm64
path: .libsodium-build/lib/libsodium.so
path: zig-out/lib/libsodium.so
build-linux-glibc-arm:
runs-on: ubuntu-latest
container:
image: ubuntu:16.04
options: --privileged
steps:
- name: Set up build environment
- name: Install Zig
uses: goto-bus-stop/setup-zig@869a4299cf8ac7db4ebffaec36ad82a682f88acb
with:
version: master
- name: Fix ARM support
run: |
curl -L https://raw.githubusercontent.com/ziglang/zig/master/lib/libc/glibc/sysdeps/arm/arm-features.h | sudo tee /opt/hostedtoolcache/zig/zig-linux-x86_64-*/x64/lib/libc/glibc/sysdeps/arm/sysdep.h >/dev/null
- name: Set up emulation environment
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get install -y build-essential qemu binfmt-support qemu-user-static qemu-system-arm gcc-arm-linux-gnueabihf libc6-armhf-cross
dpkg --add-architecture armhf
update-binfmts --enable qemu-arm
update-binfmts --display
ln -s /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.* /lib
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 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: configure
run: ./configure --disable-dependency-tracking --prefix=$PWD/.libsodium-build --host=arm-linux-gnueabihf
- name: make
run: make -j $(nproc)
- name: make check
- name: build
run: |
env LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib make check
- name: make install
run: make install
- name: strip
run: arm-linux-gnueabihf-strip --strip-all .libsodium-build/lib/libsodium.so
zig build -Drelease-fast -Dtarget=arm-linux-gnueabihf.2.23
- name: tests
run: |
cd zig-out/bin && env LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib ./run.sh
- uses: actions/upload-artifact@v3
with:
name: build-linux-arm
path: .libsodium-build/lib/libsodium.so
path: zig-out/lib/libsodium.so
build-linux-glibc-arm64:
runs-on: ubuntu-latest
steps:
- name: Install Zig
uses: goto-bus-stop/setup-zig@869a4299cf8ac7db4ebffaec36ad82a682f88acb
with:
version: master
- 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
run: |
zig build -Drelease-fast -Dtarget=aarch64-linux-gnu.2.23
- name: tests
run: |
cd zig-out/bin && env LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib ./run.sh
- uses: actions/upload-artifact@v3
with:
name: build-linux-arm64
path: zig-out/lib/libsodium.so
build-linux-musl:
runs-on: ubuntu-latest
container:
image: alpine:latest
image: alpine:3.13
steps:
- name: Set up build environment
run: |
apk update
apk add alpine-sdk ca-certificates
apk add alpine-sdk ca-certificates xz
- name: Install Zig
uses: goto-bus-stop/setup-zig@869a4299cf8ac7db4ebffaec36ad82a682f88acb
with:
version: master
- uses: actions/checkout@v3
- name: configure
run: ./configure --disable-dependency-tracking --prefix=$PWD/.libsodium-build
- name: make
run: make
- name: make check
run: make check
- name: make install
run: make install
- name: strip
run: strip --strip-all .libsodium-build/lib/libsodium.so
- name: build
run: |
zig build -Drelease-fast -Dtarget=x86_64-linux-musl
- name: tests
run: |
cd zig-out/bin && ./run.sh
- uses: actions/upload-artifact@v3
with:
name: build-linux-musl-x64
path: .libsodium-build/lib/libsodium.so
path: zig-out/lib/libsodium.so
build-linux-musl-arm:
runs-on: ubuntu-latest
steps:
- name: Install Zig
uses: goto-bus-stop/setup-zig@869a4299cf8ac7db4ebffaec36ad82a682f88acb
with:
version: master
- uses: actions/checkout@v3
- name: build
run: |
zig build -Drelease-fast -Dtarget=arm-linux-musleabihf
- uses: actions/upload-artifact@v3
with:
name: build-linux-musl-arm
path: zig-out/lib/libsodium.so
build-linux-musl-arm64:
runs-on: ubuntu-latest
container:
image: alpine:latest
steps:
- name: Set up build environment
run: |
apk update
apk add alpine-sdk ca-certificates
- name: Install Zig
uses: goto-bus-stop/setup-zig@869a4299cf8ac7db4ebffaec36ad82a682f88acb
with:
version: master
- uses: actions/checkout@v3
- name: configure
run: ./configure --disable-dependency-tracking --prefix=$PWD/.libsodium-build --host=aarch64-linux-gnu
- name: make
run: make
- name: make check
run: make check
- name: make install
run: make install
- name: strip
run: strip --strip-all .libsodium-build/lib/libsodium.so
- name: build
run: |
zig build -Drelease-fast -Dtarget=aarch64-linux-musl
- uses: actions/upload-artifact@v3
with:
name: build-linux-musl-arm64
path: .libsodium-build/lib/libsodium.so
path: zig-out/lib/libsodium.so
build-macos-x64:
runs-on: macos-11
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: configure
run: env CFLAGS="-Ofast -arch x86_64 -mmacosx-version-min=10.10" LDFLAGS="-arch x86_64 -mmacosx-version-min=10.10" ./configure --host=arm-apple-darwin20 --prefix=$PWD/.libsodium-build
run: env CFLAGS="-Ofast -arch x86_64 -mmacosx-version-min=10.13" LDFLAGS="-arch x86_64 -mmacosx-version-min=10.13" ./configure --host=arm-apple-darwin20 --prefix=$PWD/.libsodium-build
- name: make
run: make
- name: make check
@ -178,11 +176,11 @@ jobs:
path: .libsodium-build/lib/libsodium.dylib
build-macos-arm64:
runs-on: macos-11
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: configure
run: env CFLAGS="-Ofast -arch arm64 -mmacosx-version-min=10.10" LDFLAGS="-arch arm64 -mmacosx-version-min=10.10" ./configure --host=arm-apple-darwin20 --prefix=$PWD/.libsodium-build
run: env CFLAGS="-Ofast -arch arm64 -mmacosx-version-min=10.13" LDFLAGS="-arch arm64 -mmacosx-version-min=10.13" ./configure --host=arm-apple-darwin20 --prefix=$PWD/.libsodium-build
- name: make
run: make
- name: make install
@ -200,6 +198,7 @@ jobs:
- build-linux-glibc-arm
- build-linux-glibc-arm64
- build-linux-musl
- build-linux-musl-arm
- build-linux-musl-arm64
- build-macos-x64
- build-macos-arm64
@ -235,6 +234,10 @@ jobs:
with:
name: build-linux-musl-x64
path: .libsodium-pack/runtimes/linux-musl-x64/native/
- uses: actions/download-artifact@v3
with:
name: build-linux-musl-arm
path: .libsodium-pack/runtimes/linux-musl-arm/native/
- uses: actions/download-artifact@v3
with:
name: build-linux-musl-arm64