Files
depot/contrib/depot.d/build.toml
T
SFG545 5c33a36100 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.
2026-05-27 14:39:01 -05:00

55 lines
1.6 KiB
TOML

[flags]
# Example /etc/depot.d/build.toml
#
# Drop-in build defaults. This file is a good place for policy that should
# apply everywhere without crowding the main /etc/depot.toml.
# Toolchain selection.
# tool_dir = "/usr/bin"
cc = "clang"
# cxx = "$TOOL_DIR/clang++"
# ar = "$TOOL_DIR/ar"
# ranlib = "$TOOL_DIR/ranlib"
# strip = "$TOOL_DIR/strip"
# ld = "$TOOL_DIR/ld.lld"
# nm = "$TOOL_DIR/nm"
# objcopy = "$TOOL_DIR/objcopy"
# objdump = "$TOOL_DIR/objdump"
# readelf = "$TOOL_DIR/readelf"
# Compiler defaults. These are merged with package-level flags unless a package
# explicitly replaces them.
cflags = ["-O2"]
cflags += ["-pipe"]
# cxxflags = ["-O2", "-pipe"]
# Linker defaults.
ldflags = ["-Wl,-O1"]
# Select a linker through compiler drivers such as clang/gcc.
# fuse_ld = "lld"
# Link-time optimization policy.
ltoflags = ["-flto=auto"]
# Rust-specific LTO flags appended only to RUSTFLAGS when use_lto is enabled.
# rustltoflags = ["-Clinker-plugin-lto"]
use_lto = true
# Architecture defaults. Packages may still override this when needed.
carch = "x86_64"
# chost = "x86_64-sfg-linux-gnu"
# cbuild = "x86_64-sfg-linux-gnu"
# Optional install directory overrides for supported builders.
# bindir = "/usr/bin"
# libdir = "/usr/lib"
# sysconfdir = "/etc"
# Example of additive layering in depot.d:
# cflags += ["-fstack-clash-protection"]
# ldflags += ["-Wl,-z,relro", "-Wl,-z,now"]
# Avoid host-specific tuning such as -march=native in shared system configs
# unless every package built on this machine is intended only for this machine.
# cflags += ["-march=native"]