You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ad...@apache.org on 2022/10/19 14:52:31 UTC

[doris] branch master updated: [enhancement](macOS) Refine the build scripts for macOS (#13473)

This is an automated email from the ASF dual-hosted git repository.

adonisling pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 410e36ef5b [enhancement](macOS) Refine the build scripts for macOS (#13473)
410e36ef5b is described below

commit 410e36ef5b66fcee715db3c123f344ed403a9b19
Author: Adonis Ling <ad...@gmail.com>
AuthorDate: Wed Oct 19 22:52:22 2022 +0800

    [enhancement](macOS) Refine the build scripts for macOS (#13473)
    
    Set the environment up before running the build scripts on macOS.
---
 be/src/geo/CMakeLists.txt      |  2 +-
 bin/start_be.sh                |  5 +++++
 bin/start_fe.sh                |  5 +++++
 env.sh                         | 38 ++++++++++++++++++++++++++++++++++++++
 thirdparty/build-thirdparty.sh | 16 ++++++++--------
 5 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/be/src/geo/CMakeLists.txt b/be/src/geo/CMakeLists.txt
index a05d634dd0..d802a2bedb 100644
--- a/be/src/geo/CMakeLists.txt
+++ b/be/src/geo/CMakeLists.txt
@@ -29,7 +29,7 @@ add_library(Geo STATIC
     ${GENSRC_DIR}/geo/wkt_lex.l.cpp
     ${GENSRC_DIR}/geo/wkt_yacc.y.cpp
 )
-if (COMPILER_GCC OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0")
+if (COMPILER_GCC OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0.0")
     target_compile_options(Geo PRIVATE -Wno-unused-but-set-variable)
 endif()
 
diff --git a/bin/start_be.sh b/bin/start_be.sh
index 85ceec261d..bc448ecdc6 100755
--- a/bin/start_be.sh
+++ b/bin/start_be.sh
@@ -20,6 +20,11 @@ set -eo pipefail
 
 curdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
 
+if [[ "$(uname -s)" == 'Darwin' ]] && command -v brew &>/dev/null; then
+    PATH="$(brew --repo)/opt/gnu-getopt/bin:${PATH}"
+    export PATH
+fi
+
 OPTS="$(getopt \
     -n "$0" \
     -o '' \
diff --git a/bin/start_fe.sh b/bin/start_fe.sh
index 8ef18af96d..d317aeae67 100755
--- a/bin/start_fe.sh
+++ b/bin/start_fe.sh
@@ -20,6 +20,11 @@ set -eo pipefail
 
 curdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
 
+if [[ "$(uname -s)" == 'Darwin' ]] && command -v brew &>/dev/null; then
+    PATH="$(brew --repo)/opt/gnu-getopt/bin:${PATH}"
+    export PATH
+fi
+
 OPTS="$(getopt \
     -n "$0" \
     -o '' \
diff --git a/env.sh b/env.sh
index 53d9ed92e8..a4edf2b896 100755
--- a/env.sh
+++ b/env.sh
@@ -33,6 +33,44 @@ if [[ -n "${OSTYPE}" ]]; then
     fi
 fi
 
+if [[ "$(uname -s)" == 'Darwin' ]]; then
+    if ! command -v brew &>/dev/null; then
+        echo "Error: Homebrew is missing. Please install it first due to we use Homebrew to manage the tools which are needed to build the project."
+        exit 1
+    fi
+    if [[ ! -f "${DORIS_HOME}/custom_env.sh" ]] ||
+        ! grep HOMEBREW_REPO_PREFIX "${DORIS_HOME}/custom_env.sh" &>/dev/null; then
+
+        cat >>"${DORIS_HOME}/custom_env.sh" <<EOF
+HOMEBREW_REPO_PREFIX="$(brew --repo)"
+CELLARS=(
+    automake
+    autoconf
+    libtool
+    pkg-config
+    coreutils
+    gnu-getopt
+    python
+    cmake
+    ninja
+    ccache
+    bison
+    byacc
+    gettext
+    wget
+    pcre
+    maven
+)
+for cellar in "\${CELLARS[@]}"; do
+    EXPORT_CELLARS="\${HOMEBREW_REPO_PREFIX}/opt/\${cellar}/bin:\${EXPORT_CELLARS}"
+done
+export PATH="\${EXPORT_CELLARS}:\${PATH}"
+
+export DORIS_BUILD_PYTHON_VERSION=python3
+EOF
+    fi
+fi
+
 # include custom environment variables
 if [[ -f "${DORIS_HOME}/custom_env.sh" ]]; then
     # shellcheck disable=1091
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index f4171dd54e..f846610409 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -36,6 +36,13 @@ curdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
 export DORIS_HOME="${curdir}/.."
 export TP_DIR="${curdir}"
 
+# include custom environment variables
+if [[ -f "${DORIS_HOME}/env.sh" ]]; then
+    export BUILD_THIRDPARTY_WIP=1
+    . "${DORIS_HOME}/env.sh"
+    export BUILD_THIRDPARTY_WIP=
+fi
+
 # Check args
 usage() {
     echo "
@@ -102,13 +109,6 @@ echo "Get params:
     PARALLEL            -- ${PARALLEL}
 "
 
-# include custom environment variables
-if [[ -f "${DORIS_HOME}/env.sh" ]]; then
-    export BUILD_THIRDPARTY_WIP=1
-    . "${DORIS_HOME}/env.sh"
-    export BUILD_THIRDPARTY_WIP=
-fi
-
 if [[ ! -f "${TP_DIR}/download-thirdparty.sh" ]]; then
     echo "Download thirdparty script is missing".
     exit 1
@@ -147,7 +147,7 @@ elif [[ "${CC}" == *clang ]]; then
     boost_toolset='clang'
     libhdfs_cxx17='-std=c++1z'
     clang_version="$("${CC}" -dumpversion)"
-    if [[ "${clang_version}" < '15.0.0' ]]; then
+    if [[ "${clang_version}" < '14.0.0' ]]; then
         warning_unused_but_set_variable=''
     fi
 fi


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org