-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
46 lines (38 loc) · 859 Bytes
/
build.sh
File metadata and controls
46 lines (38 loc) · 859 Bytes
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
#!/bin/sh
[ -z "${BDIR}" ] && BDIR=build
die()
{
echo "ERROR: ${*}."
exit 1
}
ask()
{
echo -n "${*} [n]? "
read _answer
[ "${_answer}" = "y" ]
}
echo "**** Creating the build directory ***"
if [ -d "${BDIR}" ]; then
echo "WARNING: ${BDIR} already exists."
ask "Do you want to continue" || exit 0
rm -rf "${BDIR}"
fi
mkdir "${BDIR}"
cd "${BDIR}" || die "Can't create directory ${BDIR}"
echo "**** Configuring project ****"
cmake .. "$@" || die "Configuration failed"
echo "**** Compiling project ****"
make || die "Compilation failed"
echo "**** Installing project ****"
if ask "Do you want to install initng now"; then
if [ ${UID} -eq 0 ]; then
make install
else
echo "root privileges required."
su -c "make install"
fi || die "Installation failed"
fi
cd ..
ask "Do you want to clear the build directory" &&
rm -rf "${BDIR}"
exit 0