build: allow non-default clang binaries

this fixes release build with versioned clang from Debian
This commit is contained in:
Marek Vavruša 2017-05-22 14:05:54 -07:00
parent 0c416be381
commit 701ce6ab98
4 changed files with 7 additions and 7 deletions

View File

@ -22,7 +22,7 @@ PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:$PATH"
# Опция -mcx16 для того, чтобы выбиралось больше заголовочных файлов (с запасом).
for src_file in $(clang -M -xc++ -std=gnu++1y -Wall -Werror -msse4 -mcx16 -mpopcnt -O3 -g -fPIC \
for src_file in $($CLANG -M -xc++ -std=gnu++1y -Wall -Werror -msse4 -mcx16 -mpopcnt -O3 -g -fPIC \
$(cat "$SOURCE_PATH/build/include_directories.txt") \
"$SOURCE_PATH/dbms/src/Interpreters/SpecializedAggregator.h" |
tr -d '\\' |
@ -37,7 +37,7 @@ done
# Копируем больше заголовочных файлов с интринсиками, так как на серверах, куда будут устанавливаться
# заголовочные файлы, будет использоваться опция -march=native.
for i in $(ls -1 $(clang -v -xc++ - <<<'' 2>&1 | grep '^ /' | grep 'include' | grep '/lib/clang/')/*.h | grep -vE 'arm|altivec|Intrin');
for i in $(ls -1 $($CLANG -v -xc++ - <<<'' 2>&1 | grep '^ /' | grep 'include' | grep '/lib/clang/')/*.h | grep -vE 'arm|altivec|Intrin');
do
cp "$i" "$DST/$i";
done

View File

@ -5,7 +5,6 @@
DST=${1:-.};
PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:$PATH"
CLANG=$(command -v clang)
LD=$(command -v gold || command -v ld.gold || command -v ld)
if [ ! -x "$CLANG" ]; then
@ -21,6 +20,6 @@ fi
cp "$CLANG" $DST
cp "$LD" ${DST}/ld
STDCPP=$(ldd $(command -v clang) | grep -oE '/[^ ]+libstdc++[^ ]+')
STDCPP=$(ldd $CLANG | grep -oE '/[^ ]+libstdc++[^ ]+')
[ -f "$STDCPP" ] && cp "$STDCPP" $DST

5
debian/rules vendored
View File

@ -21,6 +21,7 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_CC ?= gcc-6
DEB_CXX ?= g++-6
DEB_CLANG ?= $(shell command -v clang)
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
@ -74,8 +75,8 @@ 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
debian/copy_clang_binaries.sh $(DESTDIR)/usr/share/clickhouse/bin/
./copy_headers.sh . $(DESTDIR)/usr/share/clickhouse/headers
CLANG=$(DEB_CLANG) debian/copy_clang_binaries.sh $(DESTDIR)/usr/share/clickhouse/bin/
CLANG=$(DEB_CLANG) ./copy_headers.sh . $(DESTDIR)/usr/share/clickhouse/headers
# fake metrika files when private dir is empty

View File

@ -66,4 +66,4 @@ echo -e "\nCurrent revision is $REVISION"
gen_changelog "$REVISION" "$CHDATE" "$AUTHOR" "$CHLOG"
# 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 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 -e DEB_CXX -e DEB_CLANG -e CMAKE_FLAGS_ADD="$CMAKE_FLAGS_ADD" -b ${DEBUILD_NOSIGN_OPTIONS} ${DEBUILD_NODEPS_OPTIONS}