2012-11-26 16:18:12 +00:00
|
|
|
#!/bin/bash
|
2016-05-22 23:22:58 +00:00
|
|
|
#
|
|
|
|
# This file is part of mbed TLS (https://tls.mbed.org)
|
|
|
|
#
|
|
|
|
# Copyright (c) 2012-2016, ARM Limited, All Rights Reserved
|
|
|
|
#
|
|
|
|
# Purpose
|
|
|
|
#
|
|
|
|
# Sets the version numbers in the source code to those given.
|
|
|
|
#
|
|
|
|
# Usage: bump_version.sh [ --version <version> ] [ --so-crypto <version>]
|
|
|
|
# [ -v | --verbose ] [ -h | --help ]
|
|
|
|
#
|
2012-11-26 16:18:12 +00:00
|
|
|
|
|
|
|
VERSION=""
|
|
|
|
SOVERSION=""
|
|
|
|
|
|
|
|
# Parse arguments
|
|
|
|
#
|
|
|
|
until [ -z "$1" ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
--version)
|
|
|
|
# Version to use
|
|
|
|
shift
|
|
|
|
VERSION=$1
|
|
|
|
;;
|
2015-06-25 09:54:52 +00:00
|
|
|
--so-crypto)
|
2012-11-26 16:18:12 +00:00
|
|
|
shift
|
2015-06-25 09:54:52 +00:00
|
|
|
SO_CRYPTO=$1
|
|
|
|
;;
|
2012-11-26 16:18:12 +00:00
|
|
|
-v|--verbose)
|
|
|
|
# Be verbose
|
|
|
|
VERBOSE="1"
|
|
|
|
;;
|
|
|
|
-h|--help)
|
|
|
|
# print help
|
|
|
|
echo "Usage: $0"
|
2015-06-25 09:54:52 +00:00
|
|
|
echo -e " -h|--help\t\tPrint this help."
|
2012-11-26 16:18:12 +00:00
|
|
|
echo -e " --version <version>\tVersion to bump to."
|
2015-06-25 09:54:52 +00:00
|
|
|
echo -e " --so-crypto <version>\tSO version to bump libmbedcrypto to."
|
2012-11-26 16:18:12 +00:00
|
|
|
echo -e " -v|--verbose\t\tVerbose."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# print error
|
|
|
|
echo "Unknown argument: '$1'"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "X" = "X$VERSION" ];
|
|
|
|
then
|
|
|
|
echo "No version specified. Unable to continue."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ $VERBOSE ] && echo "Bumping VERSION in library/CMakeLists.txt"
|
2015-06-25 09:51:12 +00:00
|
|
|
sed -e "s/ VERSION [0-9.]\{1,\}/ VERSION $VERSION/g" < library/CMakeLists.txt > tmp
|
2012-11-26 16:18:12 +00:00
|
|
|
mv tmp library/CMakeLists.txt
|
|
|
|
|
2015-06-25 09:54:52 +00:00
|
|
|
if [ "X" != "X$SO_CRYPTO" ];
|
|
|
|
then
|
|
|
|
[ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/CMakeLists.txt"
|
|
|
|
sed -e "/mbedcrypto/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_CRYPTO/g" < library/CMakeLists.txt > tmp
|
|
|
|
mv tmp library/CMakeLists.txt
|
|
|
|
|
|
|
|
[ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/Makefile"
|
|
|
|
sed -e "s/SOEXT_CRYPTO=so.[0-9]\{1,\}/SOEXT_CRYPTO=so.$SO_CRYPTO/g" < library/Makefile > tmp
|
|
|
|
mv tmp library/Makefile
|
|
|
|
fi
|
|
|
|
|
2015-03-09 17:05:11 +00:00
|
|
|
[ $VERBOSE ] && echo "Bumping VERSION in include/mbedtls/version.h"
|
2012-11-26 16:18:12 +00:00
|
|
|
read MAJOR MINOR PATCH <<<$(IFS="."; echo $VERSION)
|
|
|
|
VERSION_NR="$( printf "0x%02X%02X%02X00" $MAJOR $MINOR $PATCH )"
|
2015-03-09 17:05:11 +00:00
|
|
|
cat include/mbedtls/version.h | \
|
2015-06-25 09:51:12 +00:00
|
|
|
sed -e "s/_VERSION_MAJOR .\{1,\}/_VERSION_MAJOR $MAJOR/" | \
|
|
|
|
sed -e "s/_VERSION_MINOR .\{1,\}/_VERSION_MINOR $MINOR/" | \
|
|
|
|
sed -e "s/_VERSION_PATCH .\{1,\}/_VERSION_PATCH $PATCH/" | \
|
|
|
|
sed -e "s/_VERSION_NUMBER .\{1,\}/_VERSION_NUMBER $VERSION_NR/" | \
|
|
|
|
sed -e "s/_VERSION_STRING .\{1,\}/_VERSION_STRING \"$VERSION\"/" | \
|
|
|
|
sed -e "s/_VERSION_STRING_FULL .\{1,\}/_VERSION_STRING_FULL \"mbed TLS $VERSION\"/" \
|
2012-11-26 16:18:12 +00:00
|
|
|
> tmp
|
2015-03-09 17:05:11 +00:00
|
|
|
mv tmp include/mbedtls/version.h
|
2012-11-26 16:18:12 +00:00
|
|
|
|
|
|
|
[ $VERBOSE ] && echo "Bumping version in tests/suites/test_suite_version.data"
|
2015-06-25 09:51:12 +00:00
|
|
|
sed -e "s/version:\".\{1,\}/version:\"$VERSION\"/g" < tests/suites/test_suite_version.data > tmp
|
2012-11-26 16:18:12 +00:00
|
|
|
mv tmp tests/suites/test_suite_version.data
|
|
|
|
|
2015-01-22 17:01:27 +00:00
|
|
|
[ $VERBOSE ] && echo "Bumping PROJECT_NAME in doxygen/mbedtls.doxyfile and doxygen/input/doc_mainpage.h"
|
|
|
|
for i in doxygen/mbedtls.doxyfile doxygen/input/doc_mainpage.h;
|
2012-11-26 16:18:12 +00:00
|
|
|
do
|
2015-06-25 09:51:12 +00:00
|
|
|
sed -e "s/mbed TLS v[0-9\.]\{1,\}/mbed TLS v$VERSION/g" < $i > tmp
|
2012-11-26 16:18:12 +00:00
|
|
|
mv tmp $i
|
|
|
|
done
|
|
|
|
|
2014-04-30 09:49:44 +00:00
|
|
|
[ $VERBOSE ] && echo "Re-generating library/error.c"
|
2014-05-09 11:40:14 +00:00
|
|
|
scripts/generate_errors.pl
|
2014-04-30 09:49:44 +00:00
|
|
|
|
2019-02-28 11:37:23 +00:00
|
|
|
[ $VERBOSE ] && echo "Re-generating programs/test/query_config.c"
|
2018-10-16 21:13:57 +00:00
|
|
|
scripts/generate_query_config.pl
|
|
|
|
|
2014-04-30 09:49:44 +00:00
|
|
|
[ $VERBOSE ] && echo "Re-generating library/version_features.c"
|
2014-05-09 11:40:14 +00:00
|
|
|
scripts/generate_features.pl
|
2014-05-09 11:25:10 +00:00
|
|
|
|
|
|
|
[ $VERBOSE ] && echo "Re-generating visualc files"
|
|
|
|
scripts/generate_visualc_files.pl
|
2016-05-22 23:22:58 +00:00
|
|
|
|