Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cc44de3 authored by Neill Kapron's avatar Neill Kapron
Browse files

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: default avatarNeill Kapron <nkapron@google.com>
parent 4f1f049f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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())
			}
		}
	})