2018-05-13 23:12:30 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e -x
|
|
|
|
|
|
|
|
if [[ -z "$INITIALIZED" ]]; then
|
|
|
|
|
|
|
|
INITIALIZED=1
|
|
|
|
|
|
|
|
SCRIPTPATH=$(pwd)
|
|
|
|
WORKSPACE=${SCRIPTPATH}/workspace
|
|
|
|
PROJECT_ROOT=$(cd $SCRIPTPATH/.. && pwd)
|
|
|
|
|
2018-05-14 18:49:51 +00:00
|
|
|
# Almost all scripts take no arguments. Arguments should be in config.
|
2018-05-13 23:12:30 +00:00
|
|
|
|
|
|
|
# get-sources
|
|
|
|
SOURCES_METHOD=local # clone, local, tarball
|
2019-09-23 16:18:19 +00:00
|
|
|
SOURCES_CLONE_URL="https://github.com/ClickHouse/ClickHouse.git"
|
2018-05-13 23:12:30 +00:00
|
|
|
SOURCES_BRANCH="master"
|
|
|
|
SOURCES_COMMIT=HEAD # do checkout of this commit after clone
|
|
|
|
|
|
|
|
# prepare-toolchain
|
|
|
|
COMPILER=gcc # gcc, clang
|
|
|
|
COMPILER_INSTALL_METHOD=packages # packages, sources
|
|
|
|
COMPILER_PACKAGE_VERSION=7 # or 6.0 for clang
|
|
|
|
|
|
|
|
# install-compiler-from-sources
|
|
|
|
CLANG_SOURCES_BRANCH=trunk # or tags/RELEASE_600/final
|
|
|
|
GCC_SOURCES_VERSION=latest # or gcc-7.1.0
|
|
|
|
|
|
|
|
# install-libraries
|
|
|
|
ENABLE_EMBEDDED_COMPILER=1
|
|
|
|
|
|
|
|
# build
|
|
|
|
BUILD_METHOD=normal # normal, debian
|
|
|
|
BUILD_TARGETS=clickhouse # tagtet name, all; only for "normal"
|
|
|
|
BUILD_TYPE=RelWithDebInfo # RelWithDebInfo, Debug, ASan, TSan
|
|
|
|
CMAKE_FLAGS=""
|
|
|
|
|
|
|
|
# prepare-docker-image-ubuntu
|
|
|
|
DOCKER_UBUNTU_VERSION=bionic
|
|
|
|
DOCKER_UBUNTU_ARCH=arm64 # How the architecture is named in a tarball at https://partner-images.canonical.com/core/
|
|
|
|
DOCKER_UBUNTU_QUEMU_ARCH=aarch64 # How the architecture is named in QEMU
|
|
|
|
DOCKER_UBUNTU_TAG_ARCH=arm64 # How the architecture is named in Docker
|
|
|
|
DOCKER_UBUNTU_QEMU_VER=v2.9.1
|
|
|
|
DOCKER_UBUNTU_REPO=multiarch/ubuntu-core
|
|
|
|
|
2018-05-14 19:03:19 +00:00
|
|
|
THREADS=$(grep -c ^processor /proc/cpuinfo || nproc || sysctl -a | grep -F 'hw.ncpu' | grep -oE '[0-9]+')
|
2018-05-13 23:12:30 +00:00
|
|
|
|
|
|
|
# All scripts should return 0 in case of success, 1 in case of permanent error,
|
|
|
|
# 2 in case of temporary error, any other code in case of permanent error.
|
|
|
|
function die {
|
|
|
|
echo ${1:-Error}
|
|
|
|
exit ${2:1}
|
|
|
|
}
|
|
|
|
|
|
|
|
[[ $EUID -ne 0 ]] && SUDO=sudo
|
|
|
|
|
2018-05-14 18:49:51 +00:00
|
|
|
./install-os-packages.sh prepare
|
2018-05-13 23:12:30 +00:00
|
|
|
|
2020-08-08 01:21:04 +00:00
|
|
|
# Configuration parameters may be overridden with CONFIG environment variable pointing to config file.
|
2018-05-13 23:12:30 +00:00
|
|
|
[[ -n "$CONFIG" ]] && source $CONFIG
|
|
|
|
|
|
|
|
mkdir -p $WORKSPACE
|
|
|
|
|
|
|
|
fi
|