From 42feb53c861ed4cf4d07830e2cbed851c530ccee Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 21 Jun 2024 11:30:29 +0200 Subject: [PATCH] Cross compile for ARMv7, Aarch64 and RISC-V 64 Adds CI cross-compilation tests for those architectures. Requires the host to be able to run thos binaries via binfmt. See: https://docs.kernel.org/admin-guide/binfmt-misc.html --- .gitlab-ci.yml | 21 +++++++++++++++++++++ flake.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9f82903..118da17 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,3 +55,24 @@ build:compilers: - nix script: - nix build -L --no-link .#ovniPackages.compilers + +build:armv7: + stage: build + tags: + - nix + script: + - nix build -L --no-link .#ovniPackages.armv7 + +build:aarch64: + stage: build + tags: + - nix + script: + - nix build -L --no-link .#ovniPackages.aarch64 + +build:riscv64: + stage: build + tags: + - nix + script: + - nix build -L --no-link .#ovniPackages.riscv64 diff --git a/flake.nix b/flake.nix index 07230fd..7b3b10b 100644 --- a/flake.nix +++ b/flake.nix @@ -135,6 +135,33 @@ export ASAN_OPTIONS=detect_leaks=0 ''; }); + + armv7 = (pkgs.pkgsCross.armv7l-hf-multiplatform.ovniLocal.overrideAttrs (old: { + pname = "ovni-armv7"; + buildInputs = []; + nativeBuildInputs = [ pkgs.pkgsCross.armv7l-hf-multiplatform.buildPackages.cmake ]; + cmakeFlags = old.cmakeFlags ++ [ "-DUSE_MPI=OFF" ]; + })).overrideDerivation (old: { + doCheck = true; + }); + + aarch64 = (pkgs.pkgsCross.aarch64-multiplatform.ovniLocal.overrideAttrs (old: { + pname = "ovni-aarch64"; + buildInputs = []; + nativeBuildInputs = [ pkgs.pkgsCross.aarch64-multiplatform.buildPackages.cmake ]; + cmakeFlags = old.cmakeFlags ++ [ "-DUSE_MPI=OFF" ]; + })).overrideDerivation (old: { + doCheck = true; + }); + + riscv64 = (pkgs.pkgsCross.riscv64.ovniLocal.overrideAttrs (old: { + pname = "ovni-riscv64"; + buildInputs = []; + nativeBuildInputs = [ pkgs.pkgsCross.riscv64.buildPackages.cmake ]; + cmakeFlags = old.cmakeFlags ++ [ "-DUSE_MPI=OFF" ]; + })).overrideDerivation (old: { + doCheck = true; + }); }; }; }