-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkhbuilder
executable file
·60 lines (52 loc) · 1005 Bytes
/
khbuilder
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
#!/bin/bash
# Setup necessary data
TARGET="build"
if [ $# -gt 0 ]; then
TARGET="$1"
fi
# Checks if commands given as parameters are available
function check_dependencies() {
echo "Will now check for required tools"
for CMD in $@
do
echo -ne " Checking for $CMD... "
command -v $CMD >/dev/null 2>&1
if [ $? -gt 0 ]; then
echo "FAILED"
echo -e " Command $CMD is not available. Please make sure it is installed and available on the path."
exit 1
fi
echo "OK"
done
}
function build_kh() {
check_dependencies make cmake mvn
echo "Will now build KernelHive modules"
echo "Building C++ part."
mkdir -p build
cd build
cmake ..
if [ $? -ne 0 ]
then
exit 2
fi
make
if [ $? -ne 0 ]
then
exit 3
fi
echo "Building Java part."
cd ..
mvn install
}
function clean_kh() {
check_dependencies mvn
echo "Will now remove all build output"
rm -rf build
mvn clean
}
case "$TARGET" in
"build") build_kh ;;
"clean") clean_kh ;;
*) echo "Unsupported target: $TARGET"
esac