make target mandatory input

This commit is contained in:
Clément DOUIN
2024-11-24 23:05:41 +01:00
parent 3852b5abca
commit 44d94be99d
5 changed files with 72 additions and 50 deletions
+12 -5
View File
@@ -11,23 +11,31 @@ jobs:
matrix:
include:
- target: aarch64-apple-darwin
artifact: macos.aarch64
os: macos-14
- target: aarch64-unknown-linux-musl
artifact: linux.aarch64
os: ubuntu-latest
- target: armv6l-unknown-linux-musleabihf
artifact: linux.armv6l
os: ubuntu-latest
- target: armv7l-unknown-linux-musleabihf
artifact: linux.armv7l
os: ubuntu-latest
- target: i686-unknown-linux-musl
artifact: linux.i686
os: ubuntu-latest
- target: i686-w64-mingw32
artifact: windows.i686
os: ubuntu-latest
# FIXME
# - target: i686-w64-mingw32
# os: ubuntu-latest
- target: x86_64-apple-darwin
artifact: macos.x86_64
os: macos-13
- target: x86_64-unknown-linux-musl
artifact: linux.x86_64
os: ubuntu-latest
- target: x86_64-w64-mingw32
artifact: windows.x86_64
os: ubuntu-latest
steps:
- name: Checkout code
@@ -37,7 +45,6 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-24.05
enable_kvm: true
# extra_nix_config: "experimental-features = nix-command flakes"
- name: Cache Nix store
uses: cachix/cachix-action@v15
with:
@@ -50,7 +57,7 @@ jobs:
- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: "himalaya.${{ matrix.target }}"
name: "himalaya.${{ matrix.artifact }}"
path: |
result/bin/himalaya*
result/bin/share
-30
View File
@@ -1,30 +0,0 @@
# The first level represents the build platform system, and the second
# level represents the build platform triple config.
{
x86_64-linux = {
x86_64-unknown-linux-musl = { };
aarch64-unknown-linux-musl = {
runner = { qemu, ... }: "${qemu}/bin/qemu-aarch64 ./himalaya";
};
x86_64-pc-windows-gnu = {
runner = { wine, ... }:
let wine64 = wine.override { wineBuild = "wine64"; };
in "${wine64}/bin/wine64 ./himalaya.exe";
};
};
aarch64-linux = {
x86_64-unknown-linux-musl = { };
};
x86_64-darwin = {
x86_64-apple-darwin = { };
};
aarch64-darwin = {
aarch64-apple-darwin = { };
};
}
+14 -7
View File
@@ -1,11 +1,18 @@
{ target ? null, defaultFeatures ? true, features ? "" }:
{ target
, defaultFeatures ? true
, features ? ""
}:
let
pkgs = import <nixpkgs> (
if isNull target then { } else {
crossSystem = { isStatic = true; config = target; };
}
);
systems = import ./systems.nix;
inherit (systems.${target}) rustTarget isStatic;
pkgs = import <nixpkgs> {
crossSystem = {
inherit isStatic;
config = target;
};
};
inherit (pkgs) lib hostPlatform;
@@ -15,7 +22,7 @@ let
rustToolchain = mkToolchain.fromTarget {
inherit lib;
targetSystem = hostPlatform.config;
targetSystem = rustTarget;
};
rustPlatform = pkgs.makeRustPlatform {
-8
View File
@@ -28,19 +28,11 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-YS8IamapvmdrOPptQh2Ef9Yold0IK1XIeGs0kDIQ5b8=";
# TARGET_CC = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
# CARGO_BUILD_RUSTFLAGS = [
# "-Clinker=${TARGET_CC}"
# "-Clink-args=-static -latomic"
# "-Ctarget-feature=+crt-static"
# ];
# unit tests only
doCheck = false;
cargoTestFlags = [ "--lib" ];
nativeBuildInputs = [ ]
++ lib.optional hostPlatform.isDarwin [ darwin.libiconv ]
++ lib.optional (installManPages || installShellCompletions) installShellFiles;
buildInputs = [ ]
+46
View File
@@ -0,0 +1,46 @@
{
aarch64-apple-darwin = {
rustTarget = "aarch64-apple-darwin";
isStatic = false;
};
aarch64-unknown-linux-musl = {
rustTarget = "aarch64-unknown-linux-musl";
isStatic = true;
};
armv6l-unknown-linux-musleabihf = {
rustTarget = "arm-unknown-linux-musleabihf";
isStatic = true;
};
armv7l-unknown-linux-musleabihf = {
rustTarget = "armv7-unknown-linux-musleabihf";
isStatic = true;
};
i686-unknown-linux-musl = {
rustTarget = "i686-unknown-linux-musl";
isStatic = true;
};
i686-w64-mingw32 = {
rustTarget = "i686-pc-windows-gnu";
isStatic = false;
};
x86_64-apple-darwin = {
rustTarget = "x86_64-apple-darwin";
isStatic = false;
};
x86_64-unknown-linux-musl = {
rustTarget = "x86_64-unknown-linux-musl";
isStatic = true;
};
x86_64-w64-mingw32 = {
rustTarget = "x86_64-pc-windows-gnu";
isStatic = false;
};
}