Integrate metadata documentation and jhalfs manifests
This commit is contained in:
parent
74bf8a32d6
commit
3ce470e019
34 changed files with 5544 additions and 240 deletions
74
src/pkgs/package.rs
Normal file
74
src/pkgs/package.rs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// High-level description of a package managed by LPKG.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PackageDefinition {
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub source: Option<String>,
|
||||
pub md5: Option<String>,
|
||||
pub configure_args: Vec<String>,
|
||||
pub build_commands: Vec<String>,
|
||||
pub install_commands: Vec<String>,
|
||||
pub dependencies: Vec<String>,
|
||||
pub optimizations: OptimizationSettings,
|
||||
}
|
||||
|
||||
impl PackageDefinition {
|
||||
pub fn new(name: impl Into<String>, version: impl Into<String>) -> Self {
|
||||
Self {
|
||||
name: name.into(),
|
||||
version: version.into(),
|
||||
source: None,
|
||||
md5: None,
|
||||
configure_args: Vec::new(),
|
||||
build_commands: Vec::new(),
|
||||
install_commands: Vec::new(),
|
||||
dependencies: Vec::new(),
|
||||
optimizations: OptimizationSettings::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Tunable compiler and linker flags applied during package builds.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct OptimizationSettings {
|
||||
pub enable_lto: bool,
|
||||
pub enable_pgo: bool,
|
||||
pub cflags: Vec<String>,
|
||||
pub ldflags: Vec<String>,
|
||||
pub profdata: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for OptimizationSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enable_lto: true,
|
||||
enable_pgo: true,
|
||||
cflags: vec![
|
||||
"-O3".to_string(),
|
||||
"-flto".to_string(),
|
||||
"-fprofile-generate".to_string(),
|
||||
],
|
||||
ldflags: vec!["-flto".to_string(), "-fprofile-generate".to_string()],
|
||||
profdata: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl OptimizationSettings {
|
||||
/// Convenience helper for disabling instrumentation once profile data has been gathered.
|
||||
pub fn for_pgo_replay(profdata: impl Into<String>) -> Self {
|
||||
Self {
|
||||
enable_lto: true,
|
||||
enable_pgo: true,
|
||||
cflags: vec![
|
||||
"-O3".to_string(),
|
||||
"-flto".to_string(),
|
||||
"-fprofile-use".to_string(),
|
||||
],
|
||||
ldflags: vec!["-flto".to_string(), "-fprofile-use".to_string()],
|
||||
profdata: Some(profdata.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue