ClickHouse/debian/copy_clang_binaries.sh
2017-05-24 15:32:51 +03:00

30 lines
902 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash -e
# Копирует бинарник clang а также ld и shared-библиотеку libstdc++ в указанную директорию.
# Так повезло, что этого достаточно, чтобы затем собирать код на удалённом сервере с совпадающей версией Ubuntu, но без установленного компилятора.
DST=${1:-.};
PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:$PATH"
LD=$(command -v gold || command -v ld.gold || command -v ld)
if [ -z "$CLANG" ]; then
CLANG=$(which clang)
fi
if [ ! -x "$CLANG" ]; then
echo "Not found executable clang."
exit 1
fi
if [ ! -x "$LD" ]; then
echo "Not found executable gold or ld."
exit 1
fi
cp "$CLANG" $DST
cp "$LD" ${DST}/ld
STDCPP=$(ldd $CLANG | grep -oE '/[^ ]+libstdc++[^ ]+')
[ -f "$STDCPP" ] && cp "$STDCPP" $DST