kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject [1/2] kudu git commit: thirdparty: use ninja when possible
Date Tue, 25 Jul 2017 17:22:26 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 27854fd49 -> be8e3c22b


thirdparty: use ninja when possible

Using ninja to build LLVM, etc, is a bit faster than using make, and
produces less ugly output.

Change-Id: Idacd6d8bc9ad371c3c925f7c628ad69785bb870e
Reviewed-on: http://gerrit.cloudera.org:8080/7461
Reviewed-by: Adar Dembo <adar@cloudera.com>
Reviewed-by: Dan Burkert <danburkert@apache.org>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/6d6c7ccb
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/6d6c7ccb
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/6d6c7ccb

Branch: refs/heads/master
Commit: 6d6c7ccb93c8acd23da308054e1ecc8da1210338
Parents: 27854fd
Author: Todd Lipcon <todd@apache.org>
Authored: Tue Jul 18 16:51:28 2017 -0700
Committer: Todd Lipcon <todd@apache.org>
Committed: Mon Jul 24 21:57:20 2017 +0000

----------------------------------------------------------------------
 thirdparty/build-definitions.sh | 25 +++++++++++++++++++------
 thirdparty/build-thirdparty.sh  |  9 +++++++++
 2 files changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/6d6c7ccb/thirdparty/build-definitions.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index 3b76691..c52bc25 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -27,6 +27,10 @@
 # * EXTRA_CXXFLAGS - additional flags to pass to the C++ compiler.
 # * EXTRA_LDFLAGS - additional flags to pass to the linker.
 # * EXTRA_LIBS - additional libraries to link.
+# * NINJA - if set, uses this instead of 'make' for cmake-configured libraries.
+#           note that 'EXTRA_CMAKE_FLAGS" should be set to include -GNinja as
+#           well to generate the proper build files.
+# * EXTRA_CMAKE_FLAGS - extra flags to pass to cmake
 #
 # build-definitions.sh is meant to be sourced from build-thirdparty.sh, and
 # relies on environment variables defined there and in vars.sh.
@@ -91,6 +95,8 @@ build_cmake() {
   $CMAKE_SOURCE/bootstrap \
     --prefix=$PREFIX \
     --parallel=$PARALLEL
+  # Unfortunately, cmake's bootstrap always uses Makefiles
+  # and can't be configured to build with ninja.
   make -j$PARALLEL $EXTRA_MAKEFLAGS install
   popd
 }
@@ -105,8 +111,9 @@ build_libcxxabi() {
     -DCMAKE_INSTALL_PREFIX=$PREFIX \
     -DCMAKE_CXX_FLAGS="$EXTRA_CXXFLAGS $EXTRA_LDFLAGS" \
     -DLLVM_PATH=$LLVM_SOURCE \
+    $EXTRA_CMAKE_FLAGS \
     $LLVM_SOURCE/projects/libcxxabi
-  make -j$PARALLEL $EXTRA_MAKEFLAGS install
+  ${NINJA:-make} -j$PARALLEL $EXTRA_MAKEFLAGS install
   popd
 }
 
@@ -134,8 +141,9 @@ build_libcxx() {
     -DLIBCXX_CXX_ABI=libcxxabi \
     -DLIBCXX_CXX_ABI_INCLUDE_PATHS=$LLVM_SOURCE/projects/libcxxabi/include \
     -DLLVM_USE_SANITIZER=$SANITIZER_TYPE \
+    $EXTRA_CMAKE_FLAGS \
     $LLVM_SOURCE/projects/libcxx
-  make -j$PARALLEL $EXTRA_MAKEFLAGS install
+  ${NINJA:-make} -j$PARALLEL $EXTRA_MAKEFLAGS install
   popd
 }
 
@@ -216,9 +224,10 @@ build_llvm() {
     -DCMAKE_CXX_FLAGS="$EXTRA_CXXFLAGS $EXTRA_LDFLAGS" \
     -DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
     $TOOLS_ARGS \
+    $EXTRA_CMAKE_FLAGS \
     $LLVM_SOURCE
 
-  make -j$PARALLEL $EXTRA_MAKEFLAGS install
+  ${NINJA:-make} -j$PARALLEL $EXTRA_MAKEFLAGS install
 
   if [[ "$BUILD_TYPE" == "normal" ]]; then
     # Create a link from Clang to thirdparty/clang-toolchain. This path is used
@@ -244,8 +253,9 @@ build_gflags() {
     -DBUILD_SHARED_LIBS=On \
     -DBUILD_STATIC_LIBS=On \
     -DREGISTER_INSTALL_PREFIX=Off \
+    $EXTRA_CMAKE_FLAGS \
     $GFLAGS_SOURCE
-  make -j$PARALLEL $EXTRA_MAKEFLAGS install
+  ${NINJA:-make} -j$PARALLEL $EXTRA_MAKEFLAGS install
   popd
 }
 
@@ -327,8 +337,9 @@ build_gmock() {
       -DCMAKE_BUILD_TYPE=Debug \
       -DCMAKE_POSITION_INDEPENDENT_CODE=On \
       -DBUILD_SHARED_LIBS=$SHARED \
+      $EXTRA_CMAKE_FLAGS \
       $GMOCK_SOURCE/googlemock
-    make -j$PARALLEL $EXTRA_MAKEFLAGS
+    ${NINJA:-make} -j$PARALLEL $EXTRA_MAKEFLAGS
     popd
   done
 
@@ -402,13 +413,15 @@ build_lz4() {
   LZ4_BDIR=$TP_BUILD_DIR/$LZ4_NAME$MODE_SUFFIX
   mkdir -p $LZ4_BDIR
   pushd $LZ4_BDIR
+  rm -Rf CMakeCache.txt CMakeFiles/
   CFLAGS="$EXTRA_CFLAGS" \
     cmake \
     -DCMAKE_BUILD_TYPE=release \
     -DBUILD_TOOLS=0 \
     -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX \
+    $EXTRA_CMAKE_FLAGS \
     $LZ4_SOURCE/cmake_unofficial
-  make -j$PARALLEL $EXTRA_MAKEFLAGS install
+  ${NINJA:-make} -j$PARALLEL $EXTRA_MAKEFLAGS install
   popd
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/6d6c7ccb/thirdparty/build-thirdparty.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index 668aae6..cf56ec0 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -191,6 +191,15 @@ else
   exit 1
 fi
 
+### Detect and enable 'ninja' instead of 'make' for faster builds.
+if which ninja-build > /dev/null ; then
+  NINJA=ninja-build
+  EXTRA_CMAKE_FLAGS=-GNinja
+elif which ninja > /dev/null ; then
+  NINJA=ninja
+  EXTRA_CMAKE_FLAGS=-GNinja
+fi
+
 ### Build common tools and header-only libraries
 
 PREFIX=$PREFIX_COMMON


Mime
View raw message