blob: a7845faa20c1aaf7cef26e93f4dc7b44b5f13787 [file] [log] [blame]
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +02001#!/bin/sh
2
3set -eu
4
Manuel Pégourié-Gonnard77d56bb2015-07-28 15:00:37 +02005# relative to the script's directory
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +02006TREE=..
Manuel Pégourié-Gonnard77d56bb2015-07-28 15:00:37 +02007DEST=module
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +02008
9# make sure we're running in our own directory
10if [ -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
16fi
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
20TMP=$DEST-tmp
21rm -rf $TMP
22
Darryl Green13a61f72018-07-24 11:54:24 +010023mkdir -p $TMP/mbedtls $TMP/psa $TMP/source
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020024cp $TREE/include/mbedtls/*.h $TMP/mbedtls
Darryl Green13a61f72018-07-24 11:54:24 +010025cp $TREE/include/psa/*.h $TMP/psa
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020026cp $TREE/library/*.c $TMP/source
27
28# temporary, should depend on external module later
29cp data/entropy_hardware_poll.c $TMP/source
30cp data/target_config.h $TMP/mbedtls
31
32data/adjust-config.sh $TREE/scripts/config.pl $TMP/mbedtls/config.h
33
34mkdir -p $TMP/test
35cp -r data/example-* $TMP/test
36# later we should have the generated test suites here too
37
38cp data/module.json $TMP
39cp data/README.md $TMP
40
Manuel Pégourié-Gonnard9acf88b2015-08-21 17:06:22 +020041cp ../LICENSE $TMP
42if [ -f ../apache-2.0.txt ]; then cp ../apache-2.0.txt $TMP; fi
43
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020044mkdir -p $DEST
45rsync -cr --delete --exclude build --exclude yotta_\* $TMP/ $DEST/
46rm -rf $TMP
47
Manuel Pégourié-Gonnard493f0652015-08-17 14:23:43 +020048echo "mbed TLS yotta module created in '$PWD/$DEST'."