-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sh
executable file
·94 lines (68 loc) · 2.16 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
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
93
94
#!/bin/bash
#this script is for when you don't have cate or make installed
CC=cc
if ! command -v $CC &> /dev/null ; then
echo "No C++ compiler found"
exit 1
fi
build_folder="cate/build"; mkdir -p $build_folder
out_exec="out/cate"; mkdir -p out
cflags="-Iinclude -lstdc++ -march=native -fpermissive -funsafe-math-optimizations -ffast-math -fno-signed-zeros -ffinite-math-only -std=c++17 -lstdc++fs -Wall -O3 -pthread -ffunction-sections -fdata-sections -Wl,--gc-sections -fno-ident -fomit-frame-pointer -fmerge-all-constants -Wl,--build-id=none"
build_() {
obj_name="src_$1"
obj_name_mod="${obj_name/\//"_"}"
if [ src/$1.cpp -nt $build_folder/$obj_name_mod.o ]; then
$CC src/$1.cpp $cflags -c -o $build_folder/$obj_name_mod.o
fi
}
_build() {
if ! build_ $1 ; then
echo "Error in $1"
exit 1
fi
}
_build Parser/Lexer &
_build Class/Class &
_build Parser/Parser &
_build Parser/ParserExpect &
_build Parser/ParserArrays &
_build Parser/Recursive &
_build Util &
wait < <(jobs -p)
_build Class/Library &
_build Class/Project &
_build Class/ClassMethods &
_build Catel &
_build main &
_build Help &
wait < <(jobs -p)
$CC $build_folder/*.o $cflags -o$out_exec
if ! test -f "./out/cate"; then
echo "Cate didn't build corectly."
exit 1
fi
if command -v strip &> /dev/null; then
strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag out/cate
fi
install_command="cp ./out/cate /usr/local/bin/cate"
read -r -p "Done. Would you like to install Cate? [Y/n]: " response
case "$response" in
[yY][eE][sS]|[yY])
if command -v doas &> /dev/null; then
rootc='doas'
elif command -v sudo &> /dev/null; then
rootc='sudo'
elif [ "$EUID" -e 0]; then
rootc=''
else
echo "No way to run as root found, sorry"
exit 1
fi
$rootc $install_command
$rootc rm -f /usr/bin/cate
$rootc cp -f docs/manpages/cate.1 /usr/local/share/man/man1/
;;
*)
exit
;;
esac