2018-11-16 07:31:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-03-06 07:57:05 +00:00
|
|
|
#build drogon
|
2018-11-16 07:31:08 +00:00
|
|
|
function build_drogon() {
|
|
|
|
|
2018-11-16 10:25:41 +00:00
|
|
|
#Update the submodule and initialize
|
2018-11-16 07:31:08 +00:00
|
|
|
git submodule update --init
|
|
|
|
|
2019-09-30 13:34:30 +00:00
|
|
|
#Remove the config.h generated by the old version of drogon.
|
|
|
|
rm -f lib/inc/drogon/config.h
|
|
|
|
|
2019-03-06 07:57:05 +00:00
|
|
|
#Save current directory
|
2018-11-16 07:31:08 +00:00
|
|
|
current_dir="${PWD}"
|
|
|
|
|
2019-03-06 07:57:05 +00:00
|
|
|
#The folder in which we will build drogon
|
2018-11-16 07:31:08 +00:00
|
|
|
build_dir='./build'
|
|
|
|
if [ -d $build_dir ]; then
|
|
|
|
echo "Deleted folder: ${build_dir}"
|
2018-11-16 09:26:35 +00:00
|
|
|
rm -rf $build_dir
|
2018-11-16 07:31:08 +00:00
|
|
|
fi
|
|
|
|
|
2019-03-06 07:57:05 +00:00
|
|
|
#Create building folder
|
2018-11-16 07:31:08 +00:00
|
|
|
echo "Created building folder: ${build_dir}"
|
2018-11-16 09:26:35 +00:00
|
|
|
mkdir $build_dir
|
2018-11-16 07:31:08 +00:00
|
|
|
|
|
|
|
echo "Entering folder: ${build_dir}"
|
|
|
|
cd $build_dir
|
|
|
|
|
|
|
|
echo "Start building drogon ..."
|
2019-08-16 15:41:03 +00:00
|
|
|
if [ $1 -eq 1 ]; then
|
2019-12-07 09:43:00 +00:00
|
|
|
cmake .. -DBUILD_TESTING=YES
|
2019-08-16 15:41:03 +00:00
|
|
|
else
|
|
|
|
cmake ..
|
|
|
|
fi
|
|
|
|
|
2018-11-16 10:25:41 +00:00
|
|
|
#If errors then exit
|
2018-11-16 07:31:08 +00:00
|
|
|
if [ "$?" != "0" ]; then
|
2019-03-26 07:25:22 +00:00
|
|
|
exit -1
|
2018-11-16 07:31:08 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
make
|
|
|
|
|
2018-11-16 10:25:41 +00:00
|
|
|
#If errors then exit
|
2018-11-16 07:31:08 +00:00
|
|
|
if [ "$?" != "0" ]; then
|
2019-03-26 07:25:22 +00:00
|
|
|
exit -1
|
2018-11-16 07:31:08 +00:00
|
|
|
fi
|
|
|
|
|
2018-11-16 10:25:41 +00:00
|
|
|
echo "Installing ..."
|
2018-11-16 07:31:08 +00:00
|
|
|
sudo make install
|
|
|
|
|
2019-03-06 07:57:05 +00:00
|
|
|
#Go back to the current directory
|
2018-11-16 07:31:08 +00:00
|
|
|
cd $current_dir
|
2018-11-16 10:25:41 +00:00
|
|
|
#Ok!
|
2018-11-16 07:31:08 +00:00
|
|
|
}
|
|
|
|
|
2019-08-16 15:41:03 +00:00
|
|
|
if [ "$1" = "-t" ]; then
|
|
|
|
build_drogon 1
|
|
|
|
else
|
|
|
|
build_drogon 0
|
|
|
|
fi
|