From 3cc44de313908be78ee55e6b4e49f21bf1d5a630 Mon Sep 17 00:00:00 2001 From: Neill Kapron Date: Mon, 16 Sep 2024 20:08:13 +0000 Subject: [PATCH] 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 --- bpf/libbpf/libbpf_prog.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bpf/libbpf/libbpf_prog.go b/bpf/libbpf/libbpf_prog.go index f9f64f57c..ac6151040 100644 --- a/bpf/libbpf/libbpf_prog.go +++ b/bpf/libbpf/libbpf_prog.go @@ -89,6 +89,8 @@ type LibbpfProgProperties struct { // be added to the include path using -I Local_include_dirs []string `android:"arch_variant"` + Header_libs []string `android:"arch_variant"` + // optional subdirectory under which this module is installed into. Relative_install_path string } @@ -141,6 +143,7 @@ func (libbpf *libbpfProg) SetImageVariation(ctx android.BaseModuleContext, varia func (libbpf *libbpfProg) DepsMutator(ctx android.BottomUpMutatorContext) { ctx.AddDependency(ctx.Module(), libbpfProgDepTag, "libbpf_headers") + ctx.AddVariationDependencies(nil, cc.HeaderDepTag(), libbpf.properties.Header_libs...) } func (libbpf *libbpfProg) GenerateAndroidBuildActions(ctx android.ModuleContext) { @@ -182,6 +185,11 @@ func (libbpf *libbpfProg) GenerateAndroidBuildActions(ctx android.ModuleContext) depName := ctx.OtherModuleName(dep) 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()) + } } })