-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·74 lines (64 loc) · 1.83 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
#!/bin/bash
LCOLOR="\033[32m"
RCOLOR="\033[0m"
install_prefix=
build_type=
use_ssl=
for arg in "$@"
do
if [ $arg == "--with-ssl" ]; then
use_ssl="-DANGEL_USE_OPENSSL=ON"
elif [ ${arg:0:17} == "--install-prefix=" ]; then
install_prefix="-DCMAKE_INSTALL_PREFIX=${arg:17}"
elif [ $arg == "--release" ]; then
build_type="-DCMAKE_BUILD_TYPE=Release"
elif [ $arg == "--debug" ]; then
build_type="-DCMAKE_BUILD_TYPE=Debug"
else
echo -e "illegal option \`$arg\`"
exit 1;
fi
done
cmake_args="$install_prefix $build_type $use_ssl"
have_known_file=false
mime_types_file="./mime.types"
# If these known files not exist,
# we install "$mime_types_file" to "/usr/local/etc/".
known_files=(
"/etc/mime.types"
"/etc/httpd/mime.types"
"/etc/httpd/conf/mime.types"
"/etc/apache/mime.types"
"/etc/apache2/mime.types"
"/usr/local/etc/httpd/conf/mime.types"
"/usr/local/lib/netscape/mime.types"
"/usr/local/etc/mime.types"
)
for file in "${known_files[@]}"
do
if [ ! -f "$file" ]; then
continue
fi
have_known_file=true
break
done
if [ $have_known_file == false ]; then
if [ ! -f "$mime_types_file" ]; then
echo -e "$LCOLOR Build failed, can't find $mime_types_file $RCOLOR"
exit 1;
fi
cp "$mime_types_file" "/usr/local/etc/"
fi
echo -e "$LCOLOR Creating a directory ./build to build angel $RCOLOR"
mkdir ./build # ignore error "File exists"
cd ./build || return
if ! cmake $cmake_args .. || ! make -j4 install ; then
echo -e "$LCOLOR Build failed $RCOLOR"
exit 1;
fi
echo -e " _ "
echo -e " __ _ _ __ __ _ ___| | "
echo -e " / _\` | '_ \\ / _\` |/ _ \\ |"
echo -e " | (_| | | | | (_| | __/ | "
echo -e " \\__,_|_| |_|\\__, |\\___|_| "
echo -e " |___/ "