ente/setup.sh

66 lines
1.5 KiB
Bash
Raw Normal View History

2023-02-08 13:28:11 +00:00
#!/usr/bin/env bash
# Originally from https://github.com/am15h/tflite_flutter_plugin/blob/master/install.sh
2023-02-08 13:28:11 +00:00
cd "$(dirname "$(readlink -f "$0")")"
2023-06-06 09:57:17 +00:00
# Pull from the latest tag where binaries were built
2023-03-31 11:06:54 +00:00
ANDROID_TAG="tf_2.5"
IOS_TAG="v0.5.0"
IOS_URL="https://github.com/am15h/tflite_flutter_plugin/releases/download/"
ANDROID_URL="https://github.com/am15h/tflite_flutter_plugin/releases/download/"
2023-02-08 14:09:18 +00:00
IOS_ASSET="TensorFlowLiteC.framework.zip"
IOS_FRAMEWORK="TensorFlowLiteC.framework"
IOS_DIR="ios/.symlinks/plugins/tflite_flutter/ios/"
MACOSX_METADATA_DIR="__MACOSX"
2023-02-08 13:28:11 +00:00
ANDROID_DIR="android/app/src/main/jniLibs/"
ANDROID_LIB="libtensorflowlite_c.so"
ARM_DELEGATE="libtensorflowlite_c_arm_delegate.so"
ARM_64_DELEGATE="libtensorflowlite_c_arm64_delegate.so"
ARM="libtensorflowlite_c_arm.so"
ARM_64="libtensorflowlite_c_arm64.so"
X86="libtensorflowlite_c_x86.so"
X86_64="libtensorflowlite_c_x86_64.so"
delegate=0
while getopts "d" OPTION
do
case $OPTION in
d) delegate=1;;
esac
done
2023-03-31 11:06:54 +00:00
wget "${IOS_URL}${IOS_TAG}/${IOS_ASSET}"
2023-02-08 14:09:18 +00:00
unzip ${IOS_ASSET}
rm -rf ${MACOSX_METADATA_DIR}
rm ${IOS_ASSET}
rm -rf "${IOS_DIR}/${IOS_FRAMEWORK}"
mv ${IOS_FRAMEWORK} ${IOS_DIR}
2023-02-08 13:28:11 +00:00
download () {
2023-03-31 11:06:54 +00:00
wget "${ANDROID_URL}${ANDROID_TAG}/$1"
2023-02-08 13:28:11 +00:00
mkdir -p "${ANDROID_DIR}$2/"
mv $1 "${ANDROID_DIR}$2/${ANDROID_LIB}"
}
if [ ${delegate} -eq 1 ]
then
download ${ARM_DELEGATE} "armeabi-v7a"
download ${ARM_64_DELEGATE} "arm64-v8a"
else
download ${ARM} "armeabi-v7a"
download ${ARM_64} "arm64-v8a"
fi
download ${X86} "x86"
2023-02-08 14:09:18 +00:00
download ${X86_64} "x86_64"