Soong: libbpf_prog: add support for header_libs

Add header_libs support for libbpf_prog modules.

Test: TH / manual
Bug: 359646531
Change-Id: I9e705645582ec12bfa0a2e388d0049bb472456e3
Signed-off-by: Neill Kapron <nkapron@google.com>
This commit is contained in:
Neill Kapron
2024-09-16 20:08:13 +00:00
parent 4f1f049f5c
commit 3cc44de313

View File

@@ -89,6 +89,8 @@ type LibbpfProgProperties struct {
// be added to the include path using -I // be added to the include path using -I
Local_include_dirs []string `android:"arch_variant"` Local_include_dirs []string `android:"arch_variant"`
Header_libs []string `android:"arch_variant"`
// optional subdirectory under which this module is installed into. // optional subdirectory under which this module is installed into.
Relative_install_path string Relative_install_path string
} }
@@ -141,6 +143,7 @@ func (libbpf *libbpfProg) SetImageVariation(ctx android.BaseModuleContext, varia
func (libbpf *libbpfProg) DepsMutator(ctx android.BottomUpMutatorContext) { func (libbpf *libbpfProg) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddDependency(ctx.Module(), libbpfProgDepTag, "libbpf_headers") ctx.AddDependency(ctx.Module(), libbpfProgDepTag, "libbpf_headers")
ctx.AddVariationDependencies(nil, cc.HeaderDepTag(), libbpf.properties.Header_libs...)
} }
func (libbpf *libbpfProg) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (libbpf *libbpfProg) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -182,6 +185,11 @@ func (libbpf *libbpfProg) GenerateAndroidBuildActions(ctx android.ModuleContext)
depName := ctx.OtherModuleName(dep) depName := ctx.OtherModuleName(dep)
ctx.ModuleErrorf("module %q is not a genrule", depName) ctx.ModuleErrorf("module %q is not a genrule", depName)
} }
} else if depTag == cc.HeaderDepTag() {
depExporterInfo, _ := android.OtherModuleProvider(ctx, dep, cc.FlagExporterInfoProvider)
for _, dir := range depExporterInfo.IncludeDirs {
cflags = append(cflags, "-I "+dir.String())
}
} }
}) })