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
|
|
|
|
2017-11-16 13:44:46 +00:00
|
|
|
DEB_CC=${DEB_CC:=gcc-7}
|
|
|
|
DEB_CXX=${DEB_CXX:=g++-7}
|
2017-08-30 14:08:19 +00:00
|
|
|
|
2016-02-07 20:02:44 +00:00
|
|
|
CONTROL=debian/control
|
2017-04-20 12:24:25 +00:00
|
|
|
DEBUILD_NOSIGN_OPTIONS="-us -uc"
|
2017-11-16 21:21:01 +00:00
|
|
|
DEBUILD_NODEPS_OPTIONS="-d"
|
2018-03-14 23:04:35 +00:00
|
|
|
USE_PBUILDER=1
|
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
|
2017-11-16 21:21:01 +00:00
|
|
|
elif [[ $1 == '--check-build-dependencies' ]]; then
|
|
|
|
DEBUILD_NODEPS_OPTIONS=""
|
2017-04-20 12:24:25 +00:00
|
|
|
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
|
2018-03-15 09:41:06 +00:00
|
|
|
elif [[ $1 == '--pbuilder' ]]; then
|
|
|
|
# Default
|
|
|
|
shift
|
2018-03-14 23:04:35 +00:00
|
|
|
elif [[ $1 == '--no-pbuilder' ]]; then
|
|
|
|
USE_PBUILDER=
|
2017-12-28 13:27:49 +00:00
|
|
|
shift
|
2018-01-19 21:33:48 +00:00
|
|
|
elif [[ $1 == '--fast' ]]; then
|
|
|
|
# Wrong but fast pbuilder mode: create base package with all depends
|
2018-04-06 20:49:42 +00:00
|
|
|
EXTRAPACKAGES="$EXTRAPACKAGES debhelper cmake ninja-build gcc-7 g++-7 libc6-dev libmariadbclient-dev libicu-dev libltdl-dev libreadline-dev libssl-dev unixodbc-dev psmisc bash expect python python-lxml python-termcolor curl perl sudo openssl"
|
2018-01-19 21:33:48 +00:00
|
|
|
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?
|
2017-12-05 13:44:11 +00:00
|
|
|
LIBTCMALLOC_OPTS="-DENABLE_TCMALLOC=0"
|
2017-04-20 12:24:25 +00:00
|
|
|
# GLIBC_COMPATIBILITY отключен по умолчанию
|
2017-12-28 14:49:41 +00:00
|
|
|
export DEB_CC=clang-5.0
|
|
|
|
export DEB_CXX=clang++-5.0
|
2018-02-26 18:34:22 +00:00
|
|
|
EXTRAPACKAGES="$EXTRAPACKAGES clang-5.0 lld-5.0"
|
2017-04-20 12:24:25 +00:00
|
|
|
elif [[ $BUILD_TYPE == 'valgrind' ]]; then
|
2017-12-05 13:44:11 +00:00
|
|
|
LIBTCMALLOC_OPTS="-DENABLE_TCMALLOC=0"
|
2017-04-20 12:24:25 +00:00
|
|
|
VERSION_POSTFIX+=-$BUILD_TYPE
|
|
|
|
elif [[ $BUILD_TYPE == 'debug' ]]; then
|
|
|
|
CMAKE_BUILD_TYPE=Debug
|
2017-12-05 13:44:11 +00:00
|
|
|
LIBTCMALLOC_OPTS="-DDEBUG_TCMALLOC=1"
|
2017-04-20 12:24:25 +00:00
|
|
|
VERSION_POSTFIX+=-$BUILD_TYPE
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$THREAD_COUNT" ] ; then
|
2018-01-19 17:23:07 +00:00
|
|
|
THREAD_COUNT=`nproc || grep -c ^processor /proc/cpuinfo || sysctl -n hw.ncpu || echo 4`
|
2016-06-10 14:42:05 +00:00
|
|
|
fi
|
|
|
|
|
2018-02-26 18:34:22 +00:00
|
|
|
CMAKE_FLAGS=" $LIBTCMALLOC_OPTS -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DENABLE_EMBEDDED_COMPILER=1 $CMAKE_FLAGS"
|
2017-12-28 13:27:49 +00:00
|
|
|
export CMAKE_FLAGS
|
2018-01-19 21:33:48 +00:00
|
|
|
export EXTRAPACKAGES
|
2017-04-20 12:24:25 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2017-12-28 13:27:49 +00:00
|
|
|
if [ -z "$USE_PBUILDER" ] ; then
|
|
|
|
# Build (only binary packages).
|
|
|
|
debuild -e PATH -e SSH_AUTH_SOCK -e DEB_BUILD_OPTIONS=parallel=$THREAD_COUNT \
|
2017-11-12 12:58:40 +00:00
|
|
|
-e DEB_CC=$DEB_CC -e DEB_CXX=$DEB_CXX -e CMAKE_FLAGS="$CMAKE_FLAGS" \
|
|
|
|
-b ${DEBUILD_NOSIGN_OPTIONS} ${DEBUILD_NODEPS_OPTIONS}
|
2017-12-28 13:27:49 +00:00
|
|
|
else
|
2017-12-28 15:55:24 +00:00
|
|
|
export DIST=${DIST:=artful}
|
2018-01-12 16:22:18 +00:00
|
|
|
export SET_BUILDRESULT=${SET_BUILDRESULT:=$CURDIR/..}
|
2017-12-28 13:57:35 +00:00
|
|
|
. $CURDIR/debian/.pbuilderrc
|
2018-02-07 15:58:48 +00:00
|
|
|
|
|
|
|
|
2017-12-28 13:57:35 +00:00
|
|
|
if [[ -n "$FORCE_PBUILDER_CREATE" || ! -e "$BASETGZ" ]] ; then
|
2018-02-02 14:23:37 +00:00
|
|
|
echo Creating base system $BASETGZ
|
2018-02-07 15:58:48 +00:00
|
|
|
[ ! -e "/usr/share/debootstrap/scripts/${DIST}" ] && sudo ln -s gutsy /usr/share/debootstrap/scripts/${DIST}
|
|
|
|
sudo --preserve-env bash -x pbuilder create --configfile $CURDIR/debian/.pbuilderrc $PBUILDER_OPT
|
2018-01-19 21:33:48 +00:00
|
|
|
fi
|
|
|
|
|
2018-02-02 14:23:37 +00:00
|
|
|
# Update every 3 days (60*24*3 minutes)
|
|
|
|
if [[ -n "$PBUILDER_UPDATE" ]] || test `find "$BASETGZ" -mmin +4320` ; then
|
|
|
|
echo Updating base system $BASETGZ
|
2018-01-19 21:33:48 +00:00
|
|
|
sudo --preserve-env pbuilder update --configfile $CURDIR/debian/.pbuilderrc $PBUILDER_OPT
|
2017-12-28 13:27:49 +00:00
|
|
|
fi
|
2018-01-19 21:33:48 +00:00
|
|
|
|
2018-01-15 18:57:10 +00:00
|
|
|
pdebuild --configfile $CURDIR/debian/.pbuilderrc -- $PBUILDER_OPT
|
2017-12-28 13:27:49 +00:00
|
|
|
fi
|