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