[M6] resolver: pkg-config probe + codegen for PkgConfig

This commit is contained in:
2026-05-15 13:03:03 +00:00
parent 4f9b6f1827
commit 6c4933f282
9 changed files with 319 additions and 9 deletions

View File

@@ -77,6 +77,22 @@ auto nix_cmake_scan(const std::filesystem::path& store_path,
const std::string& package_name)
-> util::Result<NixCmakeCandidate>;
// A pkg-config-shaped recipe: the package ships a `.pc` file rather
// than a CMake config. Consumed via `find_package(PkgConfig REQUIRED)`
// + `pkg_check_modules(<NAME> REQUIRED IMPORTED_TARGET <pc_module>)`,
// linking against the generated `PkgConfig::<NAME>` target.
struct PcCandidate {
std::string pc_module; // file stem, e.g. "sqlite3"
std::filesystem::path pc_file; // path to the .pc on disk
};
// Walks <store_path>/lib/pkgconfig/*.pc and picks the best match for
// `package_name`. Returns ResolutionUnknownPackage when no `.pc` file
// is present or none scores acceptably.
auto pc_scan(const std::filesystem::path& store_path,
const std::string& package_name)
-> util::Result<PcCandidate>;
// Output of a conan-center-index recipe scrape.
struct ConanRecipe {
std::string find_package; // e.g. "fmt CONFIG REQUIRED"