This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

source: ps/trunk/build/premake/premake5/contrib/mbedtls/scripts/bump_version.sh

Last change on this file was 20366, checked in by Itms, 7 years ago

Alpha 12 version of Premake 5, including prebuilt binary for Windows.
Directly taken from https://premake.github.io/.

Refs #3729.

File size: 4.2 KB
Line 
1#!/bin/bash
2
3VERSION=""
4SOVERSION=""
5
6# Parse arguments
7#
8until [ -z "$1" ]
9do
10 case "$1" in
11 --version)
12 # Version to use
13 shift
14 VERSION=$1
15 ;;
16 --so-crypto)
17 shift
18 SO_CRYPTO=$1
19 ;;
20 --so-x509)
21 shift
22 SO_X509=$1
23 ;;
24 --so-tls)
25 shift
26 SO_TLS=$1
27 ;;
28 -v|--verbose)
29 # Be verbose
30 VERBOSE="1"
31 ;;
32 -h|--help)
33 # print help
34 echo "Usage: $0"
35 echo -e " -h|--help\t\tPrint this help."
36 echo -e " --version <version>\tVersion to bump to."
37 echo -e " --so-crypto <version>\tSO version to bump libmbedcrypto to."
38 echo -e " --so-x509 <version>\tSO version to bump libmbedx509 to."
39 echo -e " --so-tls <version>\tSO version to bump libmbedtls to."
40 echo -e " -v|--verbose\t\tVerbose."
41 exit 1
42 ;;
43 *)
44 # print error
45 echo "Unknown argument: '$1'"
46 exit 1
47 ;;
48 esac
49 shift
50done
51
52if [ "X" = "X$VERSION" ];
53then
54 echo "No version specified. Unable to continue."
55 exit 1
56fi
57
58[ $VERBOSE ] && echo "Bumping VERSION in library/CMakeLists.txt"
59sed -e "s/ VERSION [0-9.]\{1,\}/ VERSION $VERSION/g" < library/CMakeLists.txt > tmp
60mv tmp library/CMakeLists.txt
61
62if [ "X" != "X$SO_CRYPTO" ];
63then
64 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/CMakeLists.txt"
65 sed -e "/mbedcrypto/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_CRYPTO/g" < library/CMakeLists.txt > tmp
66 mv tmp library/CMakeLists.txt
67
68 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/Makefile"
69 sed -e "s/SOEXT_CRYPTO=so.[0-9]\{1,\}/SOEXT_CRYPTO=so.$SO_CRYPTO/g" < library/Makefile > tmp
70 mv tmp library/Makefile
71fi
72
73if [ "X" != "X$SO_X509" ];
74then
75 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedx509 in library/CMakeLists.txt"
76 sed -e "/mbedx509/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_X509/g" < library/CMakeLists.txt > tmp
77 mv tmp library/CMakeLists.txt
78
79 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedx509 in library/Makefile"
80 sed -e "s/SOEXT_X509=so.[0-9]\{1,\}/SOEXT_X509=so.$SO_X509/g" < library/Makefile > tmp
81 mv tmp library/Makefile
82fi
83
84if [ "X" != "X$SO_TLS" ];
85then
86 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedtls in library/CMakeLists.txt"
87 sed -e "/mbedtls/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_TLS/g" < library/CMakeLists.txt > tmp
88 mv tmp library/CMakeLists.txt
89
90 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedtls in library/Makefile"
91 sed -e "s/SOEXT_TLS=so.[0-9]\{1,\}/SOEXT_TLS=so.$SO_TLS/g" < library/Makefile > tmp
92 mv tmp library/Makefile
93fi
94
95[ $VERBOSE ] && echo "Bumping VERSION in include/mbedtls/version.h"
96read MAJOR MINOR PATCH <<<$(IFS="."; echo $VERSION)
97VERSION_NR="$( printf "0x%02X%02X%02X00" $MAJOR $MINOR $PATCH )"
98cat include/mbedtls/version.h | \
99 sed -e "s/_VERSION_MAJOR .\{1,\}/_VERSION_MAJOR $MAJOR/" | \
100 sed -e "s/_VERSION_MINOR .\{1,\}/_VERSION_MINOR $MINOR/" | \
101 sed -e "s/_VERSION_PATCH .\{1,\}/_VERSION_PATCH $PATCH/" | \
102 sed -e "s/_VERSION_NUMBER .\{1,\}/_VERSION_NUMBER $VERSION_NR/" | \
103 sed -e "s/_VERSION_STRING .\{1,\}/_VERSION_STRING \"$VERSION\"/" | \
104 sed -e "s/_VERSION_STRING_FULL .\{1,\}/_VERSION_STRING_FULL \"mbed TLS $VERSION\"/" \
105 > tmp
106mv tmp include/mbedtls/version.h
107
108[ $VERBOSE ] && echo "Bumping version in tests/suites/test_suite_version.data"
109sed -e "s/version:\".\{1,\}/version:\"$VERSION\"/g" < tests/suites/test_suite_version.data > tmp
110mv tmp tests/suites/test_suite_version.data
111
112[ $VERBOSE ] && echo "Bumping version in yotta/data/module.json"
113sed -e "s/\"version\": \".\{1,\}\"/\"version\": \"$VERSION\"/g" < yotta/data/module.json > tmp
114mv tmp yotta/data/module.json
115
116[ $VERBOSE ] && echo "Bumping PROJECT_NAME in doxygen/mbedtls.doxyfile and doxygen/input/doc_mainpage.h"
117for i in doxygen/mbedtls.doxyfile doxygen/input/doc_mainpage.h;
118do
119 sed -e "s/mbed TLS v[0-9\.]\{1,\}/mbed TLS v$VERSION/g" < $i > tmp
120 mv tmp $i
121done
122
123[ $VERBOSE ] && echo "Re-generating library/error.c"
124scripts/generate_errors.pl
125
126[ $VERBOSE ] && echo "Re-generating library/version_features.c"
127scripts/generate_features.pl
128
129[ $VERBOSE ] && echo "Re-generating visualc files"
130scripts/generate_visualc_files.pl
Note: See TracBrowser for help on using the repository browser.