feat: update user configuration example and add development package support
- Enhanced the user.depot.toml.example file with additional comments and options for user-local preferences. - Bumped version from 0.35.0 to 0.35.1 in meson.build. - Introduced a new option for DEPOT_DEVELOPMENT_PACKAGE in meson_options.txt. - Added functions to handle the requested development package in build_options.rs. - Updated various builder files (autotools.rs, cmake.rs, custom.rs, meson.rs, perl.rs) to support passing build flags. - Implemented checks for the required development package during source builds in commands.rs and commands/build_cmd.rs. - Added tests to ensure the correct behavior of development package requirements and source build warnings. - Modified manual source handling in source/mod.rs to validate local manual sources before proceeding with builds. - Updated cargo build and test scripts to accept a new development package argument. - Added VSCode settings to disable automatic configuration on open.
This commit is contained in:
+53
-7
@@ -12,7 +12,7 @@ mod rust;
|
||||
pub mod state;
|
||||
|
||||
use crate::cross::CrossConfig;
|
||||
use crate::package::{BuildType, PackageSpec};
|
||||
use crate::package::{BuildFlags, BuildType, PackageSpec};
|
||||
use anyhow::{Context, Result};
|
||||
use std::ffi::OsString;
|
||||
use std::fs;
|
||||
@@ -188,12 +188,20 @@ pub(crate) fn requested_static_build() -> Result<Option<bool>> {
|
||||
crate::build_options::requested_static_build()
|
||||
}
|
||||
|
||||
pub(crate) fn static_build_args_for(build_type: BuildType) -> Result<Vec<String>> {
|
||||
let Some(enabled) = requested_static_build()? else {
|
||||
return Ok(Vec::new());
|
||||
fn static_build_args_for_request(
|
||||
build_type: BuildType,
|
||||
requested_static: Option<bool>,
|
||||
no_delete_static: bool,
|
||||
) -> Vec<String> {
|
||||
let Some(enabled) = requested_static else {
|
||||
return Vec::new();
|
||||
};
|
||||
|
||||
let args = match build_type {
|
||||
if !enabled && no_delete_static {
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
match build_type {
|
||||
BuildType::Autotools => vec![if enabled {
|
||||
"--enable-static".to_string()
|
||||
} else {
|
||||
@@ -212,9 +220,18 @@ pub(crate) fn static_build_args_for(build_type: BuildType) -> Result<Vec<String>
|
||||
if enabled { "static" } else { "dynamic" }
|
||||
)],
|
||||
_ => Vec::new(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Ok(args)
|
||||
pub(crate) fn static_build_args_for(
|
||||
build_type: BuildType,
|
||||
flags: &BuildFlags,
|
||||
) -> Result<Vec<String>> {
|
||||
Ok(static_build_args_for_request(
|
||||
build_type,
|
||||
requested_static_build()?,
|
||||
flags.no_delete_static,
|
||||
))
|
||||
}
|
||||
|
||||
pub(crate) fn build_tool_package_option(build_type: BuildType) -> Option<&'static str> {
|
||||
@@ -225,6 +242,14 @@ pub(crate) fn requested_build_tool_package(build_type: BuildType) -> Option<Stri
|
||||
crate::build_options::requested_build_tool_package(build_type)
|
||||
}
|
||||
|
||||
pub(crate) fn development_package_option() -> &'static str {
|
||||
crate::build_options::development_package_option()
|
||||
}
|
||||
|
||||
pub(crate) fn requested_development_package() -> Option<String> {
|
||||
crate::build_options::requested_development_package()
|
||||
}
|
||||
|
||||
fn configured_install_dir(value: &str, default: &str) -> String {
|
||||
let trimmed = value.trim();
|
||||
if trimmed.is_empty() {
|
||||
@@ -943,6 +968,27 @@ mod tests {
|
||||
assert_eq!(build_tool_package_option(BuildType::Bin), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_static_build_args_skip_disable_static_when_no_delete_static_enabled() {
|
||||
let args = static_build_args_for_request(BuildType::Autotools, Some(false), true);
|
||||
assert!(args.is_empty());
|
||||
|
||||
let args = static_build_args_for_request(BuildType::CMake, Some(false), true);
|
||||
assert!(args.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_static_build_args_keep_other_requested_modes() {
|
||||
assert_eq!(
|
||||
static_build_args_for_request(BuildType::Autotools, Some(false), false),
|
||||
vec!["--disable-static".to_string()]
|
||||
);
|
||||
assert_eq!(
|
||||
static_build_args_for_request(BuildType::Meson, Some(true), true),
|
||||
vec!["-Ddefault_library=static".to_string()]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_standard_build_env_exports_native_linker_and_cpp() {
|
||||
let mut spec = mk_spec(Vec::new(), Vec::new());
|
||||
|
||||
Reference in New Issue
Block a user