diff --git a/.gitignore b/.gitignore index 93d77950b..27e16f482 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,10 @@ cdeosplayer/kantv/src/main/assets/deepspeech-0.9.3-models.tflite #generated by source code,so skip it cdeosplayer/kantv/src/main/jniLibs/arm64-v8a/libopenblas.so + +prebuilts/toolchain/android-ndk-r26c-linux.zip +prebuilts/toolchain/android-ndk-r26c/ +prebuilts/toolchain/emsdk/ +prebuilts/toolchain/*.zip +prebuilts/toolchain/*.xz +prebuilts/toolchain/*.gz diff --git a/README.md b/README.md index bfcf8dbb2..9fc06b614 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ sudo apt-get update sudo apt-get install build-essential -y sudo apt-get install cmake -y sudo apt-get install curl -y +sudo apt-get install wget -y sudo apt-get install python -y sudo apt-get install tcl expect -y sudo apt-get install nginx -y @@ -83,6 +84,15 @@ pip3 install meson ninja echo "export PATH=/home/`whoami`/.local/bin:\$PATH" >> ~/.bashrc +``` + +or run below script accordingly after fetch project's source code + +``` + +./build/prebuild.sh + + ``` - Android NDK & Android Studio @@ -145,7 +155,7 @@ git checkout master #### Build native codes -modify build/envsetup.sh accordingly before launch build +modify build/envsetup.sh accordingly before launch build pay attention here and modify it accordingly if build-target is kantv-android and running Android device is NOT Xiaomi 14 @@ -154,6 +164,9 @@ a VERY powerful Linux PC / Linux workstation is HIGHLY recommended for this step ``` . build/envsetup.sh +(download android-ndk-r26c to prebuilts/toolchain, skip this step if android-ndk-r26c is already exist) +./build/prebuild-download.sh + ``` ![Screenshot from 2024-03-21 21-41-41](https://github.com/zhouwg/kantv/assets/6889919/3e13946f-596b-44be-9716-5793ce0c7263) diff --git a/build/envsetup.sh b/build/envsetup.sh index cdaea6819..d123fc106 100755 --- a/build/envsetup.sh +++ b/build/envsetup.sh @@ -52,11 +52,15 @@ export PROJECT_BRANCH=`git branch | grep "*" | cut -f 2 -d ' ' ` export PROJECT_ROOT_PATH=${PROJECT_HOME_PATH} export PROJECT_OUT_PATH=${PROJECT_ROOT_PATH}/out export FF_PREFIX=${PROJECT_OUT_PATH}/${BUILD_TARGET}/ +#export KANTV_TOOLCHAIN_PATH=/opt/kantv-toolchain +export KANTV_TOOLCHAIN_PATH=${PROJECT_ROOT_PATH}/prebuilts/toolchain +export LOCAL_WHISPERCPP_PATH=${PROJECT_ROOT_PATH}/external/whispercpp + + +export KANTV_PROJECTS="kantv-linux kantv-android kantv-ios kantv-wasm" +export KANTV_PROJECTS_DEBUG="kantv-android-debug" -#modify following lines to adapt to local dev envs -#export KANTV_TOOLCHAIN_PATH=${PROJECT_ROOT_PATH}/toolchain -export KANTV_TOOLCHAIN_PATH=/opt/kantv-toolchain #API21:Android 5.0 (Android L)Lollipop #API22:Android 5.1 (Android L)Lollipop #API23:Android 6.0 (Android M)Marshmallow @@ -77,12 +81,9 @@ export ANDROID_PLATFORM=android-34 #export ANDROID_NDK=${KANTV_TOOLCHAIN_PATH}/android-ndk-r24 export ANDROID_NDK=${KANTV_TOOLCHAIN_PATH}/android-ndk-r26c -export LOCAL_WHISPERCPP_PATH=${PROJECT_ROOT_PATH}/external/whispercpp -export UPSTREAM_WHISPERCPP_PATH=~/cdeos/whisper.cpp - -export KANTV_PROJECTS="kantv-linux kantv-android kantv-ios kantv-wasm" -export KANTV_PROJECTS_DEBUG="kantv-android-debug" +#modify following lines to adapt to local dev envs +export UPSTREAM_WHISPERCPP_PATH=~/whisper.cpp . ${PROJECT_ROOT_PATH}/build/public.sh || (echo "can't find public.sh"; exit 1) diff --git a/build/prebuild-download.sh b/build/prebuild-download.sh new file mode 100755 index 000000000..becdf8a69 --- /dev/null +++ b/build/prebuild-download.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +# Copyright (c) 2024- KanTV Authors + +# Description: download Android NDK for build project + +set -e + +if [ "x${PROJECT_ROOT_PATH}" == "x" ]; then + echo "pwd is `pwd`" + echo "pls run . build/envsetup in project's toplevel directory firstly" + exit 1 +fi + +. ${PROJECT_ROOT_PATH}/build/public.sh || (echo "can't find public.sh"; exit 1) + +show_pwd + +echo "ANDROID_NDK: ${ANDROID_NDK}" + +is_android_ndk_exist=1 + +if [ ! -d ${ANDROID_NDK} ]; then + echo -e "${TEXT_RED}NDK ${ANDROID_NDK} not exist, pls check...${TEXT_RESET}\n" + is_android_ndk_exist=0 +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" + is_android_ndk_exist=0 +fi + +if [ ${is_android_ndk_exist} -eq 0 ]; then + echo -e "begin downloading android ndk \n" + wget --no-config --quiet --show-progress -O ${ANDROID_NDK}-linux.zip https://dl.google.com/android/repository/android-ndk-r26c-linux.zip + cd ${PROJECT_ROOT_PATH}/prebuilts/toolchain + unzip android-ndk-r26c-linux.zip + cd ${PROJECT_ROOT_PATH} + + if [ $? -ne 0 ]; then + printf "failed to download android ndk to %s \n" "${ANDROID_NDK}" + exit 1 + fi + + printf "android ndk saved to ${ANDROID_NDK} \n\n" +else + printf "android ndk already exist:${ANDROID_NDK} \n\n" +fi diff --git a/build/prebuild.sh b/build/prebuild.sh index c9dbebaea..f1bfde631 100755 --- a/build/prebuild.sh +++ b/build/prebuild.sh @@ -12,6 +12,7 @@ sudo apt-get update sudo apt-get install build-essential -y sudo apt-get install cmake -y sudo apt-get install curl -y +sudo apt-get install wget -y sudo apt-get install python -y sudo apt-get install tcl expect -y sudo apt-get install nginx -y diff --git a/build/prebuild_download.sh b/build/prebuild_download.sh deleted file mode 100644 index f9c59d46e..000000000 --- a/build/prebuild_download.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2024- KanTV Authors - -# Description: tools & utilitis for build project - - - - diff --git a/docs/FAQ.md b/docs/FAQ.md index 9dc081e5e..eda3d5078 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -16,12 +16,16 @@ Project KanTV was almost/completely done by myself since 05-2021 and NO IPR conc
-- What's the relationship between kantv and whisper.cpp +- What's the relationship between kantv and whisper.cpp/GGML +Project KanTV has NO or NO personal relationship with whisper.cpp/GGML but only use source code of whisper.cpp as ASR engine. -Project KanTV has NO or NO personal relationship with whisper.cpp but only use source code of whisper.cpp as ASR engine. +I heard whisper.cpp on Jan 2024 at the first time and just use it generate subtitle for original English short video which referenced in Chinese articles on personal WeChat public account, but I didn’t read the source code of whisper.cpp at that time. sadly, my personal WeChat public account was forcefully closed on 01-28-2024. after that, I [decided to migrate some personal software project to Github since 02-22-2024](https://github.com/zhouwg/kantv/blob/master/release/README.md#L122). I have to say that I really spent much time/efforts on personal WeChat public account for public interests or my country's interests before 02-22-2024. + +I have to say that life is like a box of chocolate, you never know what you’re going to get. I decided to start integrating the great whisper.cpp to this project since 03-05-2024 and I did it on 03-16-2024 finally. I have to say that I was touched with and motivated by the great open-source project whisper.cpp from 03-05-2024 to 03-22-2024. + +At the same time, I have to say that GGML's whisper.cpp is a real excellent and amazing open source AI project and very helpful for C/C++ programmer and the original author of GGML is the only person I know of who is AI expert and modern C++ master and familiar with both iOS(app / native ) and Android(app / native) and Linux(app / native) software development at the same time(I know a few programmers who are familiar with both iOS(app / dev) and Android (app / native) and Linux(app / native) software development but they also know very little about real AI tech) and I have to say that the original author of GGML made a huge contribution to our planet. -But, I have to say that GGML's whisper.cpp is a real excellent and amazing open source AI project and very helpful for C/C++ programmer and the original author of GGML is the only person I know of who is AI expert and modern C++ master and familiar with both iOS(app / native ) and Android(app / native) and Linux(app / native) software development at the same time(I know a few programmers who are familiar with both iOS(app / dev) and Android (app / native) and Linux(app / native) software development but they also know very little about real AI tech) and I have to say that the original author of GGML made a huge contribution to our planet.
diff --git a/docs/acknowledgement.md b/docs/acknowledgement.md index 66f72a148..3f5b71f04 100644 --- a/docs/acknowledgement.md +++ b/docs/acknowledgement.md @@ -4,23 +4,26 @@ Project KanTV has used/tried following open-source projects(list in here is not