ci: proper target mapping
This commit is contained in:
parent
04c46bf624
commit
0775cd6b2f
2 changed files with 26 additions and 14 deletions
22
.github/workflows/cd.yml
vendored
22
.github/workflows/cd.yml
vendored
|
|
@ -54,18 +54,18 @@ jobs:
|
|||
os: ubuntu-latest
|
||||
rust-target: armv7-unknown-linux-gnueabihf
|
||||
cross-packages: gcc-arm-linux-gnueabihf
|
||||
cargo-linker-env: ""
|
||||
cargo-linker: ""
|
||||
cargo-linker-env: CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER
|
||||
cargo-linker: arm-linux-gnueabihf-gcc
|
||||
- target: loongarch64-linux-gnu
|
||||
os: ubuntu-latest
|
||||
rust-target: loongarch64-unknown-linux-gnu
|
||||
cross-packages: gcc-loongarch64-linux-gnu
|
||||
cargo-linker-env: ""
|
||||
cargo-linker: ""
|
||||
- target: powerpc64-linux-gnu
|
||||
cross-packages: ""
|
||||
cargo-linker-env: CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER
|
||||
cargo-linker: zig cc -target loongarch64-linux-gnu
|
||||
- target: powerpc64le-linux-gnu
|
||||
os: ubuntu-latest
|
||||
rust-target: powerpc64le-unknown-linux-gnu
|
||||
cross-packages: gcc-powerpc64-linux-gnu
|
||||
cross-packages: gcc-powerpc64le-linux-gnu
|
||||
cargo-linker-env: ""
|
||||
cargo-linker: ""
|
||||
- target: riscv64-linux-gnu
|
||||
|
|
@ -114,12 +114,12 @@ jobs:
|
|||
cross-packages: ""
|
||||
cargo-linker-env: CARGO_TARGET_X86_64_UNKNOWN_NETBSD_LINKER
|
||||
cargo-linker: zig cc -target x86_64-netbsd
|
||||
- target: x86_64-solaris
|
||||
- target: x86_64-illumos
|
||||
os: ubuntu-latest
|
||||
rust-target: x86_64-pc-solaris
|
||||
rust-target: x86_64-unknown-illumos
|
||||
cross-packages: ""
|
||||
cargo-linker-env: CARGO_TARGET_X86_64_PC_SOLARIS_LINKER
|
||||
cargo-linker: zig cc -target x86_64-solaris
|
||||
cargo-linker-env: CARGO_TARGET_X86_64_UNKNOWN_ILLUMOS_LINKER
|
||||
cargo-linker: zig cc -target x86_64-illumos
|
||||
|
||||
# Additional targets
|
||||
- target: wasm32-freestanding
|
||||
|
|
|
|||
|
|
@ -43,14 +43,26 @@ pub fn build(b: *std.Build) !void {
|
|||
|
||||
var zig_target = target.result;
|
||||
if (zig_target.os.tag == .windows) zig_target.abi = .gnu;
|
||||
// Zig's baseline `.arm` maps to Rust `arm-*`, but rustup ships `armv7-*`.
|
||||
const rust_target_str: []const u8 = if (zig_target.cpu.arch == .arm and zig_target.os.tag == .linux)
|
||||
switch (zig_target.abi) {
|
||||
.gnueabihf, .eabihf => "armv7-unknown-linux-gnueabihf",
|
||||
.gnueabi, .eabi => "armv7-unknown-linux-gnueabi",
|
||||
.musleabihf => "armv7-unknown-linux-musleabihf",
|
||||
.musleabi => "armv7-unknown-linux-musleabi",
|
||||
else => "armv7-unknown-linux-gnueabihf",
|
||||
}
|
||||
else blk: {
|
||||
const rust_target = build_crab.rust.Target.fromZig(zig_target) catch
|
||||
@panic("unable to convert target triple to Rust");
|
||||
break :blk b.fmt("{f}", .{rust_target});
|
||||
};
|
||||
const build_dir = build_crab.addCargoBuild(
|
||||
b,
|
||||
.{
|
||||
.manifest_path = b.path("Cargo.toml"),
|
||||
.cargo_args = if (optimize == .Debug) &.{} else &.{"--release"},
|
||||
.rust_target = .{ .value = b.fmt("{f}", .{rust_target}) },
|
||||
.rust_target = .{ .value = rust_target_str },
|
||||
},
|
||||
.{
|
||||
.optimize = .ReleaseSafe,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue