From ad46d061a4a71d65ea147c5e3b86b2526e736fa9 Mon Sep 17 00:00:00 2001 From: proller Date: Wed, 30 Aug 2017 17:08:19 +0300 Subject: [PATCH] Improve debian building --- debian/.pbuilderrc | 38 ++++++++++++++++++++++++++++++-------- debian/control | 2 +- debian/rules | 31 +++++++++++++++++++------------ release | 7 +++++-- 4 files changed, 55 insertions(+), 23 deletions(-) diff --git a/debian/.pbuilderrc b/debian/.pbuilderrc index 70f3c33a1cb..92520d78791 100644 --- a/debian/.pbuilderrc +++ b/debian/.pbuilderrc @@ -1,11 +1,12 @@ # ubuntu: # sudo DIST=trusty pbuilder create --configfile debian/.pbuilderrc && DIST=trusty pdebuild --configfile debian/.pbuilderrc -# sudo DIST=xenial pbuilder create --configfile debian/.pbuilderrc && DIST=xenial pdebuild --configfile debian/.pbuilderrc +##sudo DIST=xenial pbuilder create --configfile debian/.pbuilderrc && DIST=xenial pdebuild --configfile debian/.pbuilderrc # sudo DIST=zesty pbuilder create --configfile debian/.pbuilderrc && DIST=zesty pdebuild --configfile debian/.pbuilderrc +# sudo DIST=artful pbuilder create --configfile debian/.pbuilderrc && DIST=artful pdebuild --configfile debian/.pbuilderrc # debian: # sudo DIST=experimental pbuilder create --configfile debian/.pbuilderrc && DIST=experimental pdebuild --configfile debian/.pbuilderrc # sudo DIST=testing pbuilder create --configfile debian/.pbuilderrc && DIST=testing pdebuild --configfile debian/.pbuilderrc -# sudo DIST=unstable pbuilder create --configfile debian/.pbuilderrc && DIST=unstable pdebuild --configfile debian/.pbuilderrc +##sudo DIST=unstable pbuilder create --configfile debian/.pbuilderrc && DIST=unstable pdebuild --configfile debian/.pbuilderrc # sudo DIST=stable pbuilder create --configfile debian/.pbuilderrc && DIST=stable pdebuild --configfile debian/.pbuilderrc # TODO: # sudo DIST=zesty ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=zesty ARCH=i386 pdebuild --configfile debian/.pbuilderrc @@ -25,14 +26,14 @@ DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $STABLE_BAC "experimental" "unstable" "testing" "stable") # List of Ubuntu suites. Update these when needed. -UBUNTU_SUITES=("zesty" "xenial" "trusty") +UBUNTU_SUITES=("artful" "zesty" "xenial" "trusty") # Mirrors to use. Update these to your preferred mirror. -#DEBIAN_MIRROR="deb.debian.org" +DEBIAN_MIRROR="deb.debian.org" #UBUNTU_MIRROR="mirrors.kernel.org" UBUNTU_MIRROR="mirror.yandex.ru" -DEBIAN_MIRROR="mirror.yandex.ru" +#DEBIAN_MIRROR="mirror.yandex.ru" # Optionally use the changelog of a package to determine the suite to use if # none set. @@ -89,9 +90,15 @@ elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then OSNAME=ubuntu MIRRORSITE="http://$UBUNTU_MIRROR/$OSNAME/" COMPONENTS="main restricted universe multiverse" - OTHERMIRROR+="deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/$OSNAME $DIST main" + + case "$DIST" in + "trusty" | "xenial" ) + OTHERMIRROR+="deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/$OSNAME $DIST main" + ALLOWUNTRUSTED=yes + ;; + esac + # deb http://apt.llvm.org/zesty/ llvm-toolchain-zesty-5.0 main - ALLOWUNTRUSTED=yes else echo "Unknown distribution: $DIST" exit 1 @@ -99,7 +106,22 @@ fi echo "using $NAME $OSNAME $DIST $ARCH $LOGNAME" -CCACHEDIR=/var/cache/pbuilder/ccache +case "$DIST" in + "trusty") + # ccache broken + ;; + *) + CCACHEDIR=/var/cache/pbuilder/ccache + ;; +esac + +case "$DIST" in + "trusty" | "artful" | "experimental" | "unstable" ) + export DEB_CC=gcc-7 + export DEB_CXX=g++-7 + ;; +esac + export CCACHE_PREFIX= export DEB_BUILD_OPTIONS=parallel=`nproc` diff --git a/debian/control b/debian/control index 2132f64a025..6eb44d4bda4 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Priority: optional Maintainer: Alexey Milovidov Build-Depends: debhelper (>= 9), cmake, - gcc-6, g++-6, + gcc-7 | gcc-6, g++-7 | g++-6, libmariadbclient-dev | default-libmysqlclient-dev | libmysqlclient-dev, libicu-dev, libltdl-dev, diff --git a/debian/rules b/debian/rules index ae7875f6b83..c74140a2c51 100755 --- a/debian/rules +++ b/debian/rules @@ -19,22 +19,28 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) #endif #DEB_BUILD_OPTIONS+=parallel=$(THREADS_COUNT) -DEB_CC ?= gcc-6 -DEB_CXX ?= g++-6 -DEB_CLANG ?= $(shell which clang-6.0 || which clang-5.0 || which clang-4.0 || which clang || which clang-3.9 || which clang-3.8) -# CMAKE_FLAGS_ADD += -DINTERNAL_COMPILER_EXECUTABLE=$(basename $(DEB_CLANG)) # TODO: this is actual only if you will also change clang name in copy_clang_binaries.sh +CMAKE_FLAGS += -DENABLE_TESTS=0 -DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_CLANG ?= $(shell which clang-6.0 || which clang-5.0 || which clang-4.0 || which clang || which clang-3.9 || which clang-3.8) +# CMAKE_FLAGS += -DINTERNAL_COMPILER_EXECUTABLE=$(basename $(DEB_CLANG)) # TODO: this is actual only if you will also change clang name in copy_clang_binaries.sh + +#DEB_CC ?= gcc-6 +#DEB_CXX ?= g++-6 + +ifdef DEB_CXX + DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) -CC := $(DEB_CC) -CXX := $(DEB_CXX) + CC := $(DEB_CC) + CXX := $(DEB_CXX) else -CC := $(DEB_HOST_GNU_TYPE)-$(DEB_CC) -CXX := $(DEB_HOST_GNU_TYPE)-$(DEB_CXX) + CC := $(DEB_HOST_GNU_TYPE)-$(DEB_CC) + CXX := $(DEB_HOST_GNU_TYPE)-$(DEB_CXX) +endif endif -CMAKE_FLAGS ?= -DCMAKE_CXX_COMPILER=`which $(CXX)` -DCMAKE_C_COMPILER=`which $(CC)` -DENABLE_TESTS=0 $(CMAKE_FLAGS_ADD) +CMAKE_FLAGS += -DCMAKE_CXX_COMPILER=`which $(CXX)` -DCMAKE_C_COMPILER=`which $(CC)` + ifndef DH_VERBOSE CMAKE_FLAGS += -DCMAKE_VERBOSE_MAKEFILE=0 endif @@ -76,9 +82,10 @@ override_dh_install: # In case building clickhouse-server, adding to package binary of clang, ld and header files - for dynamic compilation. mkdir -p $(DESTDIR)/usr/share/clickhouse/bin $(DESTDIR)/usr/share/clickhouse/headers +ifeq ($(USE_INTERNAL_COMPILER),1) CLANG=$(DEB_CLANG) debian/copy_clang_binaries.sh $(DESTDIR)/usr/share/clickhouse/bin/ CLANG=$(DEB_CLANG) ./copy_headers.sh . $(DESTDIR)/usr/share/clickhouse/headers - +endif # fake metrika files when private dir is empty mkdir -p debian/tmp/etc/clickhouse-server/metrika diff --git a/release b/release index 9e9d200499f..255f973eb91 100755 --- a/release +++ b/release @@ -7,6 +7,9 @@ cd $CURDIR source "./release_lib.sh" +DEB_CC=gcc-6 +DEB_CXX=g++-6 + CONTROL=debian/control DEBUILD_NOSIGN_OPTIONS="-us -uc" @@ -58,7 +61,7 @@ if [ -z "$THREAD_COUNT" ] ; then THREAD_COUNT=`nproc || grep -c ^processor /proc/cpuinfo` fi -CMAKE_FLAGS_ADD+=" $LIBTCMALLOC_OPTS -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE" +CMAKE_FLAGS+=" $LIBTCMALLOC_OPTS -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE" REVISION+=$VERSION_POSTFIX echo -e "\nCurrent revision is $REVISION" @@ -66,4 +69,4 @@ echo -e "\nCurrent revision is $REVISION" gen_changelog "$REVISION" "" "$AUTHOR" "" # Build (only binary packages). -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} +debuild -e PATH -e SSH_AUTH_SOCK -e DEB_BUILD_OPTIONS=parallel=$THREAD_COUNT -e DEB_CC=$DEB_CC -e DEB_CXX=$DEB_CXX -e USE_INTERNAL_COMPILER=1 -e CMAKE_FLAGS="$CMAKE_FLAGS" -b ${DEBUILD_NOSIGN_OPTIONS} ${DEBUILD_NODEPS_OPTIONS}