setup.sh 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #!/bin/bash
  2. # check if IDF_PATH is set
  3. if [ -z "$IDF_PATH" ]; then
  4. echo "Please follows the instruction of ESP-IDF installation and set IDF_PATH."
  5. exit 1
  6. fi
  7. RMDCMD='/bin/rm -rf'
  8. MKDCMD='/bin/mkdir'
  9. CPDCMD='/bin/cp'
  10. SCRIPTDIR=`dirname $0`
  11. SCRIPTDIR=`cd $SCRIPTDIR && pwd -P`
  12. WOLFSSL_ESPIDFDIR=${SCRIPTDIR}
  13. WOLFSSL_ESPIDFDIR=`cd $WOLFSSL_ESPIDFDIR && pwd -P`
  14. BASEDIR=${SCRIPTDIR}/../../../
  15. BASEDIR=`cd ${BASEDIR} && pwd -P`
  16. # echo $WOLFSSL_ESPIDFDIR
  17. WOLFSSLLIB_TRG_DIR=${IDF_PATH}/components/wolfssl
  18. WOLFSSLEXP_TRG_DIR=${IDF_PATH}/examples/protocols
  19. if [ ! -d $IDF_PATH ]; then
  20. echo "ESP-IDF Development Framework doesn't exist.: $IDF_PATH"
  21. exit 1
  22. fi
  23. # Copy files into ESP-IDF development framework
  24. pushd $IDF_PATH > /dev/null
  25. echo "Copy files into $IDF_PATH"
  26. # Remove/Create directories
  27. ${RMDCMD} ${WOLFSSLLIB_TRG_DIR}/
  28. ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/
  29. ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/src
  30. ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt
  31. ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src
  32. ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl
  33. ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/test
  34. ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/include
  35. popd > /dev/null # $WOLFSSL_ESPIDFDIR
  36. pushd ${BASEDIR} > /dev/null # WOLFSSL TOP DIR
  37. # copying ... files in src/ into $WOLFSSLLIB_TRG_DIR/src
  38. ${CPDCMD} ./src/*.c ${WOLFSSLLIB_TRG_DIR}/src/
  39. ${CPDCMD} -r ./wolfcrypt/src/*.{c,i} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/
  40. ${CPDCMD} -r ./wolfcrypt/src/port ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/port/
  41. ${CPDCMD} -r ./wolfcrypt/test ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/
  42. ${CPDCMD} -r ./wolfcrypt/benchmark ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/
  43. ${CPDCMD} -r ./wolfssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/
  44. ${CPDCMD} -r ./wolfssl/wolfcrypt ${WOLFSSLLIB_TRG_DIR}/wolfssl/
  45. # user_settings.h
  46. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/user_settings.h ${WOLFSSLLIB_TRG_DIR}/include/
  47. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/dummy_config_h ${WOLFSSLLIB_TRG_DIR}/include/config.h
  48. # unit test app
  49. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/test/* ${WOLFSSLLIB_TRG_DIR}/test/
  50. popd > /dev/null #
  51. ${CPDCMD} ./libs/CMakeLists.txt ${WOLFSSLLIB_TRG_DIR}/
  52. ${CPDCMD} ./libs/component.mk ${WOLFSSLLIB_TRG_DIR}/
  53. pushd ${BASEDIR} > /dev/null # WOLFSSL TOP DIR
  54. # Benchmark program
  55. ${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/
  56. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/
  57. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/
  58. ${CPDCMD} -r ./wolfcrypt/benchmark/benchmark.c ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/
  59. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_benchmark/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/
  60. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_benchmark/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/
  61. # Crypt Test program
  62. ${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/
  63. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/
  64. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/
  65. ${CPDCMD} -r ./wolfcrypt/test/test.c ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/
  66. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_test/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/
  67. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_test/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/
  68. # TLS Client program
  69. ${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/
  70. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/
  71. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/main/
  72. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/main/include
  73. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_client/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/
  74. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_client/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/main/
  75. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_client/main/include/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/main/include/
  76. # TLS Server program
  77. ${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/
  78. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/
  79. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/
  80. ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/include
  81. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_server/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/
  82. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_server/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/
  83. ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_server/main/include/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/include/
  84. popd > /dev/null #
  85. exit 1