Skip to content

Commit

Permalink
optimized
Browse files Browse the repository at this point in the history
Signed-off-by: leleliu008 <leleliu008@gmail.com>
  • Loading branch information
leleliu008 committed Nov 27, 2023
1 parent e17b9f3 commit 8f468c3
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions ndk-pkg
Original file line number Diff line number Diff line change
Expand Up @@ -8043,32 +8043,35 @@ ndkinfo() {
NDKINFO="$(ndkinfo || true)"
fi

ANDROID_NDK_IS_INSTALLED_VIA_UPPM=0

if [ -z "$NDKINFO" ] ; then
UPPM_PACKAGE_NAME_NDK='android-ndk-r26b'

if "$UPPM" is-installed "$UPPM_PACKAGE_NAME_NDK" ; then
ANDROID_NDK_HOME="$("$UPPM" info "$UPPM_PACKAGE_NAME_NDK" installed-dir)"
NDKINFO="$(ndkinfo "$ANDROID_NDK_HOME")"
else
if ! "$UPPM" is-installed "$UPPM_PACKAGE_NAME_NDK" ; then
ANDROID_NDK_IS_INSTALLED_VIA_UPPM=1
warn "Android NDK not found, it will be installed via uppm."
"$UPPM" install "$UPPM_PACKAGE_NAME_NDK"
ANDROID_NDK_HOME="$("$UPPM" info "$UPPM_PACKAGE_NAME_NDK" installed-dir)"
NDKINFO="$(ndkinfo "$ANDROID_NDK_HOME")"

# https://github.com/microsoft/WSL/issues/8681
# https://github.com/microsoft/WSL/issues/4071

#if [ "$NATIVE_OS_KIND" = linux ] && grep -q -i Microsoft /proc/version ; then
# patchelf --set-interpreter '/lib64/ld-linux-x86-64.so.2' "$ANDROID_NDK_CC"
#fi
fi

ANDROID_NDK_HOME="$("$UPPM" info "$UPPM_PACKAGE_NAME_NDK" installed-dir)"
NDKINFO="$(ndkinfo "$ANDROID_NDK_HOME")"
fi

echo "$NDKINFO"
eval "$NDKINFO"

export ANDROID_NDK_HOME
export ANDROID_NDK_ROOT

if [ "$ANDROID_NDK_IS_INSTALLED_VIA_UPPM" -eq 1 ] ; then
# https://github.com/microsoft/WSL/issues/8681
# https://github.com/microsoft/WSL/issues/4071

if [ "$NATIVE_OS_KIND" = linux ] && grep -q -i Microsoft /proc/version ; then
patchelf --set-interpreter '/lib64/ld-linux-x86-64.so.2' "$ANDROID_NDK_CC"
fi
fi
}

# }}}
Expand Down

0 comments on commit 8f468c3

Please sign in to comment.