You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/05/25 17:56:41 UTC

mesos git commit: Added support for CMake build in docker_build.sh.

Repository: mesos
Updated Branches:
  refs/heads/master 13d10ac85 -> 42e5126f5


Added support for CMake build in docker_build.sh.

Review: https://reviews.apache.org/r/45668/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/42e5126f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/42e5126f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/42e5126f

Branch: refs/heads/master
Commit: 42e5126f5c81516c8525961d50f2c684705adb49
Parents: 13d10ac
Author: Juan Larriba <jl...@gmail.com>
Authored: Wed May 25 10:56:19 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Wed May 25 10:56:19 2016 -0700

----------------------------------------------------------------------
 support/docker_build.sh | 39 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/42e5126f/support/docker_build.sh
----------------------------------------------------------------------
diff --git a/support/docker_build.sh b/support/docker_build.sh
index 28ef4dc..058b982 100755
--- a/support/docker_build.sh
+++ b/support/docker_build.sh
@@ -7,6 +7,7 @@ set -xe
 
 # Require the following environment variables to be set.
 : ${OS:?"Environment variable 'OS' must be set (e.g., OS=ubuntu14.04)"}
+: ${BUILDTOOL:?"Environment variable 'BUILDTOOL' must be set (e.g., BUILDTOOL=autotools)"}
 : ${COMPILER:?"Environment variable 'COMPILER' must be set (e.g., COMPILER=gcc)"}
 : ${CONFIGURATION:?"Environment variable 'CONFIGURATION' must be set (e.g., CONFIGURATION='--enable-libevent --enable-ssl')"}
 : ${ENVIRONMENT:?"Environment variable 'ENVIRONMENT' must be set (e.g., ENVIRONMENT='GLOG_v=1 MESOS_VERBOSE=1')"}
@@ -41,7 +42,7 @@ case $OS in
     append_dockerfile "RUN yum install -y which"
     append_dockerfile "RUN yum groupinstall -y 'Development Tools'"
     append_dockerfile "RUN yum install -y epel-release" # Needed for clang.
-    append_dockerfile "RUN yum install -y clang git maven"
+    append_dockerfile "RUN yum install -y clang git maven cmake"
     append_dockerfile "RUN yum install -y java-1.8.0-openjdk-devel python-devel zlib-devel libcurl-devel openssl-devel cyrus-sasl-devel cyrus-sasl-md5 apr-devel subversion-devel apr-utils-devel libevent-devel libev-devel"
 
     # Add an unprivileged user.
@@ -61,7 +62,7 @@ case $OS in
     # IBM Power only supports Ubuntu 14.04 and gcc compiler.
     [ "$(uname -m)" = "x86_64" ] && CLANG_PKG=clang || CLANG_PKG=
     append_dockerfile "RUN apt-get update"
-    append_dockerfile "RUN apt-get -y install build-essential $CLANG_PKG git maven autoconf libtool"
+    append_dockerfile "RUN apt-get -y install build-essential $CLANG_PKG git maven autoconf libtool cmake"
     append_dockerfile "RUN apt-get -y install openjdk-7-jdk python-dev libcurl4-nss-dev libsasl2-dev libapr1-dev libsvn-dev libevent-dev libev-dev"
 
     # Add an unpriviliged user.
@@ -116,7 +117,39 @@ append_dockerfile "ENV DISTCHECK_CONFIGURE_FLAGS $CONFIGURATION"
 append_dockerfile "ENV $ENVIRONMENT"
 
 # Build and check Mesos.
-append_dockerfile "CMD ./bootstrap && ./configure $CONFIGURATION && make -j8 distcheck"
+case $BUILDTOOL in
+  autotools)
+    append_dockerfile "CMD ./bootstrap && ./configure $CONFIGURATION && make -j8 distcheck"
+    ;;
+  cmake)
+    # Transform autotools-like parameters to cmake-like.
+    # Remove "'".
+    CONFIGURATION=${CONFIGURATION//\'/""}
+    # Replace "-" with "_".
+    CONFIGURATION=${CONFIGURATION//-/"_"}
+    # Replace "__" with "-D".
+    CONFIGURATION=${CONFIGURATION//__/"-D"}
+    # To Upper Case.
+    CONFIGURATION=${CONFIGURATION^^}
+
+    # Add "=1" suffix to each variable.
+    IFS=' ' read -r  -a array <<< "$CONFIGURATION"
+
+    CONFIGURATION=""
+    for element in "${array[@]}"
+    do
+        CONFIGURATION="$CONFIGURATION $element=1"
+    done
+
+    # distcheck is not currently supported by our CMake scripts.
+    # See MESOS-5433 for details.
+    append_dockerfile "CMD ./bootstrap && cmake $CONFIGURATION && make -j8 check"
+    ;;
+  *)
+    echo "Unknown build tool $BUILDTOOL"
+    exit 1
+    ;;
+esac
 
 # Generate a random image tag.
 TAG=mesos-`date +%s`-$RANDOM