From: Arnaud Ferraris <aferraris@debian.org>
Date: Thu, 7 Nov 2024 13:51:41 +0100
Subject: meson.build: fix build for Debian

We don't call `cargo` directly, but use a wrapper script instead, which
breaks some of the expectations. Make the needed changes to ensure the
package still builds.

We also need to override CARGO_HOME, so don't set this env var in
meson.build.

Forwarded: not-needed
---
 meson_options.txt     | 2 ++
 shell/src/meson.build | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index 46730ef..9b32c6f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,3 +18,5 @@ option('sysprof', type: 'feature', value: 'auto', description : 'whether sysprof
 option('keyring', type: 'feature', value: 'enabled', description: 'whether keyring support is requested')
 option('gtk_unix_print', type: 'feature', value: 'auto', description: 'whether gtk+-unix-print support is requested')
 option('spell_check', type: 'feature', value: 'auto', description: 'whether spell check support is requested')
+
+option('host_arch', type: 'string')
diff --git a/shell/src/meson.build b/shell/src/meson.build
index 55c9361..a47479f 100644
--- a/shell/src/meson.build
+++ b/shell/src/meson.build
@@ -34,7 +34,6 @@ endif
 
 cargo_env = environment()
 # it seems that flatpak can't access network during install stage.
-cargo_env.set('CARGO_HOME', build_root / 'cargo-home')
 cargo_env.set('CODEGEN_BUILD_DIR', meson.current_build_dir())
 # override library lookup, we should not use the system library.
 cargo_env.set('SYSTEM_DEPS_PAPERS_VIEW_4_0_NO_PKG_CONFIG', '1')
@@ -75,7 +74,7 @@ custom_target(
   output: meson.project_name(),
   command: [
     'cp',
-    meson.current_build_dir() / rust_target / meson.project_name(),
+    meson.current_build_dir() / get_option('host_arch') / rust_target / meson.project_name(),
     '@OUTPUT@',
   ],
 )
