diff options
-rw-r--r-- | android/arch.go | 24 | ||||
-rw-r--r-- | android/config.go | 11 | ||||
-rw-r--r-- | android/paths.go | 8 | ||||
-rw-r--r-- | scripts/microfactory.bash | 9 | ||||
-rw-r--r-- | ui/build/config.go | 19 | ||||
-rw-r--r-- | ui/build/path.go | 5 |
6 files changed, 55 insertions, 21 deletions
diff --git a/android/arch.go b/android/arch.go index 3cd6e4b7a..d6b297119 100644 --- a/android/arch.go +++ b/android/arch.go @@ -1553,7 +1553,7 @@ func determineBuildOS(config *config) { config.BuildOS = func() OsType { switch runtime.GOOS { case "linux": - if Bool(config.productVariables.HostMusl) { + if Bool(config.productVariables.HostMusl) || runtime.GOARCH == "arm64" { return LinuxMusl } return Linux @@ -1565,11 +1565,25 @@ func determineBuildOS(config *config) { }() config.BuildArch = func() ArchType { - switch runtime.GOARCH { - case "amd64": - return X86_64 + switch runtime.GOOS { + case "linux": + switch runtime.GOARCH { + case "amd64": + return X86_64 + case "arm64": + return Arm64 + default: + panic(fmt.Sprintf("unsupported arch: %s", runtime.GOARCH)) + } + case "darwin": + switch runtime.GOARCH { + case "amd64": + return X86_64 + default: + panic(fmt.Sprintf("unsupported arch: %s", runtime.GOARCH)) + } default: - panic(fmt.Sprintf("unsupported Arch: %s", runtime.GOARCH)) + panic(fmt.Sprintf("unsupported OS: %s", runtime.GOOS)) } }() diff --git a/android/config.go b/android/config.go index 0a1ed98d2..696e7727f 100644 --- a/android/config.go +++ b/android/config.go @@ -814,11 +814,18 @@ func (c *config) HostCcSharedLibPath(ctx PathContext, lib string) Path { func (c *config) PrebuiltOS() string { switch runtime.GOOS { case "linux": - return "linux-x86" + switch runtime.GOARCH { + case "amd64": + return "linux-x86" + case "arm64": + return "linux-arm64" + default: + panic(fmt.Errorf("Unknown GOARCH %s", runtime.GOARCH)) + } case "darwin": return "darwin-x86" default: - panic("Unknown GOOS") + panic(fmt.Errorf("Unknown GOOS %s", runtime.GOOS)) } } diff --git a/android/paths.go b/android/paths.go index a944c48db..9c0c9a273 100644 --- a/android/paths.go +++ b/android/paths.go @@ -209,6 +209,10 @@ type ModuleErrorfContext interface { var _ ModuleErrorfContext = blueprint.ModuleContext(nil) +type AddMissingDependenciesContext interface { + AddMissingDependencies([]string) +} + // reportPathError will register an error with the attached context. It // attempts ctx.ModuleErrorf for a better error message first, then falls // back to ctx.Errorf. @@ -220,7 +224,9 @@ func reportPathError(ctx PathContext, err error) { // attempts ctx.ModuleErrorf for a better error message first, then falls // back to ctx.Errorf. func ReportPathErrorf(ctx PathContext, format string, args ...interface{}) { - if mctx, ok := ctx.(ModuleErrorfContext); ok { + if mctx, ok := ctx.(AddMissingDependenciesContext); ok && ctx.Config().AllowMissingDependencies() { + mctx.AddMissingDependencies([]string{fmt.Sprintf(format, args...)}) + } else if mctx, ok := ctx.(ModuleErrorfContext); ok { mctx.ModuleErrorf(format, args...) } else if ectx, ok := ctx.(errorfContext); ok { ectx.Errorf(format, args...) diff --git a/scripts/microfactory.bash b/scripts/microfactory.bash index ce4a0e48a..49988fa29 100644 --- a/scripts/microfactory.bash +++ b/scripts/microfactory.bash @@ -23,7 +23,14 @@ # Ensure GOROOT is set to the in-tree version. case $(uname) in Linux) - export GOROOT="${TOP}/prebuilts/go/linux-x86/" + case $(uname -m) in + x86_64) + export GOROOT="${TOP}/prebuilts/go/linux-x86/" + ;; + aarch64) + export GOROOT="${TOP}/prebuilts/go/linux-arm64/" + ;; + esac ;; Darwin) export GOROOT="${TOP}/prebuilts/go/darwin-x86/" diff --git a/ui/build/config.go b/ui/build/config.go index a4f778d74..94b07811d 100644 --- a/ui/build/config.go +++ b/ui/build/config.go @@ -1117,11 +1117,18 @@ func (c *configImpl) ApiSurfacesOutDir() string { func (c *configImpl) PrebuiltOS() string { switch runtime.GOOS { case "linux": - return "linux-x86" + switch runtime.GOARCH { + case "amd64": + return "linux-x86" + case "arm64": + return "linux-arm64" + default: + panic(fmt.Errorf("Unknown GOARCH %s", runtime.GOARCH)) + } case "darwin": return "darwin-x86" default: - panic("Unknown GOOS") + panic(fmt.Errorf("Unknown GOOS %s", runtime.GOOS)) } } @@ -1711,13 +1718,7 @@ func (c *configImpl) hostCrossOut() string { } func (c *configImpl) HostPrebuiltTag() string { - if runtime.GOOS == "linux" { - return "linux-x86" - } else if runtime.GOOS == "darwin" { - return "darwin-x86" - } else { - panic("Unsupported OS") - } + return c.PrebuiltOS() } func (c *configImpl) KatiBin() string { diff --git a/ui/build/path.go b/ui/build/path.go index cc1d7e9c2..b92d79959 100644 --- a/ui/build/path.go +++ b/ui/build/path.go @@ -20,7 +20,6 @@ import ( "os" "os/exec" "path/filepath" - "runtime" "strings" "github.com/google/blueprint/microfactory" @@ -122,7 +121,7 @@ func SetupLitePath(ctx Context, config Config, tmpDir string) { myPath, _ = filepath.Abs(myPath) // Set up the checked-in prebuilts path directory for the current host OS. - prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + runtime.GOOS + "-x86") + prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + config.PrebuiltOS()) myPath = prebuiltsPath + string(os.PathListSeparator) + myPath // Set $PATH to be the directories containing the host tool symlinks, and @@ -258,7 +257,7 @@ func SetupPath(ctx Context, config Config) { // We put some prebuilts in $PATH, since it's infeasible to add dependencies // for all of them. - prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + runtime.GOOS + "-x86") + prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + config.PrebuiltOS()) myPath = prebuiltsPath + string(os.PathListSeparator) + myPath // Replace the $PATH variable with the path_interposer symlinks, and |