#!/bin/bash # Copyright (c) Huawei Technologies Co., Ltd. 2020-2025. All rights reserved. # descript: Compile opengauss # It is just a wrapper to package_internal.sh # Example: ./build_opengauss.sh -3rd path/third_party_binarylibs/ # change it to "N", if you want to build with original build system based on solely Makefiles declare CMAKE_PKG="N" declare SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd) declare ROOT_DIR=$(dirname "${SCRIPT_DIR}") declare ROOT_DIR=$(dirname "${ROOT_DIR}") declare package_type='server' declare product_mode='opengauss' declare version_mode='release' declare binarylib_dir='None' declare make_check='off' declare separate_symbol='on' function print_help() { echo "Usage: $0 [OPTION] -h|--help show help information. -V|--version show version information. -3rd|--binarylib_dir the directory of third party binarylibs. -pkg|--package provode type of installation packages, values parameter is server. -m|--version_mode this values of parameter is debug, release, memcheck, the default value is release. -pm product mode, values parameter is opengauss. -mc|--make_check this values of parameter is on or off, the default value is on. -s|--symbol_mode whether separate symbol in debug mode, the default value is on. -co|--cmake_opt more cmake options " } function print_version() { echo $(cat ${SCRIPT_DIR}/gaussdb.ver | grep 'VERSION' | awk -F "=" '{print $2}') } if [ $# = 0 ] ; then echo "missing option" print_help exit 1 fi ######################################################################### ##read command line parameters ####################################################################### while [ $# -gt 0 ]; do case "$1" in -h|--help) print_help exit 1 ;; -V|--version) print_version exit 1 ;; -3rd|--binarylib_dir) if [ "$2"X = X ]; then echo "no given binarylib directory values" exit 1 fi binarylib_dir=$2 shift 2 ;; -pkg) if [ "$2"X = X ]; then echo "no given package type name" exit 1 fi package_type=$2 shift 2 ;; -m|--version_mode) if [ "$2"X = X ]; then echo "no given version number values" exit 1 fi version_mode=$2 shift 2 ;; -pm) if [ "$2"X = X ]; then echo "no given product mode" exit 1 fi product_mode=$2 shift 2 ;; -mc|--make_check) if [ "$2"X = X ]; then echo "no given make check values" exit 1 fi make_check=$2 shift 2 ;; -s|--symbol_mode) if [ "$2"X = X ]; then echo "no given symbol parameter" exit 1 fi separate_symbol=$2 shift 2 ;; --cmake_opt) if [ "$2"X = X ]; then echo "no extra configure options provided" exit 1 fi extra_cmake_opt=$2 shift 2 ;; --config_opt) if [ "$2"X = X ]; then echo "no extra configure options provided" exit 1 fi extra_config_opt=$2 shift 2 ;; *) echo "Internal Error: option processing error: $1" 1>&2 echo "please input right paramtenter, the following command may help you" echo "${0} --help or ${0} -h" exit 1 esac done if [ -e "$SCRIPT_DIR/utils/common.sh" ];then source $SCRIPT_DIR/utils/common.sh ${product_mode} else exit 1 fi #(1) invoke package_internal.sh if [ "$CMAKE_PKG" == "N" ]; then declare BUILD_DIR="${ROOT_DIR}/mppdb_temp_install" source $SCRIPT_DIR/utils/make_compile.sh || exit 1 else echo "begin config cmake options:" >> "$LOG_FILE" 2>&1 declare BUILD_DIR="${ROOT_DIR}/mppdb_temp_install" declare CMAKE_BUILD_DIR=${ROOT_DIR}/tmp_build if [ "$product_mode"x == "lite"x ]; then declare CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_LITE_MODE=ON ${extra_cmake_opt}" elif [ "$product_mode"x == "finance"x ]; then export ENABLE_FINANCE_MODE=ON declare CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_FINANCE_MODE=ON ${extra_cmake_opt}" else declare CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_MOT=ON ${extra_cmake_opt}" fi echo "[cmake options] cmake options is:${CMAKE_OPT}" >> "$LOG_FILE" 2>&1 source $SCRIPT_DIR/utils/cmake_compile.sh || exit 1 fi function main() { echo "[makegaussdb] $(date +%y-%m-%d' '%T): script dir : ${SCRIPT_DIR}" echo "[makegaussdb] $(date +%y-%m-%d' '%T): Work root dir : ${ROOT_DIR}" read_gaussdb_version read_gaussdb_number gaussdb_pkg_pre_clean gaussdb_build } main echo "now, all build has finished!" exit 0