From cb2e7da11700260479c95dd7761dad73e5e1758b Mon Sep 17 00:00:00 2001 From: James Tucker Date: Thu, 21 Sep 2023 14:09:54 -0700 Subject: [PATCH] Makefile: avoid setting empty JAVA_HOME to avoid SDK tools bugs The Android SDK tools go into a CPU spin if $JAVA_HOME is empty and never complete. This may occur if you have only an incomplete Android SDK, and no Android Studio install, wherein we do not find an Android JAVA_HOME. Updates self --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 7b7b4cf..be30347 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,10 @@ ANDROID_STUDIO_ROOT ?= $(shell find ~/android-studio /usr/local/android-studio / # Set JAVA_HOME to the Android Studio bundled JDK. export JAVA_HOME ?= $(shell find "$(ANDROID_STUDIO_ROOT)/jbr" "$(ANDROID_STUDIO_ROOT)/jre" "$(ANDROID_STUDIO_ROOT)/Contents/jbr/Contents/Home" "$(ANDROID_STUDIO_ROOT)/Contents/jre/Contents/Home" -maxdepth 1 -type d 2>/dev/null | head -n 1) +# If JAVA_HOME is still unset, remove it, because SDK tools go into a CPU spin if it is set and empty. +ifeq ($(JAVA_HOME),) + unexport JAVA_HOME +endif # Go toolchain path, by default pulled from Tailscale prebuilts pinned to the # version in tailscale.com/cmd/printdep.