2
0

setup.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash -e
  2. # this scrypt deploy wolfssl and wolfcrypto source code to mynewt project
  3. # run as bash "mynewt project root directory path"
  4. SCRIPTDIR=`dirname $0`
  5. SCRIPTDIR=`cd $SCRIPTDIR && pwd -P`
  6. WOLFSSL_MYNEWTDIR=${SCRIPTDIR}
  7. WOLFSSL_MYNEWTDIR=`cd $WOLFSSL_MYNEWTDIR && pwd -P`
  8. BASEDIR=${SCRIPTDIR}/../..
  9. BASEDIR=`cd ${BASEDIR} && pwd -P`
  10. if [ $# -ne 1 ]; then
  11. echo "Usage: $0 'mynewt project root directory path'" 1>&2
  12. exit 1
  13. fi
  14. MYNEWT_PROJECT=$1
  15. if [ ! -d $MYNEWT_PROJECT ] || [ ! -f $MYNEWT_PROJECT/project.yml ]; then
  16. echo "target directory is not mynewt project.: $MYNEWT_PROJECT"
  17. exit 1
  18. fi
  19. # create wolfssl pkgs to mynewt project
  20. pushd $MYNEWT_PROJECT > /dev/null
  21. echo "create crypto/wolfssl pkg"
  22. /bin/rm -rf crypto/wolfssl
  23. newt pkg new crypto/wolfssl
  24. /bin/rm -rf crypto/wolfssl/include
  25. /bin/mkdir -p crypto/wolfssl/include
  26. /bin/rm -rf crypto/wolfssl/src
  27. /bin/mkdir -p crypto/wolfssl/src
  28. echo "create apps/wolfcrypttest pkg"
  29. /bin/rm -rf apps/wolfcrypttest
  30. newt pkg new -t app apps/wolfcrypttest
  31. /bin/rm -rf apps/wolfcrypttest/include
  32. /bin/rm -rf apps/wolfcrypttest/src
  33. /bin/mkdir -p apps/wolfcrypttest/src
  34. popd > /dev/null # $MYNEWT_PROJECT
  35. # deploy source files and pkg
  36. pushd $BASEDIR > /dev/null
  37. # deploy to crypto/wolfssl
  38. echo "deploy wolfssl sources to crypto/wolfssl"
  39. /bin/cp $WOLFSSL_MYNEWTDIR/crypto.wolfssl.pkg.yml $MYNEWT_PROJECT/crypto/wolfssl/pkg.yml
  40. /bin/cp $WOLFSSL_MYNEWTDIR/crypto.wolfssl.syscfg.yml $MYNEWT_PROJECT/crypto/wolfssl/syscfg.yml
  41. /bin/mkdir -p $MYNEWT_PROJECT/crypto/wolfssl/src/src
  42. /bin/cp ./src/*.c $MYNEWT_PROJECT/crypto/wolfssl/src/src
  43. /bin/mkdir -p $MYNEWT_PROJECT/crypto/wolfssl/src/wolfcrypt/src
  44. /bin/cp ./wolfcrypt/src/*.asm $MYNEWT_PROJECT/crypto/wolfssl/src/wolfcrypt/src
  45. /bin/cp ./wolfcrypt/src/*.c $MYNEWT_PROJECT/crypto/wolfssl/src/wolfcrypt/src
  46. /bin/mkdir -p $MYNEWT_PROJECT/crypto/wolfssl/src/wolfcrypt/src/port/mynewt
  47. /bin/cp ./wolfcrypt/src/port/mynewt/* $MYNEWT_PROJECT/crypto/wolfssl/src/wolfcrypt/src/port/mynewt
  48. /bin/mkdir -p $MYNEWT_PROJECT/crypto/wolfssl/include/wolfssl
  49. /bin/cp -r wolfssl/* $MYNEWT_PROJECT/crypto/wolfssl/include/wolfssl/
  50. # deploy to apps/wolfcrypttest
  51. echo "deploy unit test sources to apps/wolfcrypttest"
  52. /bin/cp $WOLFSSL_MYNEWTDIR/apps.wolfcrypttest.pkg.yml $MYNEWT_PROJECT/apps/wolfcrypttest/pkg.yml
  53. /bin/mkdir -p $MYNEWT_PROJECT/apps/wolfcrypttest/include/wolfcrypt/test
  54. /bin/cp -r wolfcrypt/test/test.h $MYNEWT_PROJECT/apps/wolfcrypttest/include/wolfcrypt/test/
  55. /bin/mkdir -p $MYNEWT_PROJECT/apps/wolfcrypttest/src
  56. /bin/cp wolfcrypt/test/test.c $MYNEWT_PROJECT/apps/wolfcrypttest/src/main.c
  57. popd > /dev/null # $BASEDIR