stdenv: fix meson rust cross compilation

This commit is contained in:
Alyssa Ross 2023-05-09 13:43:23 +00:00
parent e3e57b8f18
commit 506dcaabb4
3 changed files with 3 additions and 20 deletions

View file

@ -17,7 +17,6 @@
, libadwaita
, librsvg
, rustc
, writeText
, cargo
}:
@ -59,16 +58,6 @@ stdenv.mkDerivation rec {
librsvg
];
mesonFlags =
let
# ERROR: 'rust' compiler binary not defined in cross or native file
crossFile = writeText "cross-file.conf" ''
[binaries]
rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
'';
in
lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ];
passthru = {
updateScript = gnome.updateScript {
packageName = pname;

View file

@ -2,7 +2,6 @@
, stdenv
, fetchFromGitLab
, fetchpatch
, writeText
, rustPlatform
, meson
, ninja
@ -204,14 +203,7 @@ stdenv.mkDerivation rec {
) ++ [
(lib.mesonOption "sodium-source" "system")
(lib.mesonEnable "doc" enableDocumentation)
] ++ (let
crossFile = writeText "cross-file.conf" ''
[binaries]
rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
'';
in lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
"--cross-file=${crossFile}"
]);
];
# turn off all auto plugins since we use a list of plugins we generate
mesonAutoFeatures = "disabled";

View file

@ -402,6 +402,7 @@ else let
crossFile = builtins.toFile "cross-file.conf" ''
[properties]
bindgen_clang_arguments = ['-target', '${stdenv.targetPlatform.config}']
needs_exe_wrapper = ${lib.boolToString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)}
[host_machine]
@ -412,6 +413,7 @@ else let
[binaries]
llvm-config = 'llvm-config-native'
rust = ['rustc', '--target', '${stdenv.targetPlatform.rust.rustcTargetSpec}']
'';
crossFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ];
in crossFlags ++ mesonFlags;