/
bootstrap.sh
executable file
·92 lines (85 loc) · 2.4 KB
/
bootstrap.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
function indentAndSlash {
cat | sort | \
sed "s/^.\\// /" | \
sed "s/$/ \\\\/" | \
sed "\$s/\\\\//"
}
function indent {
cat | sort | sed 's/^/ "/' | sed 's/$/"/'
}
function indentAndDir {
if test "x$1" = "x"; then
p=""
else
p="$1/"
fi
cat | sort | sed "s!^! \"\${CMAKE_CURRENT_LIST_DIR}/$p!" | sed 's/$/"/'
}
# name incDirIfNot"include"
function doDir {
cd libs/$1
inc=${2:-include}
echo "set(mod_$1_INCLUDE_FILES"
find $inc -iname "*.hpp" | indentAndDir libs/$1
echo ")"
echo ""
if test -d src; then
echo "set(mod_$1_SRC_FILES"
find src -iname "*.cpp" | indentAndDir libs/$1
echo ")"
echo ""
fi
if test -d test; then
echo "set(mod_$1_TEST_CPP_FILES"
find test -iname "*.cpp" | sed "s/^test\/\(.*\)\.cpp$/\1/" | indent
echo ")"
echo ""
echo "set(mod_$1_TEST_PY_FILES"
find test -iname "*.py" | sed "s/^test\/\(.*\)\.py$/\1/" | indent
echo ")"
echo ""
fi
cd ../..
}
function gen_file_lists {
echo "# Auto-generated by bootstrap.sh"
doDir gml
doDir jla_boost
doDir libmod src
doDir pymodutils src
doDir pymod src
echo "set(mod_pymod_PY_FILES"
find libs/pymod/lib -iname "*.py" | indentAndDir
echo ")"
echo "set(mod_TEST_PY_FILES"
find test/py -iname "*.py" | sed -e "s!^test/!!" -e 's!\.py$!!' | indent
echo ")"
echo "set(mod_TEST_CPP_FILES"
find test/cpp -iname "*.cpp" | sed -e "s!^test/!!" -e 's!\.cpp$!!' | indent
echo ")"
echo ""
echo "set(mod_EXAMPLES_PY_FILES"
find examples/py -iname "*.py" | sed -e "s!^examples/!!" -e 's!\.py$!!' | indent
echo ")"
# this doesn't cover every single file, but it should be enough for normal edit-compile usage
echo "set(mod_DOC_FILES"
echo '${CMAKE_CURRENT_LIST_DIR}/doc/source/conf.py' | indent
echo '${CMAKE_CURRENT_LIST_DIR}/ChangeLog.rst' | indent
find doc/source -iname "*.rst" | sed -e 's!^!${CMAKE_CURRENT_LIST_DIR}/!' | indent
echo ")"
}
echo "VERSION"
# public versions are tagged with 'vA.B.0' and private with 'priv-A.B.0'
# these are converted into A.B.0 and A.B.1, with the commit offset as 4th component
v=$(git describe --tags --always --exclude "archive/*" | sed -e "s/^v//" -e 's/priv-\([0-9]*\.[0-9]*\)\.0/\1.1/' -e "s/-g.*$//" -e "s/-/./")
echo $v > VERSION
cat VERSION
echo "Docs"
doc/makeDocs.sh . || exit 1
echo "CMakeFiles.txt"
gen_file_lists > CMakeFiles.txt
echo "Recursing in external/graph_canon"
echo "---------------------------------"
cd external/graph_canon
./bootstrap.sh || exit 1