-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmake_with_cmake
executable file
·76 lines (66 loc) · 2.02 KB
/
make_with_cmake
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
#!/bin/bash
# 03/2016 Marcel Bollmann
# This script can be used to easily invoke CMake and build CorA. It supports
# the following command-line arguments:
#
# debug - Turns debug mode on (default)
# release - Turns debug mode off
# clean - Deletes the build directory before calling CMake; **but** keeps
# any existing `config.php` file so local settings do not get
# lost.
# zip - Creates a file "current_build.tar.gz" with the current build
#
# We also set the directory for external downloads to be outside of the build
# directory, so external tools don't get re-downloaded for every clean build.
DEBUGMODE=ON
BUILDZIP=OFF
exists_in_path () {
case $(command -v -- "$1") in
/*) return 0;;
alias\ *) return 1;; # alias
*) return 1;; # built-in or function
esac
}
for var in "$@"; do
if [ "$var" = "clean" ]; then
if [ -d ./build ]; then
if [ -f ./build/www/config.php ]; then
CONFIGFILE=$(mktemp)
cp ./build/www/config.php "$CONFIGFILE"
fi
rm -rf ./build
fi
elif [ "$var" = "debug" ]; then
DEBUGMODE=ON
elif [ "$var" = "release" ]; then
DEBUGMODE=OFF
elif [ "$var" = "zip" ]; then
BUILDZIP=ON
fi
done
if [ ! -d ./build ]; then
mkdir build/
fi
cd build/
cmake -DDEBUG_MODE=$DEBUGMODE -DWITH_EXPENSIVE_TESTS=NO -DEXTERNALS_DOWNLOAD_DIR=../cmake-downloads ../
make && make docs
if [ "$BUILDZIP" = "ON" ]; then
ZIPDIR=$(mktemp -d)
mkdir "$ZIPDIR/cora"
cp -r www "$ZIPDIR/cora/www"
cp -r docs/user "$ZIPDIR/cora/docs"
cp -r ../README* "$ZIPDIR/cora"
mkdir "$ZIPDIR/cora/bin"
cp bin/cli_status_bar.php "$ZIPDIR/cora/bin"
cp bin/cora_* "$ZIPDIR/cora/bin"
cp ../bin/*.py "$ZIPDIR/cora/bin"
tar czf current_build.tar.gz -C "$ZIPDIR" cora
rm -rf "$ZIPDIR"
fi
if [[ -n "$CONFIGFILE" && -f "$CONFIGFILE" ]]; then
mv "$CONFIGFILE" www/config.php
chmod 664 www/config.php
fi
if exists_in_path restorecon; then
restorecon -R .
fi