Refactor build flags handling and add tool alias management

- Introduced a new method `apply_default_string` to streamline the application of default values for string fields in build flags.
- Enhanced `apply_flags_table` to utilize the new method for setting various build flags, improving code readability and maintainability.
- Added support for additional build flags: `fuse_ld`, `ranlib`, `strip`, `nm`, `objcopy`, `objdump`, and `readelf`.
- Implemented a new command `set` to manage tool aliases for compilers, linkers, and shells, allowing users to set preferred tools in the build environment.
- Improved error handling and validation for tool alias configuration, ensuring that existing non-symlink files are not replaced.
- Added tests to verify the correct behavior of tool alias management and build flag application.
This commit is contained in:
2026-05-27 14:39:01 -05:00
parent 1833a2c42d
commit 5c33a36100
23 changed files with 1895 additions and 170 deletions
+5 -1
View File
@@ -10,8 +10,11 @@
prefix = "/usr/local"
# Personal toolchain preference.
# tool_dir = "/usr/bin"
cc = "clang"
# cxx = "clang++"
# cxx = "$TOOL_DIR/clang++"
# ranlib = "$TOOL_DIR/ranlib"
# strip = "$TOOL_DIR/strip"
[build.flags]
# User-local compiler preferences.
@@ -22,6 +25,7 @@ carch = "x86_64"
# Examples:
# cxxflags = ["-O2", "-g"]
# ldflags = ["-Wl,-O1"]
# fuse_ld = "lld"
# makeflags = "-j4"
# Optional install directory overrides for supported builders.