diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2020-05-14 05:54:58 +0300 |
---|---|---|
committer | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2020-05-24 21:46:51 +0300 |
commit | 2055909fe4fdc386f69e8171e49be72ccfc934ba (patch) | |
tree | e8f51b1ffdbcbcd94bc2ff53627842691ac4a6e2 /devel | |
parent | 4266d0bef6cf3f58fb4669d225d5590c0f2118d5 (diff) | |
download | gnutls-2055909fe4fdc386f69e8171e49be72ccfc934ba.tar.gz |
build: vendor in libtasn1 codetmp-vendor-minitasn1
Instead of keeping the minitasn1 source in Git, vendor in it during
bootstrap as we do with Nettle code. This also upgrades included
minitasn1 to latest version (4.16.0).
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Diffstat (limited to 'devel')
-rwxr-xr-x | devel/import-minitasn1.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/devel/import-minitasn1.sh b/devel/import-minitasn1.sh new file mode 100755 index 0000000000..d8b48daac8 --- /dev/null +++ b/devel/import-minitasn1.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +# This script copies files from the libtasn1 upstream, with necessary +# adjustments for bundling in GnuTLS. + +set +e + +: ${srcdir=.} +SRC=$srcdir/devel/libtasn1/lib +DST=$srcdir/lib/minitasn1 + +IMPORTS=" +coding.c +decoding.c +element.c +element.h +errors.c +gstr.c +gstr.h +int.h +parser_aux.c +parser_aux.h +structure.c +structure.h +version.c +libtasn1.h +" + +test -d $DST || mkdir $DST + +ASN1_VERSION=`grep AC_INIT $SRC/../configure.ac | sed -e 's/.*\],\[\([^]]*\)\],\[.*/\1/g'` +ASN1_VERSION_MAJOR=`echo ${ASN1_VERSION} | cut -d . -f 1` +ASN1_VERSION_MINOR=`echo ${ASN1_VERSION} | cut -d . -f 2` +ASN1_VERSION_PATCH=`echo ${ASN1_VERSION} | cut -d . -f 3` +ASN1_VERSION_NUMBER=`printf '0x%02x%02x%02x' $ASN1_VERSION_MAJOR $ASN1_VERSION_MINOR $ASN1_VERSION_PATCH` + +for f in $IMPORTS; do + src=$SRC/$f + dst=$DST/$f + if test "$f" = "libtasn1.h"; then + src=$SRC/includes/$f.in + fi + if test -f $src; then + if test -f $dst; then + echo "Replacing $dst (existing file backed up in $dst~)" + mv $dst $dst~ + else + echo "Copying file $dst" + fi + cp $src $dst + case $dst in + */libtasn1.h) + sed \ + -e 's/@VERSION@/'${ASN1_VERSION}'/g' \ + -e 's/@ASN1_VERSION_MAJOR@/'${ASN1_VERSION_MAJOR}'/g' \ + -e 's/@ASN1_VERSION_MINOR@/'${ASN1_VERSION_MINOR}'/g' \ + -e 's/@ASN1_VERSION_PATCH@/'${ASN1_VERSION_PATCH}'/g' \ + -e 's/@ASN1_VERSION_NUMBER@/'${ASN1_VERSION_NUMBER}'/g' \ + $dst > $dst-t && \ + mv $dst-t $dst + ;; + esac + else + echo "Error: $src not found" 1>&2 + exit 1 + fi +done |