pack-for-embedded-systems.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env bash
  2. # This script pack all source code into a single zip file
  3. # so that you can build it locally without accessing Internet
  4. # on your board.
  5. set -e
  6. SHERPA_NCNN_VERSION=$(grep "SHERPA_NCNN_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
  7. echo "SHERPA_NCNN_VERSION: ${SHERPA_NCNN_VERSION}"
  8. dir=sherpa-ncnn-all-in-one-for-embedded-systems-${SHERPA_NCNN_VERSION}
  9. rm -rf $dir
  10. mkdir -p $dir
  11. pushd $dir
  12. wget \
  13. -O sherpa-ncnn-${SHERPA_NCNN_VERSION}.tar.gz \
  14. https://github.com/k2-fsa/sherpa-ncnn/archive/refs/tags/v${SHERPA_NCNN_VERSION}.tar.gz
  15. tar xf sherpa-ncnn-${SHERPA_NCNN_VERSION}.tar.gz
  16. rm -v sherpa-ncnn-${SHERPA_NCNN_VERSION}.tar.gz
  17. # Please also change ./build-m3axpi.sh
  18. wget \
  19. -O kaldi-native-fbank-1.18.5.tar.gz \
  20. https://github.com/csukuangfj/kaldi-native-fbank/archive/refs/tags/v1.18.7.tar.gz
  21. wget \
  22. -O ncnn-sherpa-1.1.tar.gz \
  23. https://github.com/csukuangfj/ncnn/archive/refs/tags/sherpa-1.1.tar.gz
  24. cat >README.md <<EOF
  25. Please put files from this folder to the directory \$HOME/asr/
  26. rm -rf \$HOME/asr
  27. mkdir -p \$HOME/asr
  28. tar xvf sherpa-ncnn-all-in-one-for-embedded-systems-${SHERPA_NCNN_VERSION}.tar.bz2 --strip-components 1 -C \$HOME/asr
  29. rm sherpa-ncnn-all-in-one-for-embedded-systems-${SHERPA_NCNN_VERSION}.tar.bz2 # to save space
  30. ls -lh \$HOME/asr
  31. It should print something like below:
  32. ls -lh \$HOME/asr
  33. total 24368
  34. -rw-r--r-- 1 fangjun staff 59K Feb 2 17:01 kaldi-native-fbank-1.18.5.tar.gz
  35. -rw-r--r-- 1 fangjun staff 12M Feb 2 17:01 sherpa-1.1.tar.gz
  36. drwxr-xr-x 29 fangjun staff 928B Feb 2 16:05 sherpa-ncnn-${SHERPA_NCNN_VERSION}
  37. # Note: It is OK if the versions of the above files are different.
  38. # The two .tar.gz files must be placed in \$HOME/asr
  39. EOF
  40. popd
  41. tar cjf ${dir}.tar.bz2 $dir