Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 1 | #!/bin/sh |
Bence Szépkúti | b7246ad | 2020-05-26 00:33:31 +0200 | [diff] [blame] | 2 | # |
| 3 | # Copyright (C) 2015, Arm Limited, All Rights Reserved |
Bence Szépkúti | 09b4f19 | 2020-05-26 01:54:15 +0200 | [diff] [blame^] | 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 7 | # not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 14 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
Bence Szépkúti | b7246ad | 2020-05-26 00:33:31 +0200 | [diff] [blame] | 17 | # |
| 18 | # This file is part of Mbed TLS (https://tls.mbed.org) |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 19 | |
| 20 | set -eu |
| 21 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 22 | # relative to the script's directory |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 23 | TREE=.. |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 24 | DEST=module |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 25 | |
| 26 | # make sure we're running in our own directory |
| 27 | if [ -f create-module.sh ]; then :; else |
| 28 | cd $( dirname $0 ) |
| 29 | if [ -f create-module.sh ]; then :; else |
| 30 | echo "Please run the script from is directory." >&2 |
| 31 | exit 1 |
| 32 | fi |
| 33 | fi |
| 34 | |
| 35 | # use a temporary directory to build the module, then rsync to DEST |
| 36 | # this allows touching only new files, for more efficient re-builds |
| 37 | TMP=$DEST-tmp |
| 38 | rm -rf $TMP |
| 39 | |
| 40 | mkdir -p $TMP/mbedtls $TMP/source |
| 41 | cp $TREE/include/mbedtls/*.h $TMP/mbedtls |
| 42 | cp $TREE/library/*.c $TMP/source |
| 43 | |
| 44 | # temporary, should depend on external module later |
| 45 | cp data/entropy_hardware_poll.c $TMP/source |
| 46 | cp data/target_config.h $TMP/mbedtls |
| 47 | |
| 48 | data/adjust-config.sh $TREE/scripts/config.pl $TMP/mbedtls/config.h |
| 49 | |
| 50 | mkdir -p $TMP/test |
| 51 | cp -r data/example-* $TMP/test |
| 52 | # later we should have the generated test suites here too |
| 53 | |
| 54 | cp data/module.json $TMP |
| 55 | cp data/README.md $TMP |
| 56 | |
Manuel Pégourié-Gonnard | 9acf88b | 2015-08-21 17:06:22 +0200 | [diff] [blame] | 57 | cp ../LICENSE $TMP |
| 58 | if [ -f ../apache-2.0.txt ]; then cp ../apache-2.0.txt $TMP; fi |
| 59 | |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 60 | mkdir -p $DEST |
| 61 | rsync -cr --delete --exclude build --exclude yotta_\* $TMP/ $DEST/ |
| 62 | rm -rf $TMP |
| 63 | |
Manuel Pégourié-Gonnard | 493f065 | 2015-08-17 14:23:43 +0200 | [diff] [blame] | 64 | echo "mbed TLS yotta module created in '$PWD/$DEST'." |