|
| 1 | +project( |
| 2 | + 'refivar', |
| 3 | + 'rust', |
| 4 | + version: '0.1', |
| 5 | + meson_version: '>= 1.1.0', |
| 6 | + default_options: [ |
| 7 | + 'warning_level=3', |
| 8 | + 'rust_std=2021' |
| 9 | + ] |
| 10 | +) |
| 11 | + |
| 12 | +fs = import('fs') |
| 13 | + |
| 14 | +rustc = meson.get_compiler('rust') |
| 15 | +if rustc.version().version_compare('<1.69') |
| 16 | + error('rustc 1.69 required. Found ' + rustc.version()) |
| 17 | +endif |
| 18 | + |
| 19 | +clap_rs_dep = dependency('clap-rs', version: '>=4.1.13') |
| 20 | +serde_rs_dep = dependency('serde-rs', version: '>=1.0.160') |
| 21 | +serde_json_rs_dep = dependency('serde_json-rs', version: '>=1.0.96') |
| 22 | + |
| 23 | +fqDataDir = get_option('prefix') / get_option('datadir') / 'refivar' |
| 24 | + |
| 25 | +lib_refivar_rs_sources = [ |
| 26 | +] |
| 27 | + |
| 28 | +lib_refivar_guids_json = ( |
| 29 | + meson.project_source_root() / 'src' / 'lib' / 'efivar' / 'guids.json' |
| 30 | +) |
| 31 | +lib_refivar_guids_json_install_path = ( |
| 32 | + get_option('prefix') / get_option('datadir') / 'refivar' / fs.name(lib_refivar_guids_json) |
| 33 | +) |
| 34 | + |
| 35 | +lib_refivar_guids_list_path_rs_conf_data = configuration_data() |
| 36 | +lib_refivar_guids_list_path_rs_conf_data.set( |
| 37 | + 'GUIDS_LIST_PATH', |
| 38 | + lib_refivar_guids_json_install_path |
| 39 | +) |
| 40 | + |
| 41 | +lib_refivar_efi_guids_list_path_rs = configure_file( |
| 42 | + output: 'efi_guids_list_path.rs', |
| 43 | + input: 'src/lib/efivar/efi_guids_list_path.rs.in', |
| 44 | + configuration: lib_refivar_guids_list_path_rs_conf_data |
| 45 | +) |
| 46 | + |
| 47 | +install_data( |
| 48 | + lib_refivar_guids_json, |
| 49 | + install_dir : fs.parent(lib_refivar_guids_json_install_path) |
| 50 | +) |
| 51 | + |
| 52 | +lib_refivar = static_library( |
| 53 | + 'efivar', |
| 54 | + structured_sources( |
| 55 | + [ |
| 56 | + 'src/lib/efivar/mod.rs', |
| 57 | + 'src/lib/efivar/efi_guids.rs', |
| 58 | + 'src/lib/efivar/efivar_display.rs', |
| 59 | + lib_refivar_efi_guids_list_path_rs |
| 60 | + ], |
| 61 | + { |
| 62 | + 'types': [ |
| 63 | + 'src/lib/efivar/types/efi_guid_error.rs', |
| 64 | + 'src/lib/efivar/types/efi_guid_list_entry.rs', |
| 65 | + 'src/lib/efivar/types/efi_guid.rs', |
| 66 | + 'src/lib/efivar/types/efi_variable_attribute.rs', |
| 67 | + 'src/lib/efivar/types/efi_variable.rs', |
| 68 | + 'src/lib/efivar/types/mod.rs' |
| 69 | + ], |
| 70 | + } |
| 71 | + ), |
| 72 | + rust_crate_type: 'lib', |
| 73 | + dependencies: [ |
| 74 | + serde_json_rs_dep, |
| 75 | + serde_rs_dep |
| 76 | + ], |
| 77 | + install: false, |
| 78 | +) |
| 79 | + |
| 80 | +# static_library('efivar', 'efivar.rs', rust_crate_type: 'staticlib', |
| 81 | +# install : true) |
| 82 | +# shared_library('efivar', 'efivar.rs', rust_crate_type: 'cdylib', |
| 83 | +# install : true) |
| 84 | + |
| 85 | +executable( |
| 86 | + 'efivar', |
| 87 | + 'src/bin/efivar.rs', |
| 88 | + link_with: lib_refivar, |
| 89 | + dependencies: [ |
| 90 | + clap_rs_dep, |
| 91 | + serde_rs_dep, |
| 92 | + serde_json_rs_dep |
| 93 | + ], |
| 94 | + install: true |
| 95 | +) |
0 commit comments