diff --git a/meson.options b/meson.options index 12d03017..7e59a5ac 100644 --- a/meson.options +++ b/meson.options @@ -10,3 +10,11 @@ option( value: 'default', description: 'The build profile for Fractal. One of "default", "beta", "development" or "hack".' ) +option( + 'sandboxed', + type : 'boolean', + value : false, + description: 'Whether the build happens in a sandbox.' + + 'When that is the case, cargo will not be able to download the dependencies during' + + 'the build so they are assumed to be in meson.project_source_root()/cargo' +) diff --git a/src/meson.build b/src/meson.build index f9a266e2..c589d51a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -39,7 +39,12 @@ else message('Building in release mode') endif -cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ] +if get_option('sandboxed') + # This is the path used by flatpak-cargo-generator in flatpak-builder-tools + cargo_env = [ 'CARGO_HOME=' + meson.project_source_root() / 'cargo' ] +else + cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ] +endif custom_target( 'cargo-build',