forked from zqcde/impala-lzo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·49 lines (39 loc) · 1.53 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/bash
# (c) Copyright (2016) Cloudera, Inc.
set -euo pipefail
trap 'echo Error in $0 at line $LINENO: $(cd "'$PWD'" && awk "NR == $LINENO" $0)' ERR
# This script is used to build the impala-lzo bits. It assumes that the second
# argument is the path to a checkout folder of the Impala code.
if [ $# -lt 2 ]; then
echo "Usage $0 build_type impala_dir [toolchain_dir]"
exit 1
fi
export IMPALA_HOME=$2
export IMPALA_LZO_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
export IMPALA_TOOLCHAIN=${3:-${IMPALA_HOME}/toolchain}
cd "$IMPALA_LZO_HOME"
# Make sure we have the impala env variables.
pushd ${IMPALA_HOME}
source ./bin/impala-config.sh
popd
# Regenerate CMake files to use the Impala toolchain
# Delete CMakeCache.txt because it doesn't save much time and can cause compile errors
# when changing branches.
rm -rf CMakeCache.txt CMakeFiles
MAKE_CMD=${MAKE_CMD:-make}
CMAKE_FLAGS=" -DCMAKE_BUILD_TYPE=$1"
if [[ "$MAKE_CMD" = "ninja" ]]; then
CMAKE_FLAGS+=" -GNinja"
fi
if [[ "$(uname -p)" = "aarch64" && "$(uname -s)" = "Linux" ]]; then
cachelinesize=$(cat /sys/devices/system/cpu/cpu0/cache/index3/coherency_line_size)
if [[ $cachelinesize -gt 0 ]]; then
CACHELINESIZE_AARCH64=${CACHELINESIZE_AARCH64-$cachelinesize}
else
CACHELINESIZE_AARCH64=${CACHELINESIZE_AARCH64-64}
fi
echo "CACHELINESIZE_AARCH64_LZO:$CACHELINESIZE_AARCH64"
CMAKE_FLAGS+=" -DCACHELINESIZE_AARCH64=$CACHELINESIZE_AARCH64"
fi
cmake ${CMAKE_FLAGS} -DCMAKE_TOOLCHAIN_FILE=${IMPALA_HOME}/cmake_modules/toolchain.cmake
"${MAKE_CMD:-make}"