Skip to content

Commit 84386be

Browse files
committed
Migrate to meson
Closes: #1 Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
1 parent 8b4c62c commit 84386be

File tree

47 files changed

+1016
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1016
-63
lines changed

.gitignore

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
build
2+
subprojects/packagecache
23

3-
4-
# Added by cargo
5-
6-
/target
7-
/Cargo.lock
8-
9-
10-
# Added by cargo
11-
#
12-
# already existing elements were commented out
13-
14-
#/target
4+
subprojects/anstyle-[0-9]*
5+
subprojects/bitflags-[0-9]*
6+
subprojects/clap-[0-9]*
7+
subprojects/clap_builder-[0-9]*
8+
subprojects/clap_lex-[0-9]*
9+
subprojects/io-lifetimes-[0-9]*
10+
subprojects/itoa-[0-9]*
11+
subprojects/libc-[0-9]*
12+
subprojects/linux-raw-sys-[0-9]*
13+
subprojects/proc-macro2-[0-9]*
14+
subprojects/quote-[0-9]*
15+
subprojects/rustix-[0-9]*
16+
subprojects/ryu-[0-9]*
17+
subprojects/serde-[0-9]*
18+
subprojects/serde_derive-[0-9]*
19+
subprojects/serde_json-[0-9]*
20+
subprojects/syn-[0-9]*
21+
subprojects/terminal_size-[0-9]*
22+
subprojects/unicode-ident-[0-9]*

Cargo.toml

Lines changed: 0 additions & 22 deletions
This file was deleted.

build.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

meson.build

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+
)

src/bin/efivar.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ use efivar::efi_guids;
33
use std::process::ExitCode;
44

55
fn create_parser() -> clap::Command {
6-
return clap::command!()
6+
return clap::Command::new("efivar")
77
.args_override_self(true)
88
.disable_help_flag(true)
99
.disable_version_flag(true)
10-
.max_term_width(90)
11-
.term_width(90)
10+
.max_term_width(80)
11+
.term_width(80)
1212
.arg(clap::Arg::new("attributes")
1313
.short('A')
1414
.long("attributes")

src/lib/efivar/efi_guids.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ use std::collections::HashMap;
55
use std::fs::File;
66
use std::io::{BufReader, Error};
77
use std::str::FromStr;
8+
use crate::efi_guids_list_path;
89

9-
pub const DEFAULT_GUIDS_LIST_PATH: &'static str = env!("GUIDS_LIST_PATH");
10+
pub const DEFAULT_GUIDS_LIST_PATH: &'static str = efi_guids_list_path::VALUE;
1011

1112
pub enum GuidListSortField {
1213
Guid,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub const VALUE: &'static str = "@GUIDS_LIST_PATH@";

src/lib/efivar/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ pub mod efi_guids;
22
pub mod efivar_display;
33
pub mod types;
44

5+
mod efi_guids_list_path;
6+
57
pub mod efi_variable_attributes {
68
use crate::types::EfiVariableAttribute;
79

subprojects/anstyle-rs.wrap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[wrap-file]
2+
directory = anstyle-1.0.0
3+
4+
source_url = https://crates.io/api/v1/crates/anstyle/1.0.0/download
5+
source_filename = anstyle-1.0.0.tar.gz
6+
source_hash = 41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d
7+
patch_directory = anstyle-1.0.0
8+
9+
[provide]
10+
anstyle-rs = anstyle_rs_dep

subprojects/bitflags-rs.wrap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[wrap-file]
2+
directory = bitflags-1.3.2
3+
4+
source_url = https://crates.io/api/v1/crates/bitflags/1.3.2/download
5+
source_filename = bitflags-1.3.2.tar.gz
6+
source_hash = bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a
7+
patch_directory = bitflags-1.3.2
8+
9+
[provide]
10+
bitflags-rs = bitflags_rs_dep

0 commit comments

Comments
 (0)