From 1cbb98fe2a890bdac2bc0a1f518020e5b1410c3a Mon Sep 17 00:00:00 2001 From: "zhou.weiguo" Date: Sun, 7 Apr 2024 11:25:40 +0800 Subject: [PATCH] build: fix minor issue in build system --- README.md | 8 +------- build-all.sh | 11 +++++++++++ build/envsetup.sh | 4 ++-- build/prebuild-download.sh | 5 +++++ build/public.sh | 3 +++ 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6161cfc2c..4d1168dcc 100644 --- a/README.md +++ b/README.md @@ -165,18 +165,12 @@ cd kantv - download android-ndk-r26c to prebuilts/toolchain, skip this step if android-ndk-r26c is already exist ``` +. build/envsetup.sh ./build/prebuild-download.sh ``` - - environment setup - - ``` - - . build/envsetup.sh - - ``` - modify build/envsetup.sh accordingly before launch build diff --git a/build-all.sh b/build-all.sh index 66b1d7d1c..56c4b5829 100755 --- a/build-all.sh +++ b/build-all.sh @@ -22,6 +22,17 @@ function build_init() echo -e "build project ${PROJECT_NAME} on ${BUILD_TIME} by ${BUILD_USER} for ${TEXT_RED} target ${BUILD_TARGET} with arch ${BUILD_ARCHS} in ${PROJECT_BUILD_TYPE} mode on host ${BUILD_HOST} ${TEXT_RESET}\n" show_pwd + + if [ "${BUILD_TARGET}" == "android" ]; then + check_ndk + if [ $? -ne 0 ]; then + printf "failed to check android ndk\n" + printf "pls run ./build/prebuild-download.sh firstly\n" + printf "\n\n" + exit 1 + fi + + fi } diff --git a/build/envsetup.sh b/build/envsetup.sh index e3cb57056..e787340ec 100755 --- a/build/envsetup.sh +++ b/build/envsetup.sh @@ -277,8 +277,8 @@ function lunch() elif [ "${project}" == "kantv-wasm" ]; then export BUILD_TARGET=wasm else - #default target is linux - export BUILD_TARGET=linux + #default target is android + export BUILD_TARGET=android fi setup_env diff --git a/build/prebuild-download.sh b/build/prebuild-download.sh index 766ae21cc..b231cc277 100755 --- a/build/prebuild-download.sh +++ b/build/prebuild-download.sh @@ -32,6 +32,11 @@ fi if [ ${is_android_ndk_exist} -eq 0 ]; then echo -e "begin downloading android ndk \n" + + if [ ! -d ${PROJECT_ROOT_PATH}/prebuilts/toolchain ]; then + mkdir -p ${PROJECT_ROOT_PATH}/prebuilts/toolchain + fi + wget --no-config --quiet --show-progress -O ${PROJECT_ROOT_PATH}/prebuilts/toolchain/android-ndk-r25c-linux.zip https://dl.google.com/android/repository/android-ndk-r25c-linux.zip wget --no-config --quiet --show-progress -O ${PROJECT_ROOT_PATH}/prebuilts/toolchain/android-ndk-r26c-linux.zip https://dl.google.com/android/repository/android-ndk-r26c-linux.zip diff --git a/build/public.sh b/build/public.sh index 1b307ee15..57c0eb917 100755 --- a/build/public.sh +++ b/build/public.sh @@ -112,15 +112,18 @@ function check_ndk() if [ -z ${ANDROID_NDK} ]; then echo -e "${TEXT_RED}NDK ${ANDROID_NDK} not exist, pls check...${TEXT_RESET}\n" #exit 1 + return 1; fi if [ ! -d ${ANDROID_NDK} ]; then echo -e "${TEXT_RED}NDK ${ANDROID_NDK} not exist, pls check...${TEXT_RESET}\n" #exit 1 + return 1; fi if [ ! -f ${ANDROID_NDK}/build/cmake/android.toolchain.cmake ]; then echo -e "${TEXT_RED}NDK ${ANDROID_NDK} not exist, pls check...${TEXT_RESET}\n" + return 1; fi }