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 | # |
Bence Szépkúti | 44bfbe3 | 2020-08-19 16:54:51 +0200 | [diff] [blame] | 3 | # Copyright The Mbed TLS Contributors |
Bence Szépkúti | 4e9f712 | 2020-06-05 13:02:18 +0200 | [diff] [blame] | 4 | # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
| 5 | # |
| 6 | # This file is provided under the Apache License 2.0, or the |
| 7 | # GNU General Public License v2.0 or later. |
| 8 | # |
| 9 | # ********** |
| 10 | # Apache License 2.0: |
Bence Szépkúti | 09b4f19 | 2020-05-26 01:54:15 +0200 | [diff] [blame] | 11 | # |
| 12 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 13 | # not use this file except in compliance with the License. |
| 14 | # You may obtain a copy of the License at |
| 15 | # |
| 16 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 17 | # |
| 18 | # Unless required by applicable law or agreed to in writing, software |
| 19 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 20 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 21 | # See the License for the specific language governing permissions and |
| 22 | # limitations under the License. |
Bence Szépkúti | b7246ad | 2020-05-26 00:33:31 +0200 | [diff] [blame] | 23 | # |
Bence Szépkúti | 4e9f712 | 2020-06-05 13:02:18 +0200 | [diff] [blame] | 24 | # ********** |
| 25 | # |
| 26 | # ********** |
| 27 | # GNU General Public License v2.0 or later: |
| 28 | # |
| 29 | # This program is free software; you can redistribute it and/or modify |
| 30 | # it under the terms of the GNU General Public License as published by |
| 31 | # the Free Software Foundation; either version 2 of the License, or |
| 32 | # (at your option) any later version. |
| 33 | # |
| 34 | # This program is distributed in the hope that it will be useful, |
| 35 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 36 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 37 | # GNU General Public License for more details. |
| 38 | # |
| 39 | # You should have received a copy of the GNU General Public License along |
| 40 | # with this program; if not, write to the Free Software Foundation, Inc., |
| 41 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 42 | # |
| 43 | # ********** |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 44 | |
| 45 | set -eu |
| 46 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 47 | # relative to the script's directory |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 48 | TREE=.. |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 49 | DEST=module |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 50 | |
| 51 | # make sure we're running in our own directory |
| 52 | if [ -f create-module.sh ]; then :; else |
| 53 | cd $( dirname $0 ) |
| 54 | if [ -f create-module.sh ]; then :; else |
| 55 | echo "Please run the script from is directory." >&2 |
| 56 | exit 1 |
| 57 | fi |
| 58 | fi |
| 59 | |
| 60 | # use a temporary directory to build the module, then rsync to DEST |
| 61 | # this allows touching only new files, for more efficient re-builds |
| 62 | TMP=$DEST-tmp |
| 63 | rm -rf $TMP |
| 64 | |
| 65 | mkdir -p $TMP/mbedtls $TMP/source |
| 66 | cp $TREE/include/mbedtls/*.h $TMP/mbedtls |
| 67 | cp $TREE/library/*.c $TMP/source |
| 68 | |
| 69 | # temporary, should depend on external module later |
| 70 | cp data/entropy_hardware_poll.c $TMP/source |
| 71 | cp data/target_config.h $TMP/mbedtls |
| 72 | |
| 73 | data/adjust-config.sh $TREE/scripts/config.pl $TMP/mbedtls/config.h |
| 74 | |
| 75 | mkdir -p $TMP/test |
| 76 | cp -r data/example-* $TMP/test |
| 77 | # later we should have the generated test suites here too |
| 78 | |
| 79 | cp data/module.json $TMP |
| 80 | cp data/README.md $TMP |
| 81 | |
Manuel Pégourié-Gonnard | 9acf88b | 2015-08-21 17:06:22 +0200 | [diff] [blame] | 82 | cp ../LICENSE $TMP |
| 83 | if [ -f ../apache-2.0.txt ]; then cp ../apache-2.0.txt $TMP; fi |
| 84 | |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 85 | mkdir -p $DEST |
| 86 | rsync -cr --delete --exclude build --exclude yotta_\* $TMP/ $DEST/ |
| 87 | rm -rf $TMP |
| 88 | |
Manuel Pégourié-Gonnard | 493f065 | 2015-08-17 14:23:43 +0200 | [diff] [blame] | 89 | echo "mbed TLS yotta module created in '$PWD/$DEST'." |