2019-04-16 14:12:02 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-02-07 20:02:44 +00:00
|
|
|
|
2018-08-08 05:19:54 +00:00
|
|
|
# If you have "no space left" error, you can change the location of temporary files with BUILDPLACE environment variable.
|
|
|
|
|
2018-05-05 12:31:47 +00:00
|
|
|
# Advanced usage:
|
2019-05-22 10:16:16 +00:00
|
|
|
# Test gcc-9:
|
|
|
|
# env DIST=disco EXTRAPACKAGES="gcc-9 g++-9" DEB_CC=gcc-9 DEB_CXX=g++-9 CMAKE_FLAGS=" -DNO_WERROR=1 " ./release
|
2018-05-05 12:31:47 +00:00
|
|
|
# Test gcc-8:
|
|
|
|
# env DIST=bionic EXTRAPACKAGES="gcc-8 g++-8" DEB_CC=gcc-8 DEB_CXX=g++-8 CMAKE_FLAGS=" -DNO_WERROR=1 " ./release
|
|
|
|
# Clang6 build:
|
2018-05-11 18:00:24 +00:00
|
|
|
# env DIST=bionic EXTRAPACKAGES="clang-6.0 libstdc++-8-dev lld-6.0 liblld-6.0-dev libclang-6.0-dev liblld-6.0" DEB_CC=clang-6.0 DEB_CXX=clang++-6.0 CMAKE_FLAGS=" -DNO_WERROR=1 " ./release
|
2018-05-07 15:59:52 +00:00
|
|
|
# Clang7 build:
|
2018-05-11 18:00:24 +00:00
|
|
|
# env DIST=unstable EXTRAPACKAGES="clang-7 libstdc++-8-dev lld-7 liblld-7-dev libclang-7-dev liblld-7" DEB_CC=clang-7 DEB_CXX=clang++-7 CMAKE_FLAGS=" -DNO_WERROR=1 " ./release
|
2018-05-05 12:31:47 +00:00
|
|
|
# Clang6 without internal compiler (for low memory arm64):
|
|
|
|
# env DIST=bionic DISABLE_PARALLEL=1 EXTRAPACKAGES="clang-6.0 libstdc++-8-dev" DEB_CC=clang-6.0 DEB_CXX=clang++-6.0 CMAKE_FLAGS=" -DNO_WERROR=1 " ./release
|
2018-09-05 18:50:17 +00:00
|
|
|
# Do not compile internal compiler but use from system:
|
|
|
|
# env CMAKE_FLAGS="-DUSE_INTERNAL_LLVM_LIBRARY=0 -DENABLE_EMBEDDED_COMPILER=0 -DINTERNAL_COMPILER_EXECUTABLE=clang-6.0 -DINTERNAL_LINKER_EXECUTABLE=ld.lld-6.0 -DINTERNAL_COMPILER_BIN_ROOT=/usr/bin/" EXTRAPACKAGES="clang-6.0 lld-6.0 libstdc++-8-dev" DEB_CXX=clang++-6.0 DEB_CC=clang-6.0 TEST_RUN=1 TEST_OPT="compile" ./release
|
2018-05-05 12:31:47 +00:00
|
|
|
|
2018-08-13 06:23:51 +00:00
|
|
|
# Build with ASan:
|
|
|
|
# env SANITIZER=address ./release
|
|
|
|
|
2018-07-17 11:15:14 +00:00
|
|
|
# Version increment:
|
|
|
|
# Default release: 18.1.2 -> 18.2.0:
|
|
|
|
# ./release --version
|
|
|
|
# or
|
|
|
|
# ./release --version minor
|
|
|
|
# Bugfix release (only with small patches to previous release): 18.1.2 -> 18.1.3:
|
|
|
|
# ./release --version patch
|
|
|
|
# Do this once per year: 18.1.2 -> 19.0.0:
|
|
|
|
# ./release --version major
|
|
|
|
|
2017-06-07 19:08:08 +00:00
|
|
|
set -e
|
|
|
|
|
2019-06-25 13:55:31 +00:00
|
|
|
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
cd $CUR_DIR
|
2017-04-20 12:24:25 +00:00
|
|
|
|
2019-01-09 18:32:43 +00:00
|
|
|
source "./utils/release/release_lib.sh"
|
2016-02-07 20:02:44 +00:00
|
|
|
|
2018-06-21 22:02:18 +00:00
|
|
|
PBUILDER_AUTOUPDATE=${PBUILDER_AUTOUPDATE=4320}
|
2017-08-30 14:08:19 +00:00
|
|
|
|
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-09-07 15:43:35 +00:00
|
|
|
USE_PBUILDER=${USE_PBUILDER=1}
|
2016-03-02 20:30:56 +00:00
|
|
|
|
2018-07-17 11:15:14 +00:00
|
|
|
if [ -z "$VERSION_STRING" ] ; then
|
2017-08-17 16:49:23 +00:00
|
|
|
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'
|
2018-05-08 19:44:54 +00:00
|
|
|
VERSION_POSTFIX+=+test
|
2017-04-20 12:24:25 +00:00
|
|
|
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
|
2018-07-17 11:15:14 +00:00
|
|
|
gen_revision_author $2
|
2017-04-20 12:24:25 +00:00
|
|
|
exit 0
|
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
|
2019-09-17 10:37:35 +00:00
|
|
|
EXTRAPACKAGES="$EXTRAPACKAGES debhelper cmake ninja-build gcc-8 g++-8 libc6-dev libicu-dev libreadline-dev psmisc bash expect python python-lxml python-termcolor python-requests curl perl sudo openssl netcat-openbsd"
|
2018-01-19 21:33:48 +00:00
|
|
|
shift
|
2019-06-25 13:55:31 +00:00
|
|
|
elif [[ $1 == '--rpm' ]]; then
|
|
|
|
MAKE_RPM=1
|
|
|
|
shift
|
|
|
|
elif [[ $1 == '--tgz' ]]; then
|
|
|
|
MAKE_TGZ=1
|
|
|
|
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
|
2018-08-11 23:38:32 +00:00
|
|
|
if [[ "$SANITIZER" == "address" ]]; then VERSION_POSTFIX+="+asan"
|
|
|
|
elif [[ "$SANITIZER" == "thread" ]]; then VERSION_POSTFIX+="+tsan"
|
|
|
|
elif [[ "$SANITIZER" == "memory" ]]; then VERSION_POSTFIX+="+msan"
|
|
|
|
elif [[ "$SANITIZER" == "undefined" ]]; then VERSION_POSTFIX+="+ubsan"
|
2019-09-22 10:34:09 +00:00
|
|
|
elif [[ "$SANITIZER" == "libfuzzer" ]]; then
|
|
|
|
VERSION_POSTFIX+="+libfuzzer"
|
|
|
|
MALLOC_OPTS="-DENABLE_TCMALLOC=0 -DENABLE_JEMALLOC=0"
|
2018-08-11 23:36:07 +00:00
|
|
|
else
|
|
|
|
echo "Unknown value of SANITIZER variable: $SANITIZER"
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
2018-07-12 16:44:15 +00:00
|
|
|
export DEB_CC=${DEB_CC=clang-6.0}
|
|
|
|
export DEB_CXX=${DEB_CXX=clang++-6.0}
|
|
|
|
EXTRAPACKAGES="$EXTRAPACKAGES clang-6.0 lld-6.0"
|
2017-04-20 12:24:25 +00:00
|
|
|
elif [[ $BUILD_TYPE == 'valgrind' ]]; then
|
2018-08-08 03:45:37 +00:00
|
|
|
MALLOC_OPTS="-DENABLE_TCMALLOC=0 -DENABLE_JEMALLOC=0"
|
2018-08-11 23:38:32 +00:00
|
|
|
VERSION_POSTFIX+="+valgrind"
|
2017-04-20 12:24:25 +00:00
|
|
|
elif [[ $BUILD_TYPE == 'debug' ]]; then
|
|
|
|
CMAKE_BUILD_TYPE=Debug
|
2018-08-11 23:38:32 +00:00
|
|
|
VERSION_POSTFIX+="+debug"
|
2017-04-20 12:24:25 +00:00
|
|
|
fi
|
|
|
|
|
2020-09-20 20:46:32 +00:00
|
|
|
CMAKE_FLAGS=" $MALLOC_OPTS -DSANITIZE=$SANITIZER -DENABLE_CHECK_HEAVY_BUILDS=1 $CMAKE_FLAGS"
|
2018-05-17 17:55:07 +00:00
|
|
|
[[ -n "$CMAKE_BUILD_TYPE" ]] && CMAKE_FLAGS=" -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE $CMAKE_FLAGS"
|
2018-05-16 00:34:56 +00:00
|
|
|
|
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
|
|
|
|
2018-07-17 11:15:14 +00:00
|
|
|
VERSION_STRING+=$VERSION_POSTFIX
|
|
|
|
echo -e "\nCurrent version is $VERSION_STRING"
|
2016-02-07 20:02:44 +00:00
|
|
|
|
2019-06-25 13:55:31 +00:00
|
|
|
if [ -z "$NO_BUILD" ] ; then
|
2019-06-27 15:36:31 +00:00
|
|
|
gen_changelog "$VERSION_STRING" "" "$AUTHOR" ""
|
2019-06-25 13:55:31 +00:00
|
|
|
if [ -z "$USE_PBUILDER" ] ; then
|
2019-09-17 10:37:35 +00:00
|
|
|
DEB_CC=${DEB_CC:=`which gcc-9 gcc-8 gcc | head -n1`}
|
|
|
|
DEB_CXX=${DEB_CXX:=`which g++-9 g++-8 g++ | head -n1`}
|
2019-06-25 13:55:31 +00:00
|
|
|
# Build (only binary packages).
|
|
|
|
debuild --preserve-env -e PATH \
|
|
|
|
-e DEB_CC=$DEB_CC -e DEB_CXX=$DEB_CXX -e CMAKE_FLAGS="$CMAKE_FLAGS" \
|
|
|
|
-b ${DEBUILD_NOSIGN_OPTIONS} ${DEBUILD_NODEPS_OPTIONS}
|
|
|
|
else
|
|
|
|
export DIST=${DIST:=bionic}
|
|
|
|
export SET_BUILDRESULT=${SET_BUILDRESULT:=$CUR_DIR/..}
|
2018-04-11 14:22:41 +00:00
|
|
|
|
2019-06-25 13:55:31 +00:00
|
|
|
if [[ -z `which pbuilder` ]] ; then
|
|
|
|
sudo apt install -y pbuilder devscripts ccache fakeroot debhelper debian-archive-keyring debian-keyring lsb-release
|
|
|
|
fi
|
2018-08-07 01:46:52 +00:00
|
|
|
|
2019-06-25 13:55:31 +00:00
|
|
|
. $CUR_DIR/debian/.pbuilderrc
|
2018-02-07 15:58:48 +00:00
|
|
|
|
2019-06-25 13:55:31 +00:00
|
|
|
if [[ ! -e "/usr/share/debootstrap/scripts/${DIST}" ]] ; then
|
|
|
|
sudo ln -s gutsy /usr/share/debootstrap/scripts/${DIST}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$FORCE_PBUILDER_CREATE" || ! -e "$BASETGZ" ]] ; then
|
|
|
|
echo Creating base system $BASETGZ
|
|
|
|
[ ! -e "/usr/share/debootstrap/scripts/${DIST}" ] && sudo ln -s gutsy /usr/share/debootstrap/scripts/${DIST}
|
|
|
|
sudo --preserve-env bash -x pbuilder create --configfile $CUR_DIR/debian/.pbuilderrc $PBUILDER_OPT
|
|
|
|
fi
|
2018-01-19 21:33:48 +00:00
|
|
|
|
2019-06-25 13:55:31 +00:00
|
|
|
if [ "$PBUILDER_AUTOUPDATE" -gt 0 ]; then
|
|
|
|
# Update every 3 days (60*24*3 minutes)
|
|
|
|
if [[ -n "$PBUILDER_UPDATE" ]] || test `find "$BASETGZ" -mmin +$PBUILDER_AUTOUPDATE` ; then
|
|
|
|
echo Updating base system $BASETGZ
|
|
|
|
sudo --preserve-env pbuilder update --configfile $CUR_DIR/debian/.pbuilderrc $PBUILDER_OPT
|
|
|
|
fi
|
2018-06-21 22:02:18 +00:00
|
|
|
fi
|
2019-06-25 13:55:31 +00:00
|
|
|
|
|
|
|
pdebuild --configfile $CUR_DIR/debian/.pbuilderrc -- $PBUILDER_OPT
|
2017-12-28 13:27:49 +00:00
|
|
|
fi
|
2019-06-25 13:55:31 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$MAKE_RPM" ]; then
|
|
|
|
make_rpm
|
|
|
|
fi
|
2018-01-19 21:33:48 +00:00
|
|
|
|
2019-06-25 13:55:31 +00:00
|
|
|
if [ -n "$MAKE_TGZ" ]; then
|
|
|
|
make_tgz
|
2017-12-28 13:27:49 +00:00
|
|
|
fi
|