Skip to main content

Module build_flags

Module build_flags 

Source
Expand description

Read-side ingestion of the conventional C/C++ build-flag environment variables: CPPFLAGS, CFLAGS, CXXFLAGS, and LDFLAGS.

Cabin reads each variable at command start, parses its value into argv tokens using POSIX shell-style word splitting via the shlex crate, and surfaces the result as a typed EnvBuildFlags. The orchestration layer is responsible for merging the parsed flags into the per-package cabin_core::ResolvedProfileFlags map; this module owns the parsing, error wording, and variable attribution only.

Crate boundaries (matching the rest of cabin-env):

  • this module never invokes a shell, reads files, or touches the filesystem;
  • it never depends on cabin-build, cabin-core, or any higher-level crate;
  • it consumes a Fn(&str) -> Option<OsString> env-lookup closure so tests can pump fixture values through without mutating the process environment.

Structs§

EnvBuildFlags
Typed view of the four conventional C/C++ build-flag environment variables, already shell-split into argv tokens.

Enums§

EnvBuildFlagsError
Reason a parse_env_build_flags call failed. Both variants name the offending variable so the diagnostic is actionable.

Constants§

CFLAGS
CFLAGS — flags applied only to C compile commands. Appended to each primary package’s cflags bucket. Never reaches a C++ compile line.
CPPFLAGS
CPPFLAGS — preprocessor flags applied to both C/C++ compile commands. Cabin appends parsed tokens to each primary package’s language-neutral extra_compile_args bucket, after profile / manifest / dependency / pkg-config flags.
CXXFLAGS
CXXFLAGS — flags applied only to C++ compile commands. Appended to each primary package’s cxxflags bucket. Never reaches a C compile line.
LDFLAGS
LDFLAGS — flags applied only to link commands. Appended to each primary package’s ldflags bucket. Never reaches a compile command.

Functions§

parse_env_build_flags
Read CPPFLAGS, CFLAGS, CXXFLAGS, and LDFLAGS through the supplied env-lookup closure, parse each value using POSIX shell-style word splitting (via shlex::split), and return the typed view.