blob: 7a3ce60cde8f49ef4ee59857674f5574bb406d5e [file] [log] [blame]
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +02001#!/bin/sh
Bence Szépkútib7246ad2020-05-26 00:33:31 +02002#
3# Copyright (C) 2015, Arm Limited, All Rights Reserved
Bence Szépkúti09b4f192020-05-26 01:54:15 +02004# 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útib7246ad2020-05-26 00:33:31 +020017#
18# This file is part of Mbed TLS (https://tls.mbed.org)
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020019
20set -eu
21
Manuel Pégourié-Gonnard77d56bb2015-07-28 15:00:37 +020022# relative to the script's directory
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020023TREE=..
Manuel Pégourié-Gonnard77d56bb2015-07-28 15:00:37 +020024DEST=module
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020025
26# make sure we're running in our own directory
27if [ -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
33fi
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
37TMP=$DEST-tmp
38rm -rf $TMP
39
40mkdir -p $TMP/mbedtls $TMP/source
41cp $TREE/include/mbedtls/*.h $TMP/mbedtls
42cp $TREE/library/*.c $TMP/source
43
44# temporary, should depend on external module later
45cp data/entropy_hardware_poll.c $TMP/source
46cp data/target_config.h $TMP/mbedtls
47
48data/adjust-config.sh $TREE/scripts/config.pl $TMP/mbedtls/config.h
49
50mkdir -p $TMP/test
51cp -r data/example-* $TMP/test
52# later we should have the generated test suites here too
53
54cp data/module.json $TMP
55cp data/README.md $TMP
56
Manuel Pégourié-Gonnard9acf88b2015-08-21 17:06:22 +020057cp ../LICENSE $TMP
58if [ -f ../apache-2.0.txt ]; then cp ../apache-2.0.txt $TMP; fi
59
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020060mkdir -p $DEST
61rsync -cr --delete --exclude build --exclude yotta_\* $TMP/ $DEST/
62rm -rf $TMP
63
Manuel Pégourié-Gonnard493f0652015-08-17 14:23:43 +020064echo "mbed TLS yotta module created in '$PWD/$DEST'."