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

Commit 90b9bbc5 authored by Dan Albert's avatar Dan Albert
Browse files

Don't use libandroid_support post-21.

Test: m checkbuild
Bug: http://b/119587551
Change-Id: I7ee1cdc7c0119dbec0e57522b9b494aeb3c16a43
parent a3b83662
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package cc
import (
	"android/soong/android"
	"fmt"
	"strconv"
)

func getNdkStlFamily(m *Module) string {
@@ -110,6 +111,26 @@ func (stl *stl) begin(ctx BaseModuleContext) {
	}()
}

func needsLibAndroidSupport(ctx BaseModuleContext) bool {
	versionStr, err := normalizeNdkApiLevel(ctx, ctx.sdkVersion(), ctx.Arch())
	if err != nil {
		ctx.PropertyErrorf("sdk_version", err.Error())
	}

	if versionStr == "current" {
		return false
	}

	version, err := strconv.Atoi(versionStr)
	if err != nil {
		panic(fmt.Sprintf(
			"invalid API level returned from normalizeNdkApiLevel: %q",
			versionStr))
	}

	return version < 21
}

func (stl *stl) deps(ctx BaseModuleContext, deps Deps) Deps {
	switch stl.Properties.SelectedStl {
	case "libstdc++":
@@ -141,7 +162,9 @@ func (stl *stl) deps(ctx BaseModuleContext, deps Deps) Deps {
		} else {
			deps.StaticLibs = append(deps.StaticLibs, stl.Properties.SelectedStl, "ndk_libc++abi")
		}
		if needsLibAndroidSupport(ctx) {
			deps.StaticLibs = append(deps.StaticLibs, "ndk_libandroid_support")
		}
		if ctx.Arch().ArchType == android.Arm {
			deps.StaticLibs = append(deps.StaticLibs, "ndk_libunwind")
		}