-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·61 lines (51 loc) · 1.36 KB
/
build.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
#!/bin/bash
install_binaries()
{
polyglot_install_dir="$HOME/.local/bin"
read -r -p "Where do you want to install polyglot? [$polyglot_install_dir] " response
case "$response" in
"")
;;
*)
polyglot_install_dir=$response
;;
esac
cp build/polybuild "${polyglot_install_dir}/polybuild"
cp build/polyglot-cpp "${polyglot_install_dir}/polyglot-cpp"
cp build/polyglot-d "${polyglot_install_dir}/polyglot-d"
}
original_root=$(pwd)
fail_build_script()
{
echo $1
cd $original_root
exit
}
echo "Building polyglot-cpp..."
echo
mkdir -p build
cmake -Bbuild . || fail_build_script "Failed to run CMake"
cmake --build build -- -j $(nproc) || fail_build_script "Failed to build polyglot-cpp"
echo
echo "Building polyglot-d..."
echo
cd polyglot-d
dub build || fail_build_script "Failed to build polyglot-d"
cd ..
echo
echo "Building polybuild..."
echo
cd polybuild
dub build || fail_build_script "Failed to build polybuild"
cd ..
echo
read -r -p "Would you like to install polyglot now? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
install_binaries
;;
*)
echo "Before using polyglot, you must make sure that at least the language scanners"
echo "(e.g. polyglot-cpp) are in your path. Otherwise polybuild will not be able to call them."
;;
esac