Avoid conflicts between architectures in prebuilt_renderscript_bitcode

The NDK build has 4 architectures, x86 and arm 32-bit architectures and
x86_64 and arm64 64-bit architectures.  Multilib on its own is not
enough to prevent collisions in install locations.  Detect conflicts
and add the architecture to the path the same way cc/installer.go does.

Bug: 308212344
Test: OUT_DIR=out build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: If7a1b062035dda87f5f8129062778c41c43de17b
This commit is contained in:
Colin Cross
2023-11-13 12:12:06 -08:00
parent 692f54baeb
commit 2f63457354

View File

@@ -150,8 +150,9 @@ type PrebuiltEtc struct {
sourceFilePath android.Path sourceFilePath android.Path
outputFilePath android.OutputPath outputFilePath android.OutputPath
// The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share. // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
installDirBase string installDirBase string
installDirBase64 string installDirBase64 string
installAvoidMultilibConflict bool
// The base install location when soc_specific property is set to true, e.g. "firmware" for // The base install location when soc_specific property is set to true, e.g. "firmware" for
// prebuilt_firmware. // prebuilt_firmware.
socInstallDirBase string socInstallDirBase string
@@ -355,6 +356,10 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if p.SocSpecific() && p.socInstallDirBase != "" { if p.SocSpecific() && p.socInstallDirBase != "" {
installBaseDir = p.socInstallDirBase installBaseDir = p.socInstallDirBase
} }
if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String())
}
p.installDirPath = android.PathForModuleInstall(ctx, installBaseDir, p.SubDir()) p.installDirPath = android.PathForModuleInstall(ctx, installBaseDir, p.SubDir())
// Call InstallFile even when uninstallable to make the module included in the package // Call InstallFile even when uninstallable to make the module included in the package
@@ -590,6 +595,7 @@ func PrebuiltRenderScriptBitcodeFactory() android.Module {
module := &PrebuiltEtc{} module := &PrebuiltEtc{}
module.makeClass = "RENDERSCRIPT_BITCODE" module.makeClass = "RENDERSCRIPT_BITCODE"
module.installDirBase64 = "lib64" module.installDirBase64 = "lib64"
module.installAvoidMultilibConflict = true
InitPrebuiltEtcModule(module, "lib") InitPrebuiltEtcModule(module, "lib")
// This module is device-only // This module is device-only
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth) android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)