v / thirdparty / mbedtls / update.vsh
27 lines · 21 sloc · 1000 bytes · 3d9911f887ecec942f9ae2a5be02d064f233b729
Raw
1// This script can be used to update the thirdparty/mbedtls/ folder to a future version of mbedtls.
2import os
3
4const version = 'v3.6.6'
5
6fn do(cmd string) {
7 println(cmd)
8 res := os.system(cmd)
9 if res != 0 {
10 panic('failed at: `${cmd}`')
11 }
12}
13
14os.chdir(os.dir(@VEXE))!
15
16do('rm -rf mbedtls/')
17do('git clone --depth=1 --recursive --shallow-submodules --single-branch --branch ${version} https://github.com/Mbed-TLS/mbedtls.git mbedtls/')
18do('rsync -a --delete mbedtls/include/ thirdparty/mbedtls/include/')
19do('rsync -a --delete mbedtls/library/ thirdparty/mbedtls/library/')
20do('rsync -a --delete mbedtls/3rdparty/ thirdparty/mbedtls/3rdparty/')
21do('rsync -a mbedtls/LICENSE thirdparty/mbedtls/LICENSE')
22do('rsync -a mbedtls/README.md thirdparty/mbedtls/README.md')
23do("find thirdparty/mbedtls/ -name '*.txt' -or -name '*.inc' -or -name '.gitignore' -or -name 'Makefile' |xargs rm -f")
24
25do('pushd .; cd thirdparty/mbedtls/; patch -p1 < ./mbedtls.patch')
26
27do('rm -rf mbedtls/')
28