mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 17:44:23 +00:00
129 lines
4.4 KiB
Bash
Executable File
129 lines
4.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Advanced usage:
|
|
# 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:
|
|
# 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
|
|
# Clang7 build:
|
|
# 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
|
|
# 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
|
|
|
|
set -e
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
cd $CURDIR
|
|
|
|
source "./release_lib.sh"
|
|
|
|
DEB_CC=${DEB_CC:=gcc-7}
|
|
DEB_CXX=${DEB_CXX:=g++-7}
|
|
|
|
CONTROL=debian/control
|
|
DEBUILD_NOSIGN_OPTIONS="-us -uc"
|
|
DEBUILD_NODEPS_OPTIONS="-d"
|
|
USE_PBUILDER=1
|
|
|
|
if [ -z "$REVISION" ] ; then
|
|
get_revision_author
|
|
fi
|
|
|
|
while [[ $1 == --* ]]
|
|
do
|
|
if [[ $1 == '--test' ]]; then
|
|
TEST='yes'
|
|
VERSION_POSTFIX+=+test
|
|
shift
|
|
elif [[ $1 == '--check-build-dependencies' ]]; then
|
|
DEBUILD_NODEPS_OPTIONS=""
|
|
shift
|
|
elif [[ $1 == '--version' ]]; then
|
|
gen_revision_author
|
|
git push
|
|
exit 0
|
|
elif [[ $1 == '--head' ]]; then
|
|
REVISION=`git rev-parse HEAD`
|
|
shift
|
|
elif [[ $1 == '--pbuilder' ]]; then
|
|
# Default
|
|
shift
|
|
elif [[ $1 == '--no-pbuilder' ]]; then
|
|
USE_PBUILDER=
|
|
shift
|
|
elif [[ $1 == '--fast' ]]; then
|
|
# Wrong but fast pbuilder mode: create base package with all depends
|
|
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"
|
|
shift
|
|
else
|
|
echo "Unknown option $1"
|
|
exit 2
|
|
fi
|
|
done
|
|
|
|
|
|
# Build options
|
|
if [ -n "$SANITIZER" ]
|
|
then
|
|
CMAKE_BUILD_TYPE=$SANITIZER
|
|
VERSION_POSTFIX+=+${SANITIZER,,}
|
|
# todo: нужно ли отключить libtcmalloc?
|
|
LIBTCMALLOC_OPTS="-DENABLE_TCMALLOC=0"
|
|
# GLIBC_COMPATIBILITY отключен по умолчанию
|
|
export DEB_CC=${DEB_CC=clang-5.0}
|
|
export DEB_CXX=${DEB_CXX=clang++-5.0}
|
|
EXTRAPACKAGES="$EXTRAPACKAGES clang-5.0 lld-5.0"
|
|
elif [[ $BUILD_TYPE == 'valgrind' ]]; then
|
|
LIBTCMALLOC_OPTS="-DENABLE_TCMALLOC=0"
|
|
VERSION_POSTFIX+=+$BUILD_TYPE
|
|
elif [[ $BUILD_TYPE == 'debug' ]]; then
|
|
CMAKE_BUILD_TYPE=Debug
|
|
LIBTCMALLOC_OPTS="-DDEBUG_TCMALLOC=1"
|
|
VERSION_POSTFIX+=+$BUILD_TYPE
|
|
fi
|
|
|
|
CMAKE_FLAGS=" $LIBTCMALLOC_OPTS $CMAKE_FLAGS"
|
|
[[ -n "$CMAKE_BUILD_TYPE" ]] && CMAKE_FLAGS=" -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE $CMAKE_FLAGS"
|
|
[[ "$CMAKE_FLAGS" =~ "USE_INTERNAL_LLVM_LIBRARY" ]] || CMAKE_FLAGS=" -DUSE_INTERNAL_LLVM_LIBRARY=1 $CMAKE_FLAGS"
|
|
|
|
export CMAKE_FLAGS
|
|
export EXTRAPACKAGES
|
|
|
|
REVISION+=$VERSION_POSTFIX
|
|
echo -e "\nCurrent revision is $REVISION"
|
|
|
|
gen_changelog "$REVISION" "" "$AUTHOR" ""
|
|
|
|
if [ -z "$USE_PBUILDER" ] ; then
|
|
# Build (only binary packages).
|
|
debuild -e PATH -e SSH_AUTH_SOCK \
|
|
-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:=$CURDIR/..}
|
|
. $CURDIR/debian/.pbuilderrc
|
|
|
|
if [[ -z `which pbuilder` ]] ; then
|
|
sudo apt install -y pbuilder fakeroot debhelper debian-archive-keyring debian-keyring
|
|
fi
|
|
|
|
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 $CURDIR/debian/.pbuilderrc $PBUILDER_OPT
|
|
fi
|
|
|
|
# Update every 3 days (60*24*3 minutes)
|
|
if [[ -n "$PBUILDER_UPDATE" ]] || test `find "$BASETGZ" -mmin +4320` ; then
|
|
echo Updating base system $BASETGZ
|
|
sudo --preserve-env pbuilder update --configfile $CURDIR/debian/.pbuilderrc $PBUILDER_OPT
|
|
fi
|
|
|
|
pdebuild --configfile $CURDIR/debian/.pbuilderrc -- $PBUILDER_OPT
|
|
fi
|