install_lib.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. WOLFSSL_SRC_DIR=../../..
  3. if [ ! -d $WOLFSSL_SRC_DIR ]; then
  4. echo "Directory does not exist: $WOLFSSL_SRC_DIR"
  5. exit 1
  6. fi
  7. if [ ! -f $WOLFSSL_SRC_DIR/wolfssl/ssl.h ]; then
  8. echo "Missing header file: $WOLFSSL_SRC_DIR/wolfssl/ssl.h"
  9. exit 1
  10. fi
  11. ZEPHYR_DIR=
  12. if [ $# -ne 1 ]; then
  13. echo "Need location of zephyr project as a command line argument"
  14. exit 1
  15. else
  16. ZEPHYR_DIR=$1
  17. fi
  18. if [ ! -d $ZEPHR_DIR ]; then
  19. echo "Zephyr project directory does not exist: $ZEPHYR_DIR"
  20. exit 1
  21. fi
  22. ZEPHYR_CRYPTO_DIR=$ZEPHYR_DIR/zephyr/ext/lib/crypto
  23. if [ ! -d $ZEPHYR_CRYPTO_DIR ]; then
  24. echo "Zephyr crypto directory does not exist: $ZEPHYR_CRYPTO_DIR"
  25. exit 1
  26. fi
  27. ZEPHYR_WOLFSSL_DIR=$ZEPHYR_CRYPTO_DIR/wolfssl
  28. echo "wolfSSL directory in Zephyr:"
  29. echo " $ZEPHYR_WOLFSSL_DIR"
  30. rm -rf $ZEPHYR_WOLFSSL_DIR
  31. mkdir $ZEPHYR_WOLFSSL_DIR
  32. echo "Copy in Build files ..."
  33. cp -r * $ZEPHYR_WOLFSSL_DIR/
  34. rm $ZEPHYR_WOLFSSL_DIR/$0
  35. echo "Copy Source Code ..."
  36. rm -rf $ZEPHYR_WOLFSSL_DIR/library
  37. mkdir $ZEPHYR_WOLFSSL_DIR/library
  38. mkdir $ZEPHYR_WOLFSSL_DIR/library/src
  39. mkdir -p $ZEPHYR_WOLFSSL_DIR/library/wolfcrypt/src
  40. cp -rf ${WOLFSSL_SRC_DIR}/src/*.c $ZEPHYR_WOLFSSL_DIR/library/src/
  41. cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.c $ZEPHYR_WOLFSSL_DIR/library/wolfcrypt/src/
  42. cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.i $ZEPHYR_WOLFSSL_DIR/library/wolfcrypt/src/
  43. cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.S $ZEPHYR_WOLFSSL_DIR/library/wolfcrypt/src/
  44. echo "Copy Header Files ..."
  45. rm -rf $ZEPHYR_WOLFSSL_DIR/include
  46. mkdir $ZEPHYR_WOLFSSL_DIR/include
  47. cp $ZEPHYR_WOLFSSL_DIR/user_settings.h $ZEPHYR_WOLFSSL_DIR/include/
  48. cp -rf ${WOLFSSL_SRC_DIR}/wolfssl $ZEPHYR_WOLFSSL_DIR/include/
  49. rm -f $ZEPHYR_WOLFSSL_DIR/include/wolfssl/options.h
  50. touch $ZEPHYR_WOLFSSL_DIR/include/wolfssl/options.h
  51. rm -rf $ZEPHYR_WOLFSSL_DIR/include/wolfssl/wolfcrypt/port
  52. echo "Done"