Merge "Add support for packaging static libs in the NDK."
This commit is contained in:
@@ -70,6 +70,8 @@ type LibraryProperties struct {
|
|||||||
Version_script *string `android:"arch_variant"`
|
Version_script *string `android:"arch_variant"`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Static_ndk_lib bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type LibraryMutatedProperties struct {
|
type LibraryMutatedProperties struct {
|
||||||
@@ -83,6 +85,9 @@ type LibraryMutatedProperties struct {
|
|||||||
VariantIsShared bool `blueprint:"mutated"`
|
VariantIsShared bool `blueprint:"mutated"`
|
||||||
// This variant is static
|
// This variant is static
|
||||||
VariantIsStatic bool `blueprint:"mutated"`
|
VariantIsStatic bool `blueprint:"mutated"`
|
||||||
|
// Location of the static library in the sysroot. Empty if the library is
|
||||||
|
// not included in the NDK.
|
||||||
|
NdkSysrootPath string `blueprint:"mutated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FlagExporterProperties struct {
|
type FlagExporterProperties struct {
|
||||||
@@ -721,6 +726,20 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
|
|||||||
}
|
}
|
||||||
library.baseInstaller.install(ctx, file)
|
library.baseInstaller.install(ctx, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if library.Properties.Static_ndk_lib && library.static() {
|
||||||
|
installPath := getNdkSysrootBase(ctx).Join(
|
||||||
|
ctx, "usr/lib", ctx.toolchain().ClangTriple(), file.Base())
|
||||||
|
|
||||||
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
||||||
|
Rule: android.Cp,
|
||||||
|
Description: "install " + installPath.Base(),
|
||||||
|
Output: installPath,
|
||||||
|
Input: file,
|
||||||
|
})
|
||||||
|
|
||||||
|
library.MutatedProperties.NdkSysrootPath = installPath.String()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) static() bool {
|
func (library *libraryDecorator) static() bool {
|
||||||
|
@@ -108,6 +108,12 @@ func (n *ndkSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
|
|||||||
if installer, ok := m.installer.(*stubDecorator); ok {
|
if installer, ok := m.installer.(*stubDecorator); ok {
|
||||||
installPaths = append(installPaths, installer.installPath)
|
installPaths = append(installPaths, installer.installPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if library, ok := m.linker.(*libraryDecorator); ok {
|
||||||
|
if library.MutatedProperties.NdkSysrootPath != "" {
|
||||||
|
installPaths = append(installPaths, library.MutatedProperties.NdkSysrootPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user