-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.sh
executable file
·73 lines (58 loc) · 1.54 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
DEPDIR=.3rdparty
CATCH=catchorg/Catch2
MBEDTLS=ARMmbed/mbedtls
function help() {
echo -e "
$> $0 [all | mbedtls | catch]
downloads following dependencies from github.com:
- github.com:${MBEDTLS}: crypto backend
- github.com:${CATCH}: for unit testing
into ./${DEPDIR}/
as <${CATCH}> and <${MBEDTLS}> are large repositories
with deep histories, this script just downloads the files from master branch
rather than git cloning (or adding them as git submodules/subtree).
"
}
function status() {
echo -e "downloading github.com:$1 into ./${DEPDIR}/ ..."
}
function fetch_catch2() {
status ${CATCH}
mkdir -p catch2
curl -ss -L "https://github.com/catchorg/Catch2/releases/download/v2.13.8/catch.hpp" -o catch2/catch.hpp
echo " done."
}
function fetch_mbedtls() {
status ${MBEDTLS}
rm -rf mbedtls*
curl -ss -L "https://github.com/ARMmbed/mbedtls/archive/refs/tags/mbedtls-2.16.12.tar.gz" | tar xz
mv mbedtls-* mbedtls
echo " done."
}
function make_ctags() {
ctags --exclude=.build --exclude=.3rdparty \
--c++-kinds=+cefgnps --fields=+iaS --extra=+fq -R .
}
CMD="help"
[[ -n "$1" ]] && CMD="$1"
case $CMD in
catch|catch2)
mkdir -p $DEPDIR
(cd $DEPDIR || exit; fetch_catch2)
;;
mbedtls)
mkdir -p $DEPDIR
(cd $DEPDIR || exit; fetch_mbedtls)
;;
all)
mkdir -p $DEPDIR
(cd $DEPDIR || exit; fetch_catch2 && fetch_mbedtls)
;;
tags|ctag|ctags)
make_ctags
;;
help|*)
help
;;
esac