2016-02-07 20:02:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-06-07 19:08:08 +00:00
|
|
|
set -e
|
|
|
|
|
2017-04-20 12:24:25 +00:00
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
cd $CURDIR
|
|
|
|
|
|
|
|
source "./release_lib.sh"
|
2016-02-07 20:02:44 +00:00
|
|
|
|
|
|
|
CONTROL=debian/control
|
2017-04-20 12:24:25 +00:00
|
|
|
DEBUILD_NOSIGN_OPTIONS="-us -uc"
|
2016-03-02 20:30:56 +00:00
|
|
|
|
2017-08-17 16:49:23 +00:00
|
|
|
if [ -z "$REVISION" ] ; then
|
|
|
|
get_revision_author
|
|
|
|
fi
|
|
|
|
|
2016-06-10 14:42:05 +00:00
|
|
|
while [[ $1 == --* ]]
|
|
|
|
do
|
2017-04-20 12:24:25 +00:00
|
|
|
if [[ $1 == '--test' ]]; then
|
|
|
|
TEST='yes'
|
|
|
|
VERSION_POSTFIX+=-test
|
|
|
|
shift
|
|
|
|
elif [[ $1 == '--ignore-deps' ]]; then
|
|
|
|
DEBUILD_NODEPS_OPTIONS="-d"
|
|
|
|
shift
|
|
|
|
elif [[ $1 == '--version' ]]; then
|
|
|
|
gen_revision_author
|
|
|
|
git push
|
|
|
|
exit 0
|
2017-05-16 13:01:00 +00:00
|
|
|
elif [[ $1 == '--head' ]]; then
|
|
|
|
REVISION=`git rev-parse HEAD`
|
|
|
|
shift
|
2017-04-20 12:24:25 +00:00
|
|
|
else
|
|
|
|
echo "Unknown option $1"
|
|
|
|
exit 2
|
|
|
|
fi
|
2016-06-10 14:42:05 +00:00
|
|
|
done
|
2016-05-28 00:52:18 +00:00
|
|
|
|
2017-04-20 12:24:25 +00:00
|
|
|
|
|
|
|
# Build options
|
|
|
|
if [ -n "$SANITIZER" ]
|
2016-06-10 14:42:05 +00:00
|
|
|
then
|
2017-04-20 12:24:25 +00:00
|
|
|
CMAKE_BUILD_TYPE=$SANITIZER
|
|
|
|
VERSION_POSTFIX+=-${SANITIZER,,}
|
|
|
|
# todo: нужно ли отключить libtcmalloc?
|
|
|
|
LIBTCMALLOC_OPTS="-DENABLE_LIBTCMALLOC=0"
|
|
|
|
# GLIBC_COMPATIBILITY отключен по умолчанию
|
|
|
|
elif [[ $BUILD_TYPE == 'valgrind' ]]; then
|
|
|
|
LIBTCMALLOC_OPTS="-DENABLE_LIBTCMALLOC=0"
|
|
|
|
VERSION_POSTFIX+=-$BUILD_TYPE
|
|
|
|
elif [[ $BUILD_TYPE == 'debug' ]]; then
|
|
|
|
CMAKE_BUILD_TYPE=Debug
|
|
|
|
LIBTCMALLOC_OPTS="-DDEBUG_LIBTCMALLOC=1"
|
|
|
|
VERSION_POSTFIX+=-$BUILD_TYPE
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$THREAD_COUNT" ] ; then
|
|
|
|
THREAD_COUNT=`nproc || grep -c ^processor /proc/cpuinfo`
|
2016-06-10 14:42:05 +00:00
|
|
|
fi
|
|
|
|
|
2017-04-20 12:24:25 +00:00
|
|
|
CMAKE_FLAGS_ADD+=" $LIBTCMALLOC_OPTS -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE"
|
|
|
|
|
|
|
|
REVISION+=$VERSION_POSTFIX
|
2016-02-07 20:02:44 +00:00
|
|
|
echo -e "\nCurrent revision is $REVISION"
|
|
|
|
|
2017-08-18 13:25:14 +00:00
|
|
|
gen_changelog "$REVISION" "" "$AUTHOR" ""
|
2016-02-07 20:02:44 +00:00
|
|
|
|
2016-06-26 04:34:48 +00:00
|
|
|
# Build (only binary packages).
|
2017-05-22 21:05:54 +00:00
|
|
|
debuild -e PATH -e SSH_AUTH_SOCK -e DEB_BUILD_OPTIONS=parallel=$THREAD_COUNT -e DEB_CC -e DEB_CXX -e DEB_CLANG -e CMAKE_FLAGS_ADD="$CMAKE_FLAGS_ADD" -b ${DEBUILD_NOSIGN_OPTIONS} ${DEBUILD_NODEPS_OPTIONS}
|