-
Notifications
You must be signed in to change notification settings - Fork 2
/
autogen.sh
executable file
·49 lines (41 loc) · 1.48 KB
/
autogen.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
#!/bin/bash
#
# autogen.sh
#
# Some targets have lots of source files and it would be hard to keep them all consistent and
# up-to-date manually. Lists of source files in corresponding CMakeLists.txt are thus generated by
# this script.
#
# Additionally this scripts updates version numbers in various files.
#
set -e
components=(
src/ozCore
src/ozEngine
src/ozFactory
src/unittest
src/common
src/matrix
src/nirvana
src/client
src/builder
)
version=$(sed -E '/^project\(/ !d; s|.* VERSION "([^"]*)".*|\1|' CMakeLists.txt)
# Generate CMakeLists.txt files.
for component in "${components[@]}"; do
echo "Generating $component/CMakeLists.txt"
# List all *.hh and *.cc under the component's directory.
sources=$(cd "$component" && git ls-files '*.hh' '*.cc' | paste -s | sed -E 's|\t|\\n |g')
# Insert source file list between "#BEGIN SOURCES" and "#END SOURCES" tags in CMakeLists.txt.
sed -E '/^#BEGIN SOURCES$/,/^#END SOURCES$/ c\#BEGIN SOURCES\n '"$sources"'\n#END SOURCES' \
-i "$component/CMakeLists.txt"
done
# Fix version numbers.
echo "Updating version in doc/Doxyfile*"
sed -E 's|^(PROJECT_NUMBER *= *).*$|\1'"$version"'|' -i doc/Doxyfile*
echo "Updating HTML READMEs doc/*.html"
sed -E 's|(<!--CMAKE_PROJECT_VERSION-->)[^<"]*|\1'"$version"'|' -i doc/*.html
echo "Updating version in etc/openzone.spec"
sed -E 's|^(Version: *).*$|\1'"$version"'|' -i etc/openzone.spec
echo "Updating version in etc/PKGBUILD*"
sed -E 's|^(pkgver=).*$|\1'"$version"'|' -i etc/PKGBUILD*