~eliasnaur/gio-patches

cmd/gogio: [Android] check $ANDROID_NDK_ROOT v1 PROPOSED

Greg Pomerantz
Greg Pomerantz: 1
 cmd/gogio: [Android] check $ANDROID_NDK_ROOT

 1 files changed, 9 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio-patches/patches/11305/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] cmd/gogio: [Android] check $ANDROID_NDK_ROOT Export this patch

Greg Pomerantz
If the Android NDK is not found in a standard location (e.g. you are
on an F-Droid build server), check the $ANDROID_NDK_ROOT environment
variable.

Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
---
 cmd/gogio/androidbuild.go | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/cmd/gogio/androidbuild.go b/cmd/gogio/androidbuild.go
index 7f14a0a..d3ddbf7 100644
--- a/cmd/gogio/androidbuild.go
+++ b/cmd/gogio/androidbuild.go
@@ -591,7 +591,15 @@ func findNDK(androidHome string) (string, error) {
	if _, err := os.Stat(ndkBundle); err == nil {
		return ndkBundle, nil
	}
	return "", fmt.Errorf("no NDK found in $ANDROID_HOME (%s). Use `sdkmanager ndk-bundle` to install it", androidHome)
	// Certain non-standard NDK isntallations set the $ANDROID_NDK_ROOT
	// environment variable
	if ndkBundle, ok := os.LookupEnv("ANDROID_NDK_ROOT"); ok {
		if _, err := os.Stat(ndkBundle); err == nil {
			return ndkBundle, nil
		}
	}

	return "", fmt.Errorf("no NDK found in $ANDROID_HOME (%s). Set $ANDROID_NDK_ROOT or use `sdkmanager ndk-bundle` to install the NDK", androidHome)
}

func findKeytool() (string, error) {
-- 
2.16.2
Merged. Thanks!

-- elias