| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 1 | #!/bin/sh | 
|  | 2 |  | 
|  | 3 | set -eu | 
|  | 4 |  | 
| Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 5 | # relative to the script's directory | 
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 6 | TREE=.. | 
| Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 7 | DEST=module | 
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 8 |  | 
|  | 9 | # make sure we're running in our own directory | 
|  | 10 | if [ -f create-module.sh ]; then :; else | 
|  | 11 | cd $( dirname $0 ) | 
|  | 12 | if [ -f create-module.sh ]; then :; else | 
|  | 13 | echo "Please run the script from is directory." >&2 | 
|  | 14 | exit 1 | 
|  | 15 | fi | 
|  | 16 | fi | 
|  | 17 |  | 
|  | 18 | # use a temporary directory to build the module, then rsync to DEST | 
|  | 19 | # this allows touching only new files, for more efficient re-builds | 
|  | 20 | TMP=$DEST-tmp | 
|  | 21 | rm -rf $TMP | 
|  | 22 |  | 
|  | 23 | mkdir -p $TMP/mbedtls $TMP/source | 
|  | 24 | cp $TREE/include/mbedtls/*.h $TMP/mbedtls | 
|  | 25 | cp $TREE/library/*.c $TMP/source | 
|  | 26 |  | 
|  | 27 | # temporary, should depend on external module later | 
|  | 28 | cp data/entropy_hardware_poll.c $TMP/source | 
|  | 29 | cp data/target_config.h $TMP/mbedtls | 
|  | 30 |  | 
|  | 31 | data/adjust-config.sh $TREE/scripts/config.pl $TMP/mbedtls/config.h | 
|  | 32 |  | 
|  | 33 | mkdir -p $TMP/test | 
|  | 34 | cp -r data/example-* $TMP/test | 
|  | 35 | # later we should have the generated test suites here too | 
|  | 36 |  | 
|  | 37 | cp data/module.json $TMP | 
|  | 38 | cp data/README.md $TMP | 
|  | 39 |  | 
| Manuel Pégourié-Gonnard | 9acf88b | 2015-08-21 17:06:22 +0200 | [diff] [blame] | 40 | cp ../LICENSE $TMP | 
|  | 41 | if [ -f ../apache-2.0.txt ]; then cp ../apache-2.0.txt $TMP; fi | 
|  | 42 |  | 
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 43 | mkdir -p $DEST | 
|  | 44 | rsync -cr --delete --exclude build --exclude yotta_\* $TMP/ $DEST/ | 
|  | 45 | rm -rf $TMP | 
|  | 46 |  | 
| Manuel Pégourié-Gonnard | 493f065 | 2015-08-17 14:23:43 +0200 | [diff] [blame] | 47 | echo "mbed TLS yotta module created in '$PWD/$DEST'." |