#!/bin/bash # This script uncompresses download_dependencies.tar.gz in externals/tensorflow/packaging # and puts directories of libraries that are needed to build TensorFlow Lite. # NOTE 'run' sets NNFW_PROJECT_PATH and invokes this script EXT_PATH=${NNFW_PROJECT_PATH}/externals if [ "$OBS_BUILD" == '0' ]; then EXT_LIBS_TARBALL=${EXT_PATH}/tensorflow/packaging/download_dependencies.tar.gz else EXT_LIBS_TARBALL=${NNFW_PROJECT_PATH}/packaging/download_dependencies.tar.gz fi NEED_LIB_COPY="no" EXT_LIBS=("absl" "eigen" "farmhash" "flatbuffers" "gemmlowp" "neon_2_sse") for LIB in "${EXT_LIBS[@]}"; do if [ ! -d "${EXT_PATH}/${LIB}" ]; then NEED_LIB_COPY="yes" break fi done if [ "${NEED_LIB_COPY}" == "no" ]; then exit 0 fi if [ ! -f "${EXT_LIBS_TARBALL}" ]; then echo "ERROR: '${EXT_LIBS_TARBALL}' does not exist." echo " You may need to initialize the submodule 'tensorflow'." exit 255 fi tar xfz "${EXT_LIBS_TARBALL}" -C "${EXT_PATH}" for LIB in "${EXT_LIBS[@]}"; do if [ -d "${EXT_PATH}/${LIB}" ]; then rm -rf "${EXT_PATH}/${LIB}" fi mv "${EXT_PATH}/downloads/${LIB}" "${EXT_PATH}" done rm -rf "${EXT_PATH}/downloads"