Skip to content

Commit

Permalink
update android ndk
Browse files Browse the repository at this point in the history
Signed-off-by: Swapnil Tripathi <swapnil06.st@gmail.com>
  • Loading branch information
swaptr committed Aug 16, 2023
1 parent 063852e commit c03b857
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
6 changes: 3 additions & 3 deletions uniffi_aries_vcx/demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'com.android.application' version '8.1.0' apply false
id 'com.android.library' version '8.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}
}
4 changes: 2 additions & 2 deletions uniffi_aries_vcx/scripts/android.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ source ${SCRIPT_DIR}/android.utils.sh

# set_android_env
# download_and_setup_toolchain
generate_arch_flags "arm"
generate_arch_flags "arm64"
set_dependencies_env_vars
# set_android_arch_env
set_android_arch_env
build_uniffi
2 changes: 1 addition & 1 deletion uniffi_aries_vcx/scripts/android.prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ source ${SCRIPT_DIR}/android.utils.sh

set_android_env
download_sdk
prepare_dependencies "arm"
prepare_dependencies "arm64"
download_and_setup_toolchain
2 changes: 1 addition & 1 deletion uniffi_aries_vcx/scripts/android.toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ ANDROID_BUILD_DIR=~/android_build

source ${SCRIPT_DIR}/android.utils.sh

create_standalone_toolchain_and_rust_target "arm"
create_standalone_toolchain_and_rust_target "arm64"
create_cargo_config
15 changes: 11 additions & 4 deletions uniffi_aries_vcx/scripts/android.utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ set_android_arch_env
mkdir -p ${HOME}/.cargo
cat << EOF > ${HOME}/.cargo/config
[target.${TRIPLET}]
ar = "$(realpath ${AR})"
linker = "$(realpath ${CC})"
EOF
}
Expand Down Expand Up @@ -52,10 +51,10 @@ download_and_setup_toolchain() {
mkdir -p ${TOOLCHAIN_PREFIX}
pushd $TOOLCHAIN_PREFIX
echo "${GREEN}Resolving NDK for Linux${RESET}"
download_and_unzip_if_missed "android-ndk-r20" "https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip"
download_and_unzip_if_missed "android-ndk-r25c" "https://dl.google.com/android/repository/android-ndk-r25c-linux.zip"
popd
fi
export ANDROID_NDK_ROOT=${TOOLCHAIN_PREFIX}/android-ndk-r20
export ANDROID_NDK_ROOT=${TOOLCHAIN_PREFIX}/android-ndk-r25c
echo "${GREEN}NDK RESOLVED AT${RESET} ${ANDROID_NDK_ROOT}"
}

Expand Down Expand Up @@ -154,8 +153,9 @@ prepare_dependencies() {
}

set_android_arch_env() {
echo $
export CC=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-clang
export AR=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-ar
export AR=${TOOLCHAIN_DIR}/bin/llvm-ar
export CXX=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-clang++
export CXXLD=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-ld
export RANLIB=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-ranlib
Expand Down Expand Up @@ -198,6 +198,13 @@ set_dependencies_env_vars() {
export OPENSSL_STATIC=1
}

fix_ndk() {
find $ANDROID_NDK_ROOT -name 'libunwind.a' | sed 's@libunwind.a$@libgcc.a@' | \
while read x; do
echo "INPUT(-lunwind)" > $x
done
}

build_uniffi() {
echo "**************************************************"
echo "ARIES_VCX_ROOT is ${BOLD}${BLUE}${ARIES_VCX_ROOT}${RESET}"
Expand Down

0 comments on commit c03b857

Please sign in to comment.