blob: 6bdd400673d910097832b2572936aa3ac4f9639c [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
4#
5# This file is part of Mbed TLS (https://tls.mbed.org)
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +02006
7set -eu
8
Manuel Pégourié-Gonnard77d56bb2015-07-28 15:00:37 +02009# relative to the script's directory
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020010TREE=..
Manuel Pégourié-Gonnard77d56bb2015-07-28 15:00:37 +020011DEST=module
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020012
13# make sure we're running in our own directory
14if [ -f create-module.sh ]; then :; else
15 cd $( dirname $0 )
16 if [ -f create-module.sh ]; then :; else
17 echo "Please run the script from is directory." >&2
18 exit 1
19 fi
20fi
21
22# use a temporary directory to build the module, then rsync to DEST
23# this allows touching only new files, for more efficient re-builds
24TMP=$DEST-tmp
25rm -rf $TMP
26
27mkdir -p $TMP/mbedtls $TMP/source
28cp $TREE/include/mbedtls/*.h $TMP/mbedtls
29cp $TREE/library/*.c $TMP/source
30
31# temporary, should depend on external module later
32cp data/entropy_hardware_poll.c $TMP/source
33cp data/target_config.h $TMP/mbedtls
34
35data/adjust-config.sh $TREE/scripts/config.pl $TMP/mbedtls/config.h
36
37mkdir -p $TMP/test
38cp -r data/example-* $TMP/test
39# later we should have the generated test suites here too
40
41cp data/module.json $TMP
42cp data/README.md $TMP
43
Manuel Pégourié-Gonnard9acf88b2015-08-21 17:06:22 +020044cp ../LICENSE $TMP
45if [ -f ../apache-2.0.txt ]; then cp ../apache-2.0.txt $TMP; fi
46
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020047mkdir -p $DEST
48rsync -cr --delete --exclude build --exclude yotta_\* $TMP/ $DEST/
49rm -rf $TMP
50
Manuel Pégourié-Gonnard493f0652015-08-17 14:23:43 +020051echo "mbed TLS yotta module created in '$PWD/$DEST'."