mirror of
https://github.com/apache/impala.git
synced 2026-01-04 09:00:56 -05:00
Ninja resolves dependencies much faster, so if only a couple of files
are changed "ninja -j ${IMPALA_BUILD_THREADS} impalad" returns within a
second or two, while make can take tens of seconds to resolve all the
dependencies.
This requires ninja to be installed. It is widely available, e.g. in the
ninja-build package on Ubuntu.
Ninja can be enabled by passing "-ninja" to buildall.sh or
make_impala.sh. The same targets should work as with make.
The default Ninja status output is fairly terse. It can be customised
with an environment variable. E.g. I have
export NINJA_STATUS="[%u to run/%r running/%f finished] "
Also fixes a bug in make_impala.sh where invalid arguments were ignored.
Change-Id: I2cea479615fe850c98d30110de043ecb6358dcda
Reviewed-on: http://gerrit.cloudera.org:8080/2923
Tested-by: Internal Jenkins
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
150 lines
4.2 KiB
Bash
Executable File
150 lines
4.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright 2012 Cloudera Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Incrementally compiles the BE.
|
|
|
|
set -euo pipefail
|
|
trap 'echo Error in $0 at line $LINENO: $(cd "'$PWD'" && awk "NR == $LINENO" $0)' ERR
|
|
|
|
: ${IMPALA_TOOLCHAIN=}
|
|
|
|
BUILD_TESTS=1
|
|
CLEAN=0
|
|
TARGET_BUILD_TYPE=${TARGET_BUILD_TYPE:-""}
|
|
BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-""}
|
|
CMAKE_ONLY=0
|
|
MAKE_CMD=make
|
|
|
|
# parse command line options
|
|
for ARG in $*
|
|
do
|
|
case "$ARG" in
|
|
-notests)
|
|
BUILD_TESTS=0
|
|
;;
|
|
-clean)
|
|
CLEAN=1
|
|
;;
|
|
-build_type=*)
|
|
TARGET_BUILD_TYPE="${ARG#*=}"
|
|
;;
|
|
-build_shared_libs)
|
|
BUILD_SHARED_LIBS="ON"
|
|
;;
|
|
-build_static_libs)
|
|
BUILD_SHARED_LIBS="OFF"
|
|
;;
|
|
-ninja)
|
|
MAKE_CMD=ninja
|
|
;;
|
|
-cmake_only)
|
|
CMAKE_ONLY=1
|
|
;;
|
|
-help|*)
|
|
echo "make_impala.sh [-build_type=<build type> -notests -clean]"
|
|
echo "[-build_type] : Target build type. Examples: Debug, Release, Address_sanitizer."
|
|
echo " If omitted, the last build target is built incrementally"
|
|
echo "[-build_shared_libs] : Link all executables dynamically"
|
|
echo "[-build_static_libs] : Link all executables statically (the default)"
|
|
echo "[-cmake_only] : Generate makefiles and exit"
|
|
echo "[-ninja] : Use the Ninja build tool instead of Make"
|
|
echo "[-notests] : Omits building the tests."
|
|
echo "[-clean] : Cleans previous build artifacts."
|
|
echo ""
|
|
echo "If either -build_type or -build_*_libs is set, cmake will be re-run for the "
|
|
echo "project. Otherwise the last cmake configuration will continue to take effect."
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
echo "********************************************************************************"
|
|
echo " Building Impala "
|
|
if [ "x${TARGET_BUILD_TYPE}" != "x" ];
|
|
then
|
|
echo " Build type: ${TARGET_BUILD_TYPE} "
|
|
if [ "x${BUILD_SHARED_LIBS}" == "x" ]
|
|
then
|
|
echo " Impala libraries will be STATICALLY linked"
|
|
fi
|
|
fi
|
|
if [ "x${BUILD_SHARED_LIBS}" == "xOFF" ]
|
|
then
|
|
echo " Impala libraries will be STATICALLY linked"
|
|
fi
|
|
if [ "x${BUILD_SHARED_LIBS}" == "xON" ]
|
|
then
|
|
echo " Impala libraries will be DYNAMICALLY linked"
|
|
fi
|
|
echo "********************************************************************************"
|
|
|
|
cd ${IMPALA_HOME}
|
|
|
|
if [ "x${TARGET_BUILD_TYPE}" != "x" ] || [ "x${BUILD_SHARED_LIBS}" != "x" ] || \
|
|
[ "${MAKE_CMD}" != "make" ]
|
|
then
|
|
rm -f ./CMakeCache.txt
|
|
CMAKE_ARGS=()
|
|
if [ "x${TARGET_BUILD_TYPE}" != "x" ]; then
|
|
CMAKE_ARGS+=(-DCMAKE_BUILD_TYPE=${TARGET_BUILD_TYPE})
|
|
fi
|
|
|
|
if [ "x${BUILD_SHARED_LIBS}" != "x" ]; then
|
|
CMAKE_ARGS+=(-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS})
|
|
fi
|
|
|
|
if [ "${MAKE_CMD}" = "ninja" ]; then
|
|
CMAKE_ARGS+=" -GNinja"
|
|
fi
|
|
|
|
if [[ ! -z $IMPALA_TOOLCHAIN ]]; then
|
|
|
|
if [[ "$TARGET_BUILD_TYPE" == "ADDRESS_SANITIZER" ]]; then
|
|
CMAKE_ARGS+=(-DCMAKE_TOOLCHAIN_FILE=$IMPALA_HOME/cmake_modules/asan_toolchain.cmake)
|
|
else
|
|
CMAKE_ARGS+=(-DCMAKE_TOOLCHAIN_FILE=$IMPALA_HOME/cmake_modules/toolchain.cmake)
|
|
fi
|
|
fi
|
|
|
|
cmake . ${CMAKE_ARGS[@]}
|
|
fi
|
|
|
|
if [ $CLEAN -eq 1 ]
|
|
then
|
|
${MAKE_CMD} clean
|
|
fi
|
|
|
|
$IMPALA_HOME/bin/gen_build_version.py --noclean
|
|
|
|
if [ $CMAKE_ONLY -eq 1 ]; then
|
|
exit 0
|
|
fi
|
|
|
|
${MAKE_CMD} function-registry
|
|
|
|
# With parallelism, make doesn't always make statestored and catalogd correctly if you
|
|
# write make -jX impalad statestored catalogd. So we keep them separate and after impalad,
|
|
# which they link to.
|
|
${MAKE_CMD} -j${IMPALA_BUILD_THREADS:-4} impalad
|
|
|
|
${MAKE_CMD} statestored
|
|
${MAKE_CMD} catalogd
|
|
if [ $BUILD_TESTS -eq 1 ]
|
|
then
|
|
${MAKE_CMD} -j${IMPALA_BUILD_THREADS:-4}
|
|
else
|
|
${MAKE_CMD} -j${IMPALA_BUILD_THREADS:-4} fesupport loggingsupport ImpalaUdf
|
|
fi
|