theLink 10.0
|
Config/Build/Install the 'performance' executables.
usage: build.bash ?options...? ?setup...|ALL? action Config/Build/Install the 'performance' executables installation directory : NHI1_HOME/performance/inst/TARGET/SETUP/inst build directory : NHI1_BUILD/TARGET/SETUP setup(s) : perf-release perf-aggressive target(s) : x86_64-suse-linux-gnu The 'setup' is filtered out of the arguments. If NO 'setup' is found then ALL 'setups' are used. Any arguments NOT used as 'setup' are used as 'action' arguments. An invalid 'action' will raise an error. Example: configure + build + install the perf-release setup > ./build.bash pr c b i install (also build) all setups (update), clean install first > ./build.bash cli i Usage: options: -h|--help # print this message : help --edit # edit THIS file : debug -x # use debug trace : debug setup: ...................................................... perf-release|pr|r # perf-release setup : shared & threads & NORMAL optimization perf-aggressive|pa|a # perf-aggressive setup : static & NO threads & AGGRESSIVE optimization action: ..................................................... clb|clean-build # cleanup BUILD dir : rm -r NHI1_BUILD_DIR cli|clean-inst # cleanup INST dir : rm -f NHI1_INST_DIR config|c # configure : Nhi1Config build|b # build : Nhi1Make install|i # install : Nhi1Make install test|t # basic testing : ldd on binaries
#! /bin/bash #+ #: @file NHI1/performance/build.bash #: @brief tag: nhi1-release-250425 #: @copyright (C) NHI - #1 - Project - Group #: This software has NO permission to copy, #: please contact AUTHOR for additional information #: # usage: # > ./build.sh a c b i → setup=perf-aggressive action=config+build+install # find top-level directory Nhi1Env -silent || exit 1 set -ue set -o pipefail # if (( ${CALLED_MYSELF:-1} )); then # set -o pipefail # supported in bash, but not in all the shells # CALLED_MYSELF=0 "$0" "$@" 2>&1 | less -ES # exit # fi # shellcheck source=./libperf.bash source "$NHI1_HOME/performance/libperf.bash" usage() { if (( $# )) ; then echo "ERROR: $*"; echo; fi usage_default.tcl -stdin "$cmd0" "?setup...|ALL? action" <<EOF Config/Build/Install the 'performance' executables installation directory : NHI1_HOME/performance/$perfdir/TARGET/SETUP/inst build directory : NHI1_BUILD/TARGET/SETUP setup(s) : $(setupList) target(s) : $(targetList) The 'setup' is filtered out of the arguments. If NO 'setup' is found then ALL 'setups' are used. Any arguments NOT used as 'setup' are used as 'action' arguments. An invalid 'action' will raise an error. Example: configure + build + install the perf-release setup > ./build.bash pr c b i install (also build) all setups (update), clean install first > ./build.bash cli i Usage: EOF exit "1" } while (( $# )) ; do case "$1" in -h|--help) # print this message : help usage;; --edit) # edit THIS file : debug exec vim "$0";; -x) # use debug trace : debug debug_start;; *) break;; esac shift done myerror() { error "[${setup:-setup}:${action:-action}] $*" } ## config/build/install function actionConfig # <perf-release|perf-aggressive> <config-arg>... { #optNoBegin mkdir -p "$build_root_dir/$setup" runConfig "$NHI1_HOME/bin/Nhi1Config" +i -s -p "$@" \ --enable-cache --with-backtrace \ --prefix="$inst_root_dir/$setup/inst" \ --libdir="$inst_root_dir/$setup/inst/$NHI1_lib" #optNoEnd } function actionBuild # <perf-release|perf-aggressive> <config-arg>... { runBuild Nhi1Make } function actionCleanBuild # <perf-release|perf-aggressive> <config-arg>... { if (( "${NHI1_silent:-0}" < 1 )) ; then pBlue "call ${FUNCNAME[0]}: " fi local setup_dir="$build_root_dir/$setup" rm -fr "$setup_dir" mkdir -p "$setup_dir" } function actionCleanInst # <perf-release|perf-aggressive> <config-arg>... { if (( "${NHI1_silent:-0}" < 1 )) ; then pBlue "call ${FUNCNAME[0]}: " fi local inst_dir="$inst_root_dir/$setup/inst" rm -fr "$inst_dir" mkdir -p "$inst_dir" } function actionInstall # <perf-release|perf-aggressive> <config-arg>... { runBuild Nhi1Make -noj install } function actionTest # <perf-release|perf-aggressive> <config-arg>... { if (( "${NHI1_silent:-0}" < 1 )) ; then pBlue "call ${FUNCNAME[0]}: $*" fi #export | grep NHI1_ local example="$inst_root_dir/$setup/inst/sbin" ( echo TOOLS set -e source "$inst_root_dir/$setup/inst/libexec/NHI1/$NHI1_target-env-inst.sh" NHI1_silent=1 runInst ldd "$example/c/$NHI1_target-perfclient" NHI1_silent=1 runInst ldd "$example/c/$NHI1_target-perfserver" NHI1_silent=1 runInst ldd "$example/cc/$NHI1_target-perfserver" echo echo RUNTIME # shellcheck disable=SC2016 test -n "$TCLSH" && NHI1_silent=1 runInst ldd $TCLSH # shellcheck disable=SC2016 test -n "$ATLSH" && NHI1_silent=1 runInst ldd $ATLSH # shellcheck disable=SC2016 test -n "$PYTHON" && NHI1_silent=1 runInst ldd $PYTHON # shellcheck disable=SC2016 test -n "$RUBY" && NHI1_silent=1 runInst ldd $RUBY # shellcheck disable=SC2016 test -n "$JAVA" && NHI1_silent=1 runInst ldd $JAVA # shellcheck disable=SC2016 test -n "$CLREXEC" && NHI1_silent=1 runInst ldd $CLREXEC echo echo LIBS while IFS= read -r -d '' fle; do [[ "$fle" == *RpcServer* ]] && continue NHI1_silent=1 runInst ldd "$fle" done < <(find "$inst_root_dir/$setup/inst" -name "*.so" -print0) echo echo INST-ENV NHI1_silent=1 runInst sh -c export | grep -Ev '(HOME|PWD|TERM|USER|LANG|STDBUF|SHLVL)' ) | sed -e " s#\[x86_64-suse-linux-gnu-run-inst.bash] ## s#$inst_root_dir#${Cgreen}INST_ROOT_TARGET${Creset}#g s#$NHI1_HOME#${Cmagenta}NHI1_HOME${Creset}#g s#$NHI1_BUILD/$NHI1_target/$NHI1_setup#${Cyellow}NHI1_BUILD_TARGET${Creset}#g s#$NHI1_EXT/$NHI1_target#${Cblue}NHI1_EXT_TARGET${Creset}#g s#\(ldd.*\)/\([^/]*\)\$#\1/${Corange}\2${Creset}# " if (( $? != 0 )) ; then exit 1 ; fi } #all=(--with-python --with-cxx --with-tcl --with-perl --with-ruby --with-php) all=(--with-python --with-cxx --with-tcl --with-atl --with-ruby --with-libsqlite3 --with-libconfig) all+=(--without-perl --without-php --without-go --disable-brain --disable-guard) if [ "$NHI1_bits" = "64" ] ; then extra=(--with-csharp --with-java --without-vb) else extra=() fi if (( $# < 1 )) ; then usage "missing REQUIRED argument" fi #include ./libperf.bash parse_args "$@" for setup in "${setupL[@]}" ; do pGreen "setup=$setup" { for action in "${argsL[@]}" ; do pYellow "action=$action" #txt #txt action: #optBegin case "$action" in clb|clean-build) # cleanup BUILD dir : rm -r NHI1_BUILD_DIR action="actionCleanBuild" ;; cli|clean-inst) # cleanup INST dir : rm -f NHI1_INST_DIR action="actionCleanInst" ;; config|c) # configure : Nhi1Config action="actionConfig" ;; build|b) # build : Nhi1Make action="actionBuild" ;; install|i) # install : Nhi1Make install action="actionInstall" ;; test|t) # basic testing : ldd on binaries action="actionTest" ;; *) usage "invalid '$action'" esac #optEnd case "$setup" in perf-debug) $action --enable-static=no --enable-threads=yes --enable-debug=yes --with-cxx $action --enable-static=yes --enable-threads=no --enable-debug=yes --with-cxx ;; perf-release) $action --enable-static=no --enable-threads=yes --enable-debug=no "${all[@]}" "${extra[@]}" ;; perf-aggressive) $action --enable-static=yes --enable-threads=no --enable-debug=no "${all[@]}" ;; *) error "invalid 'setup=$setup', expect -> $(args_join_by '|' "${setup_allL[@]}")" ;; esac if (( $? != 0 )) ; then error "action=$action failed" ; fi done } |& sed 's/^/ /' if (( $? != 0 )) ; then exit 1 ; fi done # vim: tags+=$NHI1_HOME/sbin/tags