diff --git a/credentialsd-common/meson.build b/credentialsd-common/meson.build index d1462102..74ee4273 100644 --- a/credentialsd-common/meson.build +++ b/credentialsd-common/meson.build @@ -35,5 +35,8 @@ # cargo_options += [ # '--target-dir', meson.project_build_root() / meson.current_build_dir() / 'target', # ] +# if get_option('cargo_offline') == true +# cargo_options += ['--offline'] +# endif # -# subdir('src') +# subdir('src') \ No newline at end of file diff --git a/credentialsd-common/src/meson.build b/credentialsd-common/src/meson.build index 441a13a9..938dd189 100644 --- a/credentialsd-common/src/meson.build +++ b/credentialsd-common/src/meson.build @@ -10,7 +10,7 @@ # message('Building in debug mode') # endif # -# cargo_env = ['CARGO_HOME=' + meson.project_build_root() / 'cargo-home'] +# cargo_env = ['CARGO_HOME=' + cargo_home] # # custom_target( # 'cargo-build', @@ -31,4 +31,4 @@ # common_lib_name / 'src' / rust_target / common_lib_name, # '@OUTPUT@', # ], -# ) +# ) \ No newline at end of file diff --git a/credentialsd-ui/meson.build b/credentialsd-ui/meson.build index 7fdb3f1d..d2e2cb31 100644 --- a/credentialsd-ui/meson.build +++ b/credentialsd-ui/meson.build @@ -63,6 +63,14 @@ if get_option('profile') == 'development' run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit', check: false) endif +cargo_options = [ + '--manifest-path', meson.project_source_root() / gui_source_dir / 'Cargo.toml', +] +cargo_options += ['--target-dir', meson.project_build_root() / gui_build_dir / 'target'] +if get_option('cargo_offline') == true + cargo_options += ['--offline'] +endif + subdir('data') subdir('po') subdir('src') diff --git a/credentialsd-ui/src/meson.build b/credentialsd-ui/src/meson.build index c2cc648d..069a072b 100644 --- a/credentialsd-ui/src/meson.build +++ b/credentialsd-ui/src/meson.build @@ -22,11 +22,6 @@ run_command( check: true, ) -cargo_options = [ - '--manifest-path', meson.project_source_root() / gui_source_dir / 'Cargo.toml', -] -cargo_options += ['--target-dir', meson.project_build_root() / gui_build_dir / 'target'] - if get_option('profile') == 'default' cargo_options += ['--release'] rust_target = 'release' @@ -36,7 +31,7 @@ else message('Building in debug mode') endif -cargo_env = ['CARGO_HOME=' + meson.project_build_root() / 'cargo-home'] +cargo_env = ['CARGO_HOME=' + cargo_home] custom_target( 'cargo-build', @@ -72,4 +67,4 @@ test( '--nocapture', ], protocol: 'exitcode', -) +) \ No newline at end of file diff --git a/credentialsd/meson.build b/credentialsd/meson.build index f1114a7f..4a34cd1f 100644 --- a/credentialsd/meson.build +++ b/credentialsd/meson.build @@ -48,6 +48,9 @@ cargo_options = [ cargo_options += [ '--target-dir', meson.project_build_root() / meson.current_build_dir() / 'target', ] +if get_option('cargo_offline') == true + cargo_options += ['--offline'] +endif subdir('src') -subdir('tests') +subdir('tests') \ No newline at end of file diff --git a/credentialsd/src/meson.build b/credentialsd/src/meson.build index 434fee12..5dc69d6f 100644 --- a/credentialsd/src/meson.build +++ b/credentialsd/src/meson.build @@ -7,7 +7,7 @@ else message('Building in debug mode') endif -cargo_env = ['CARGO_HOME=' + meson.project_build_root() / 'cargo-home'] +cargo_env = ['CARGO_HOME=' + cargo_home] message('@0@'.format(cargo_options)) custom_target( @@ -43,4 +43,4 @@ test( '--nocapture', ], protocol: 'exitcode', -) +) \ No newline at end of file diff --git a/meson.build b/meson.build index a33b7ccf..a6ddb734 100644 --- a/meson.build +++ b/meson.build @@ -12,6 +12,11 @@ prefix = get_option('prefix') bindir = prefix / get_option('bindir') localedir = prefix / get_option('localedir') +cargo_home = get_option('cargo_home') +if cargo_home == '' + cargo_home = meson.project_build_root() / 'cargo-home' +endif + meson.add_dist_script( 'build-aux/dist-vendor.sh', meson.project_build_root() / 'meson-dist' / meson.project_name() diff --git a/meson.options b/meson.options new file mode 100644 index 00000000..75adcb6b --- /dev/null +++ b/meson.options @@ -0,0 +1,18 @@ +option( + 'profile', + type: 'combo', + choices: ['default', 'development'], + value: 'default', + description: 'The build profile for Credential Manager. One of "default" or "development".', +) +option( + 'cargo_home', + type: 'string', + description: 'The directory to store files downloaded by Cargo', +) +option( + 'cargo_offline', + type: 'boolean', + value: false, + description: 'Whether to perform an offline build with Cargo. Defaults to false to download crates from registries.', +) \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt deleted file mode 100644 index 31befaff..00000000 --- a/meson_options.txt +++ /dev/null @@ -1,10 +0,0 @@ -option( - 'profile', - type: 'combo', - choices: [ - 'default', - 'development' - ], - value: 'default', - description: 'The build profile for Credential Manager. One of "default" or "development".' -)