From 6190f82bf733d0b5867c839a405571b06ad5584a Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 27 Oct 2022 23:54:58 -0500 Subject: [PATCH] Feature: Add support for ZSH in addition to BASH. Some systems have started provided ZSH for license reasons (they don't want to agree to the license of BASH). I experimented with and found that I can make my scripts ZSH friendly. There is no way to "detect" that ZSH is being used as far as I can tell so I defined a new environment variable SHELL_ENGINE. Set this to "zsh" and then run the script via the "zsh" program. Enable emulation mode of "ksh" when using ZSH to be BASH friendly. The ZSH doesn't support "${!i}" substitution. I found a separate way to do this in ZSH via "${(P)i}". It is a shame that they cannot simply replace "(P)" with "!". There are several cases where "bash" is being directly called. Replace this with a "shell_command" environment variable. In some cases, directly calling "bash" may cause a loss of needed environment settings and so "bash" is not directly called when using BASH but "zsh" is still directly called when using ZSH. The ZSH does not automatically handle arrays as well as BASH does. Explicitly define arra with "-A" and explicitly set the initial value to "()". Doing this may introduce problems with older versions of BASH that do not support "-A". The ZSH cannot expand parameters as intelligently as BASH. Parameters followed by certain characters, such as a bracket, that are not encases in braces result in ZSH errors. Mass change many of the parameter uses to always be in braces. Not all cases are changed and there may be some areas where I intended to make such a change and missed. The ZSH appears not to handle output redirection from shell functions. This behavior is used heavily in the project for building and using the variables array. Change the behavior (at the cost of making the code a bit ugglier and harder to read in some cases) to assign a variable defined at a higher scope (such as "key"). The ZSH also appears to utilize "path" as a variable for "PATH" or is case insensitive when it comes to environment variables and shell variables. This is a serious problem. The variable "path" is defined so rename that to "path_" to avoid conflicts (and I'll just have to suffer cringing every time I see that trailing underscore). I stumbled onto some bugs as well while making changes. The necessary changes change the code that is buggy so I am allowing it to be in the same commit. One of the bugs is a typo where errror is used rather than error. Another bug is where the c_warning is used and then c_error is used within the same string (should be consistently using c_warning in this case). It turns out "has-build_compiler" is not defined but conveniently a space for it is missing in bootstrap.sh (must be an accidental delete given the coincidence). Some of the "mode" properties are incorrectly being assigned the non-mode value when a mode value exists in bootstrap.sh. --- build/scripts/bootstrap-example.sh | 100 ++- build/scripts/bootstrap.sh | 1663 ++++++++++++++++++++++-------------- build/scripts/install.sh | 176 ++-- build/scripts/package.sh | 405 ++++----- build/scripts/test.sh | 208 +++-- 5 files changed, 1500 insertions(+), 1052 deletions(-) diff --git a/build/scripts/bootstrap-example.sh b/build/scripts/bootstrap-example.sh index bae9ac6..41007ff 100644 --- a/build/scripts/bootstrap-example.sh +++ b/build/scripts/bootstrap-example.sh @@ -34,6 +34,14 @@ # This will create a directory at he present working directory of the script caller called "fll" where everything will be installed. # This assumes the shell script is GNU bash. # This is not intended to provide any extensive or thorough error handling. +# +# This script can also be run under zsh rather than bash by setting the environment variable SHELL_ENGINE to "zsh", such as: +# SHELL_ENGINE="zsh" zsh ./bootstrap-example.sh --help +# + +if [[ $SHELL_ENGINE == "zsh" ]] ; then + emulate ksh +fi path_original="$PWD/" path_work="${path_original}fll/" @@ -49,44 +57,56 @@ mode_part= mode_parameter= mode_path= mode_value= +shell_command=bash + +if [[ $SHELL_ENGINE == "zsh" ]] ; then + shell_command=zsh +fi let i=2 +p= while [[ $i -le $# ]] ; do - if [[ ${!i} == "+d" ]] ; then + if [[ $SHELL_ENGINE == "zsh" ]] ; then + p=${(P)i} + else + p=${!i} + fi + + if [[ $p == "+d" ]] ; then color="+d" - elif [[ ${!i} == "+l" ]] ; then + elif [[ $p == "+l" ]] ; then color="+l" - elif [[ ${!i} == "+n" ]] ; then + elif [[ $p == "+n" ]] ; then color="+n" - elif [[ ${!i} == "+q" ]] ; then + elif [[ $p == "+q" ]] ; then verbose="+q" verbose_common= - elif [[ ${!i} == "+N" ]] ; then + elif [[ $p == "+N" ]] ; then verbose="+N" verbose_common= - elif [[ ${!i} == "+V" ]] ; then + elif [[ $p == "+V" ]] ; then verbose="+V" verbose_common="-v" - elif [[ ${!i} == "+D" ]] ; then + elif [[ $p == "+D" ]] ; then verbose="+D" verbose_common="-v" - elif [[ ${!i} == "--enable-static" ]] ; then + elif [[ $p == "--enable-static" ]] ; then static="--enable-static" - elif [[ ${!i} == "--disable-static" ]] ; then + elif [[ $p == "--disable-static" ]] ; then static="--disable-static" - elif [[ ${!i} == "--enable-shared" ]] ; then + elif [[ $p == "--enable-shared" ]] ; then shared="--enable-shared" - elif [[ ${!i} == "--disable-shared" ]] ; then + elif [[ $p == "--disable-shared" ]] ; then shared="--disable-shared" - elif [[ ${!i} == "clang" ]] ; then + elif [[ $p == "clang" ]] ; then clang="-m clang" - elif [[ ${!i} == "-w" || ${!i} == "--work" ]] ; then + elif [[ $p == "-w" || $p == "--work" ]] ; then let i++ if [[ $i -le $# ]] ; then - path_work=${!i} + path_work=$p fi fi @@ -98,7 +118,7 @@ if [[ ! -d $path_work ]] ; then fi if [[ $1 == "individual" ]] ; then - bash build/scripts/package.sh $verbose $color rebuild -i + $shell_command build/scripts/package.sh $verbose $color rebuild -i if [[ $? -eq 0 ]] ; then for i in f_type f_status f_memory f_type_array f_string f_utf f_account f_capability f_color f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_path f_pipe f_print f_status_string f_serialize f_signal f_socket f_thread fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_print fl_signal fl_string fl_utf fl_utf_file fll_control_group fll_error fll_execute fll_file fll_fss fll_fss_status_string fll_iki fll_path fll_print fll_program fll_status_string ; do @@ -106,11 +126,11 @@ if [[ $1 == "individual" ]] ; then cd package/individual/$i-$version/ && - ./bootstrap.sh clean $verbose $color && + $shell_command ./bootstrap.sh clean $verbose $color && - ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m individual $clang && + $shell_command ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m individual $clang && - ./install.sh $verbose $color $shared $static -w $path_work && + $shell_command ./install.sh $verbose $color $shared $static -w $path_work && cd $path_original || break done @@ -118,47 +138,47 @@ if [[ $1 == "individual" ]] ; then fi if [[ $1 == "level" ]] ; then - bash build/scripts/package.sh $verbose $color rebuild -l && + $shell_command build/scripts/package.sh $verbose $color rebuild -l && cd package/level/fll-level_0-$version/ && - ./bootstrap.sh clean $verbose $color && + $shell_command ./bootstrap.sh clean $verbose $color && - ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m level $clang && + $shell_command ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m level $clang && - ./install.sh $verbose $color $shared $static -w $path_work && + $shell_command ./install.sh $verbose $color $shared $static -w $path_work && cd $path_original && cd package/level/fll-level_1-$version/ && - ./bootstrap.sh clean $verbose $color && + $shell_command ./bootstrap.sh clean $verbose $color && - ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m level && + $shell_command ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m level && - ./install.sh $verbose $color $shared $static -w $path_work && + $shell_command ./install.sh $verbose $color $shared $static -w $path_work && cd $path_original && cd package/level/fll-level_2-$version/ && - ./bootstrap.sh clean $verbose $color && + $shell_command ./bootstrap.sh clean $verbose $color && - ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m level && + $shell_command ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m level && - ./install.sh $verbose $color $shared $static -w $path_work + $shell_command ./install.sh $verbose $color $shared $static -w $path_work fi if [[ $1 == "monolithic" ]] ; then - bash build/scripts/package.sh $verbose $color rebuild -m && + $shell_command build/scripts/package.sh $verbose $color rebuild -m && cd package/monolithic/fll-$version/ && - ./bootstrap.sh clean $verbose $color && + $shell_command ./bootstrap.sh clean $verbose $color && - ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m monolithic $clang && + $shell_command ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m monolithic $clang && - ./install.sh $verbose $color $shared $static -w $path_work + $shell_command ./install.sh $verbose $color $shared $static -w $path_work fi # The following in an example on building individual projects. @@ -188,15 +208,15 @@ if [[ $mode_part != "" ]] ; then mode_value="$mode_part" fi - bash build/scripts/package.sh $verbose $color rebuild $mode_parameter $mode_value && + $shell_command build/scripts/package.sh $verbose $color rebuild $mode_parameter $mode_value && cd package/$mode_path/$mode_part-$version/ && - ./bootstrap.sh clean $verbose $color && + $shell_command ./bootstrap.sh clean $verbose $color && - ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m $build_mode && + $shell_command ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m $build_mode && - ./install.sh $verbose $color $shared $static -w $path_work + $shell_command ./install.sh $verbose $color $shared $static -w $path_work # The following in an example on building all FLL program projects using the project bootstrapped from above. elif [[ $1 == "programs-individual" || $1 == "programs-level" || $1 == "programs-monolithic" ]] ; then @@ -208,7 +228,7 @@ elif [[ $1 == "programs-individual" || $1 == "programs-level" || $1 == "programs build_mode="monolithic" fi - bash build/scripts/package.sh $verbose $color rebuild -p && + $shell_command build/scripts/package.sh $verbose $color rebuild -p && cd package/program @@ -218,11 +238,11 @@ elif [[ $1 == "programs-individual" || $1 == "programs-level" || $1 == "programs cd ${path_original}package/program/$i && - ./bootstrap.sh clean $verbose $color && + $shell_command ./bootstrap.sh clean $verbose $color && - ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m $build_mode && + $shell_command ./bootstrap.sh build $verbose $color $shared $static -w $path_work -m $build_mode && - ./install.sh $verbose $color $shared $static -w $path_work || + $shell_command ./install.sh $verbose $color $shared $static -w $path_work || break done diff --git a/build/scripts/bootstrap.sh b/build/scripts/bootstrap.sh index d1b2a94..f1ac1cd 100644 --- a/build/scripts/bootstrap.sh +++ b/build/scripts/bootstrap.sh @@ -3,12 +3,21 @@ # programmer: Kevin Day # # The purpose of this script is to provide a simple bootstrap tool to compile any part of the FLL project. +# # The dependencies of this script are: bash, basename, cp, dirname, grep, ln, mkdir, rm, sed, and touch. # # This script is only designed specifically for bootstrap compiling the FLL project and does not necessarily fully follow the fake (featureless make) build process. +# +# This script can also be run under zsh rather than bash by setting the environment variable SHELL_ENGINE to "zsh", such as: +# SHELL_ENGINE="zsh" zsh ./bootstrap.sh --help +# bootstrap_main() { + if [[ $SHELL_ENGINE == "zsh" ]] ; then + emulate ksh + fi + local public_name="Simple FLL Bootstrap Script" local system_name=bootstrap local called_name=$(basename $0) @@ -32,7 +41,8 @@ bootstrap_main() { local c_subtle="\\033[1;30m" local c_prefix="\\" - local variables= + local key= + local -A variables=() local settings_name=settings local settings_file= local settings_defines= @@ -70,7 +80,12 @@ bootstrap_main() { while [[ $i -lt $t ]] ; do let i=$i+1 - p=${!i} + + if [[ $SHELL_ENGINE == "zsh" ]] ; then + p=${(P)i} + else + p=${!i} + fi if [[ $grab_next == "" ]] ; then if [[ $p == "-h" || $p == "--help" ]] ; then @@ -183,7 +198,7 @@ bootstrap_main() { for mode in $modes ; do if [[ $(echo "$mode" | grep -s -o "[^_[:alnum:]+-]") != "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The mode $c_notice$mode$c_error includes invalid characters, only alphanumeric, underscore, minus, and plus are allowed.$c_reset" + echo -e "${c_error}ERROR: The mode ${c_notice}${mode}${c_error} includes invalid characters, only alphanumeric, underscore, minus, and plus are allowed.${c_reset}" fi bootstrap_cleanup @@ -215,7 +230,8 @@ bootstrap_main() { return 1 fi - project_built="${path_build_stage}${variables[$(bootstrap_id build_name)]}" + bootstrap_id "build_name" + project_built="${path_build_stage}${variables[$key]}" if [[ $process != "" ]] ; then project_built="${project_built}-$process" fi @@ -226,7 +242,7 @@ bootstrap_main() { if [[ $modes_available == "" ]] ; then if [[ $modes != "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The mode(s) $c_notice$modes$c_error are not a valid modes, there are no available modes.$c_error$c_reset" + echo -e "${c_error}ERROR: The mode(s) ${c_notice}${modes}${c_error} are not a valid modes, there are no available modes.${c_error}${c_reset}" fi bootstrap_cleanup @@ -251,7 +267,7 @@ bootstrap_main() { if [[ $i -eq 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The mode(s) $c_notice$modes$c_error are not valid modes, they must be one of: $c_notice$modes_available$c_error.$c_reset" + echo -e "${c_error}ERROR: The mode(s) ${c_notice}${modes}${c_error} are not valid modes, they must be one of: ${c_notice}$modes_available${c_error}.${c_reset}" fi bootstrap_cleanup @@ -260,9 +276,10 @@ bootstrap_main() { fi fi - if [[ ${variables[$(bootstrap_id build_name)]} == "" ]] ; then + bootstrap_id "build_name" + if [[ ${variables[$key]} == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The required setting '${c_notice}build_name$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + echo -e "${c_error}ERROR: The required setting '${c_notice}build_name${c_error}' is not specified in the build settings file '${c_notice}${settings_file}${c_error}'.${c_reset}" fi bootstrap_cleanup @@ -270,9 +287,10 @@ bootstrap_main() { return 1 fi - if [[ ${variables[$(bootstrap_id version_major)]} == "" ]] ; then + bootstrap_id "version_major" + if [[ ${variables[$key]} == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The required setting '${c_notice}version_major$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + echo -e "${c_error}ERROR: The required setting '${c_notice}version_major${c_error}' is not specified in the build settings file '${c_notice}${settings_file}${c_error}'.${c_reset}" fi bootstrap_cleanup @@ -280,9 +298,10 @@ bootstrap_main() { return 1 fi - if [[ ${variables[$(bootstrap_id version_minor)]} == "" ]] ; then + bootstrap_id "version_minor" + if [[ ${variables[$key]} == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The required setting '${c_notice}version_minor$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + echo -e "${c_error}ERROR: The required setting '${c_notice}version_minor${c_error}' is not specified in the build settings file '${c_notice}${settings_file}${c_error}'.${c_reset}" fi bootstrap_cleanup @@ -290,9 +309,10 @@ bootstrap_main() { return 1 fi - if [[ ${variables[$(bootstrap_id version_micro)]} == "" ]] ; then + bootstrap_id "version_micro" + if [[ ${variables[$key]} == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The required setting '${c_notice}version_micro$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + echo -e "${c_error}ERROR: The required setting '${c_notice}version_micro${c_error}' is not specified in the build settings file '${c_notice}${settings_file}${c_error}'.${c_reset}" fi bootstrap_cleanup @@ -302,7 +322,7 @@ bootstrap_main() { if [[ $path_data == "" || ! -d $path_data ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The data directory $c_notice$path_data$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The data directory ${c_notice}${path_data}${c_error} is not a valid directory.${c_reset}" fi bootstrap_cleanup @@ -312,7 +332,7 @@ bootstrap_main() { if [[ $path_sources == "" || ! -d $path_sources ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The sources directory $c_notice$path_sources$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The sources directory ${c_notice}${path_sources}${c_error} is not a valid directory.${c_reset}" fi bootstrap_cleanup @@ -322,7 +342,7 @@ bootstrap_main() { if [[ $path_work != "" && ! -d $path_work ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The work directory $c_notice$path_work$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The work directory ${c_notice}${path_work}${c_error} is not a valid directory.${c_reset}" fi bootstrap_cleanup @@ -332,7 +352,7 @@ bootstrap_main() { if [[ $defines_override != "" && $(echo "$defines_override" | grep -s -o "[^_[:alnum:][:space:]]") != "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The defines override $c_notice$defines_override$c_error includes invalid characters, only alphanumeric, whitespace, and underscore are allowed.$c_reset" + echo -e "${c_error}ERROR: The defines override ${c_notice}${defines_override}${c_error} includes invalid characters, only alphanumeric, whitespace, and underscore are allowed.${c_reset}" fi bootstrap_cleanup @@ -340,23 +360,27 @@ bootstrap_main() { return 1 fi - project_label="${variables[$(bootstrap_id build_name)]}" + bootstrap_id "build_name" + project_label="${variables[$key]}" - if [[ "${variables[$(bootstrap_id version_major)]}" != "" ]] ; then - project_label="${project_label}-${variables[$(bootstrap_id version_major)]}" + bootstrap_id "version_major" + if [[ "${variables[$key]}" != "" ]] ; then + project_label="${project_label}-${variables[$key]}" - if [[ "${variables[$(bootstrap_id version_minor)]}" != "" ]] ; then - project_label="${project_label}.${variables[$(bootstrap_id version_minor)]}" + bootstrap_id "version_minor" + if [[ "${variables[$key]}" != "" ]] ; then + project_label="${project_label}.${variables[$key]}" - if [[ "${variables[$(bootstrap_id version_micro)]}" != "" ]] ; then - project_label="${project_label}.${variables[$(bootstrap_id version_micro)]}" + bootstrap_id "version_micro" + if [[ "${variables[$key]}" != "" ]] ; then + project_label="${project_label}.${variables[$key]}" fi fi fi if [[ $operation_failure == "fail-multiple" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Only one operation may be specified at a time.$c_reset" + echo -e "${c_error}ERROR: Only one operation may be specified at a time.${c_reset}" fi bootstrap_cleanup @@ -365,7 +389,7 @@ bootstrap_main() { elif [[ $operation == "build" ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Building:${c_reset} $c_notice$project_label${c_highlight}.$c_reset" + echo -e "${c_highlight}Building:${c_reset} ${c_notice}${project_label}${c_highlight}.${c_reset}" fi if [[ ! -f ${project_built}.prepared ]] ; then @@ -388,13 +412,13 @@ bootstrap_main() { elif [[ $operation == "clean" ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Cleaning Project:${c_reset} $c_notice$project_label${c_highlight}.$c_reset" + echo -e "${c_highlight}Cleaning Project:${c_reset} ${c_notice}${project_label}${c_highlight}.${c_reset}" fi bootstrap_operation_clean elif [[ $operation == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: No operation was given.$c_reset" + echo -e "${c_error}ERROR: No operation was given.${c_reset}" fi bootstrap_cleanup @@ -402,7 +426,7 @@ bootstrap_main() { return 1 else if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The operation $c_notice$operation$c_error was not recognized.$c_reset" + echo -e "${c_error}ERROR: The operation ${c_notice}${operation}${c_error} was not recognized.${c_reset}" fi bootstrap_cleanup @@ -440,36 +464,36 @@ bootstrap_handle_colors() { bootstrap_help() { echo - echo -e "${c_title}$public_name$c_reset" - echo -e " ${c_notice}Version $version$c_reset" + echo -e "${c_title}${public_name}${c_reset}" + echo -e " ${c_notice}Version ${version}${c_reset}" echo - echo -e "$c_highlight$system_name$c_reset $c_notice[${c_reset} options $c_notice]$c_reset $c_notice[${c_reset} operation $c_notice]$c_reset" + echo -e "${c_highlight}${system_name}${c_reset} ${c_notice}[${c_reset} options ${c_notice}]${c_reset} ${c_notice}[${c_reset} operation ${c_notice}]${c_reset}" echo -e " ${c_important}build${c_reset} Build or compile the code based on build settings file." echo -e " ${c_important}clean${c_reset} Delete all build files." echo - echo -e "${c_highlight}Options:$c_reset" - echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." - echo -e " +${c_important}d$c_reset, ++${c_important}dark$c_reset Use color modes that show up better on dark backgrounds." - echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." - echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." - echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity, silencing most output." - echo -e " +${c_important}N$c_reset, ++${c_important}normal$c_reset Set verbosity to normal." - echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." - echo -e " +${c_important}D$c_reset, ++${c_important}debug$c_reset Enable debugging, significantly increasing verbosity beyond normal output." - echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." + echo -e "${c_highlight}Options:${c_reset}" + echo -e " -${c_important}h${c_reset}, --${c_important}help${c_reset} Print this help screen." + echo -e " +${c_important}d${c_reset}, ++${c_important}dark${c_reset} Use color modes that show up better on dark backgrounds." + echo -e " +${c_important}l${c_reset}, ++${c_important}light${c_reset} Use color modes that show up better on light backgrounds." + echo -e " +${c_important}n${c_reset}, ++${c_important}no_color${c_reset} Do not use color." + echo -e " +${c_important}q${c_reset}, ++${c_important}quiet${c_reset} Decrease verbosity, silencing most output." + echo -e " +${c_important}N${c_reset}, ++${c_important}normal${c_reset} Set verbosity to normal." + echo -e " +${c_important}V${c_reset}, ++${c_important}verbose${c_reset} Increase verbosity beyond normal output." + echo -e " +${c_important}D${c_reset}, ++${c_important}debug${c_reset} Enable debugging, significantly increasing verbosity beyond normal output." + echo -e " +${c_important}v${c_reset}, ++${c_important}version${c_reset} Print the version number of this program." echo - echo -e "${c_highlight}Bootstrap Options:$c_reset" - echo -e " -${c_important}d$c_reset, --${c_important}defines${c_reset} Override custom defines with these defines." - echo -e " -${c_important}m$c_reset, --${c_important}mode${c_reset} Use this mode when processing the build settings." - echo -e " -${c_important}p$c_reset, --${c_important}process${c_reset} Process name for storing build states." - echo -e " -${c_important}s$c_reset, --${c_important}settings${c_reset} Use this settings file, from within the source settings directory." + echo -e "${c_highlight}Bootstrap Options:${c_reset}" + echo -e " -${c_important}d${c_reset}, --${c_important}defines${c_reset} Override custom defines with these defines." + echo -e " -${c_important}m${c_reset}, --${c_important}mode${c_reset} Use this mode when processing the build settings." + echo -e " -${c_important}p${c_reset}, --${c_important}process${c_reset} Process name for storing build states." + echo -e " -${c_important}s${c_reset}, --${c_important}settings${c_reset} Use this settings file, from within the source settings directory." echo - echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset} Specify a custom build directory." - echo -e " -${c_important}D$c_reset, --${c_important}data${c_reset} Specify a custom path to the data files." - echo -e " -${c_important}S$c_reset, --${c_important}sources${c_reset} Specify a custom path to the source files." - echo -e " -${c_important}w$c_reset, --${c_important}work${c_reset} Use includes/libraries/programs from this directory instead of system." + echo -e " -${c_important}b${c_reset}, --${c_important}build${c_reset} Specify a custom build directory." + echo -e " -${c_important}D${c_reset}, --${c_important}data${c_reset} Specify a custom path to the data files." + echo -e " -${c_important}S${c_reset}, --${c_important}sources${c_reset} Specify a custom path to the source files." + echo -e " -${c_important}w${c_reset}, --${c_important}work${c_reset} Use includes/libraries/programs from this directory instead of system." echo - echo -e "${c_highlight}Special Options:$c_reset" + echo -e "${c_highlight}Special Options:${c_reset}" echo -e " --${c_important}enable-shared${c_reset} Forcibly do build shared files." echo -e " --${c_important}disable-shared${c_reset} Forcibly do not build shared files." echo -e " --${c_important}enable-static${c_reset} Forcibly do build static files." @@ -480,204 +504,204 @@ bootstrap_help() { bootstrap_id() { case $1 in - "build_compiler") echo -n 0;; - "build_indexer") echo -n 1;; - "build_indexer_arguments") echo -n 2;; - "build_language") echo -n 3;; - "build_libraries") echo -n 4;; - "build_libraries_shared") echo -n 5;; - "build_libraries_static") echo -n 6;; - "build_name") echo -n 7;; - "build_objects_library") echo -n 8;; - "build_objects_library_shared") echo -n 9;; - "build_objects_library_static") echo -n 10;; - "build_objects_program") echo -n 11;; - "build_objects_program_shared") echo -n 12;; - "build_objects_program_static") echo -n 13;; - "build_script") echo -n 14;; - "build_shared") echo -n 15;; - "build_sources_headers") echo -n 16;; - "build_sources_headers_shared") echo -n 17;; - "build_sources_headers_static") echo -n 18;; - "build_sources_library") echo -n 19;; - "build_sources_library_shared") echo -n 20;; - "build_sources_library_static") echo -n 21;; - "build_sources_object") echo -n 22;; - "build_sources_object_shared") echo -n 23;; - "build_sources_object_static") echo -n 24;; - "build_sources_program") echo -n 25;; - "build_sources_program_shared") echo -n 26;; - "build_sources_program_static") echo -n 27;; - "build_sources_script") echo -n 28;; - "build_sources_setting") echo -n 29;; - "build_static") echo -n 30;; - "defines") echo -n 31;; - "defines_library") echo -n 32;; - "defines_library_shared") echo -n 33;; - "defines_library_static") echo -n 34;; - "defines_object") echo -n 35;; - "defines_object_shared") echo -n 36;; - "defines_object_static") echo -n 37;; - "defines_program") echo -n 38;; - "defines_program_shared") echo -n 39;; - "defines_program_static") echo -n 40;; - "defines_shared") echo -n 41;; - "defines_static") echo -n 42;; - "environment") echo -n 43;; - "flags") echo -n 44;; - "flags_library") echo -n 45;; - "flags_library_shared") echo -n 46;; - "flags_library_static") echo -n 47;; - "flags_object") echo -n 48;; - "flags_object_shared") echo -n 49;; - "flags_object_static") echo -n 50;; - "flags_program") echo -n 51;; - "flags_program_shared") echo -n 52;; - "flags_program_static") echo -n 53;; - "flags_shared") echo -n 54;; - "flags_static") echo -n 55;; - "has_path_standard") echo -n 56;; - "modes") echo -n 57;; - "modes_default") echo -n 58;; - "path_headers") echo -n 59;; - "path_language") echo -n 60;; - "path_library_script") echo -n 61;; - "path_library_shared") echo -n 62;; - "path_library_static") echo -n 63;; - "path_object_script") echo -n 64;; - "path_object_shared") echo -n 65;; - "path_object_static") echo -n 66;; - "path_program_script") echo -n 67;; - "path_program_shared") echo -n 68;; - "path_program_static") echo -n 69;; - "path_sources") echo -n 70;; - "path_sources_object") echo -n 71;; - "preserve_path_headers") echo -n 72;; - "process_post") echo -n 73;; - "process_pre") echo -n 74;; - "search_exclusive") echo -n 75;; - "search_shared") echo -n 76;; - "search_static") echo -n 77;; - "version_file") echo -n 78;; - "version_major") echo -n 79;; - "version_major_prefix") echo -n 80;; - "version_micro") echo -n 81;; - "version_micro_prefix") echo -n 82;; - "version_minor") echo -n 83;; - "version_minor_prefix") echo -n 84;; - "version_nano") echo -n 85;; - "version_nano_prefix") echo -n 86;; - "version_target") echo -n 87;; - - "build_compiler-mode") echo -n 88;; - "build_indexer-mode") echo -n 89;; - "build_indexer_arguments-mode") echo -n 90;; - "build_language-mode") echo -n 91;; - "build_libraries-mode") echo -n 92;; - "build_libraries_shared-mode") echo -n 93;; - "build_libraries_static-mode") echo -n 94;; - "build_name-mode") echo -n 95;; - "build_objects_library-mode") echo -n 96;; - "build_objects_library_shared-mode") echo -n 97;; - "build_objects_library_static-mode") echo -n 98;; - "build_objects_program-mode") echo -n 99;; - "build_objects_program_shared-mode") echo -n 100;; - "build_objects_program_static-mode") echo -n 101;; - "build_script-mode") echo -n 102;; - "build_shared-mode") echo -n 103;; - "build_sources_headers-mode") echo -n 104;; - "build_sources_headers_shared-mode") echo -n 105;; - "build_sources_headers_static-mode") echo -n 106;; - "build_sources_library-mode") echo -n 107;; - "build_sources_library_shared-mode") echo -n 108;; - "build_sources_library_static-mode") echo -n 109;; - "build_sources_object-mode") echo -n 110;; - "build_sources_object_shared-mode") echo -n 111;; - "build_sources_object_static-mode") echo -n 112;; - "build_sources_program-mode") echo -n 113;; - "build_sources_program_shared-mode") echo -n 114;; - "build_sources_program_static-mode") echo -n 115;; - "build_sources_script-mode") echo -n 116;; - "build_sources_setting-mode") echo -n 117;; - "build_static-mode") echo -n 118;; - "defines-mode") echo -n 119;; - "defines_library-mode") echo -n 120;; - "defines_library_shared-mode") echo -n 121;; - "defines_library_static-mode") echo -n 122;; - "defines_object-mode") echo -n 123;; - "defines_object_shared-mode") echo -n 124;; - "defines_object_static-mode") echo -n 125;; - "defines_program-mode") echo -n 126;; - "defines_program_shared-mode") echo -n 127;; - "defines_program_static-mode") echo -n 128;; - "defines_shared-mode") echo -n 129;; - "defines_static-mode") echo -n 130;; - "environment-mode") echo -n 131;; - "flags-mode") echo -n 132;; - "flags_library-mode") echo -n 133;; - "flags_library_shared-mode") echo -n 134;; - "flags_library_static-mode") echo -n 135;; - "flags_object-mode") echo -n 136;; - "flags_object_shared-mode") echo -n 137;; - "flags_object_static-mode") echo -n 138;; - "flags_program-mode") echo -n 139;; - "flags_program_shared-mode") echo -n 140;; - "flags_program_static-mode") echo -n 141;; - "flags_shared-mode") echo -n 142;; - "flags_static-mode") echo -n 143;; - "has_path_standard-mode") echo -n 144;; - "path_headers-mode") echo -n 145;; - "path_language-mode") echo -n 146;; - "path_library_script-mode") echo -n 147;; - "path_library_shared-mode") echo -n 148;; - "path_library_static-mode") echo -n 149;; - "path_object_script-mode") echo -n 150;; - "path_object_shared-mode") echo -n 151;; - "path_object_static-mode") echo -n 152;; - "path_program_script-mode") echo -n 153;; - "path_program_shared-mode") echo -n 154;; - "path_program_static-mode") echo -n 155;; - "path_sources-mode") echo -n 156;; - "path_sources_object-mode") echo -n 157;; - "preserve_path_headers-mode") echo -n 158;; - "process_post-mode") echo -n 159;; - "process_pre-mode") echo -n 160;; - "search_exclusive-mode") echo -n 161;; - "search_shared-mode") echo -n 162;; - "search_static-mode") echo -n 163;; - "version_file-mode") echo -n 164;; - "version_major-mode") echo -n 165;; - "version_major_prefix-mode") echo -n 166;; - "version_micro-mode") echo -n 167;; - "version_micro_prefix-mode") echo -n 168;; - "version_minor-mode") echo -n 169;; - "version_minor_prefix-mode") echo -n 170;; - "version_nano-mode") echo -n 171;; - "version_nano_prefix-mode") echo -n 172;; - "version_target-mode") echo -n 173;; - - "has-has_path_standard") echo -n 175;; - "has-path_library_script") echo -n 176;; - "has-path_library_shared") echo -n 177;; - "has-path_library_static") echo -n 178;; - "has-path_object_script") echo -n 179;; - "has-path_object_shared") echo -n 180;; - "has-path_object_static") echo -n 181;; - "has-path_program_script") echo -n 182;; - "has-path_program_shared") echo -n 183;; - "has-path_program_static") echo -n 184;; - "has-path_sources") echo -n 185;; - "has-path_sources_object") echo -n 186;; - "has-search_shared") echo -n 187;; - "has-version_major_prefix") echo -n 188;; - "has-version_micro_prefix") echo -n 189;; - "has-version_minor_prefix") echo -n 190;; - "has-version_nano_prefix") echo -n 191;; + "build_compiler") let key=0;; + "build_indexer") let key=1;; + "build_indexer_arguments") let key=2;; + "build_language") let key=3;; + "build_libraries") let key=4;; + "build_libraries_shared") let key=5;; + "build_libraries_static") let key=6;; + "build_name") let key=7;; + "build_objects_library") let key=8;; + "build_objects_library_shared") let key=9;; + "build_objects_library_static") let key=10;; + "build_objects_program") let key=11;; + "build_objects_program_shared") let key=12;; + "build_objects_program_static") let key=13;; + "build_script") let key=14;; + "build_shared") let key=15;; + "build_sources_headers") let key=16;; + "build_sources_headers_shared") let key=17;; + "build_sources_headers_static") let key=18;; + "build_sources_library") let key=19;; + "build_sources_library_shared") let key=20;; + "build_sources_library_static") let key=21;; + "build_sources_object") let key=22;; + "build_sources_object_shared") let key=23;; + "build_sources_object_static") let key=24;; + "build_sources_program") let key=25;; + "build_sources_program_shared") let key=26;; + "build_sources_program_static") let key=27;; + "build_sources_script") let key=28;; + "build_sources_setting") let key=29;; + "build_static") let key=30;; + "defines") let key=31;; + "defines_library") let key=32;; + "defines_library_shared") let key=33;; + "defines_library_static") let key=34;; + "defines_object") let key=35;; + "defines_object_shared") let key=36;; + "defines_object_static") let key=37;; + "defines_program") let key=38;; + "defines_program_shared") let key=39;; + "defines_program_static") let key=40;; + "defines_shared") let key=41;; + "defines_static") let key=42;; + "environment") let key=43;; + "flags") let key=44;; + "flags_library") let key=45;; + "flags_library_shared") let key=46;; + "flags_library_static") let key=47;; + "flags_object") let key=48;; + "flags_object_shared") let key=49;; + "flags_object_static") let key=50;; + "flags_program") let key=51;; + "flags_program_shared") let key=52;; + "flags_program_static") let key=53;; + "flags_shared") let key=54;; + "flags_static") let key=55;; + "has_path_standard") let key=56;; + "modes") let key=57;; + "modes_default") let key=58;; + "path_headers") let key=59;; + "path_language") let key=60;; + "path_library_script") let key=61;; + "path_library_shared") let key=62;; + "path_library_static") let key=63;; + "path_object_script") let key=64;; + "path_object_shared") let key=65;; + "path_object_static") let key=66;; + "path_program_script") let key=67;; + "path_program_shared") let key=68;; + "path_program_static") let key=69;; + "path_sources") let key=70;; + "path_sources_object") let key=71;; + "preserve_path_headers") let key=72;; + "process_post") let key=73;; + "process_pre") let key=74;; + "search_exclusive") let key=75;; + "search_shared") let key=76;; + "search_static") let key=77;; + "version_file") let key=78;; + "version_major") let key=79;; + "version_major_prefix") let key=80;; + "version_micro") let key=81;; + "version_micro_prefix") let key=82;; + "version_minor") let key=83;; + "version_minor_prefix") let key=84;; + "version_nano") let key=85;; + "version_nano_prefix") let key=86;; + "version_target") let key=87;; + + "build_compiler-mode") let key=88;; + "build_indexer-mode") let key=89;; + "build_indexer_arguments-mode") let key=90;; + "build_language-mode") let key=91;; + "build_libraries-mode") let key=92;; + "build_libraries_shared-mode") let key=93;; + "build_libraries_static-mode") let key=94;; + "build_name-mode") let key=95;; + "build_objects_library-mode") let key=96;; + "build_objects_library_shared-mode") let key=97;; + "build_objects_library_static-mode") let key=98;; + "build_objects_program-mode") let key=99;; + "build_objects_program_shared-mode") let key=100;; + "build_objects_program_static-mode") let key=101;; + "build_script-mode") let key=102;; + "build_shared-mode") let key=103;; + "build_sources_headers-mode") let key=104;; + "build_sources_headers_shared-mode") let key=105;; + "build_sources_headers_static-mode") let key=106;; + "build_sources_library-mode") let key=107;; + "build_sources_library_shared-mode") let key=108;; + "build_sources_library_static-mode") let key=109;; + "build_sources_object-mode") let key=110;; + "build_sources_object_shared-mode") let key=111;; + "build_sources_object_static-mode") let key=112;; + "build_sources_program-mode") let key=113;; + "build_sources_program_shared-mode") let key=114;; + "build_sources_program_static-mode") let key=115;; + "build_sources_script-mode") let key=116;; + "build_sources_setting-mode") let key=117;; + "build_static-mode") let key=118;; + "defines-mode") let key=119;; + "defines_library-mode") let key=120;; + "defines_library_shared-mode") let key=121;; + "defines_library_static-mode") let key=122;; + "defines_object-mode") let key=123;; + "defines_object_shared-mode") let key=124;; + "defines_object_static-mode") let key=125;; + "defines_program-mode") let key=126;; + "defines_program_shared-mode") let key=127;; + "defines_program_static-mode") let key=128;; + "defines_shared-mode") let key=129;; + "defines_static-mode") let key=130;; + "environment-mode") let key=131;; + "flags-mode") let key=132;; + "flags_library-mode") let key=133;; + "flags_library_shared-mode") let key=134;; + "flags_library_static-mode") let key=135;; + "flags_object-mode") let key=136;; + "flags_object_shared-mode") let key=137;; + "flags_object_static-mode") let key=138;; + "flags_program-mode") let key=139;; + "flags_program_shared-mode") let key=140;; + "flags_program_static-mode") let key=141;; + "flags_shared-mode") let key=142;; + "flags_static-mode") let key=143;; + "has_path_standard-mode") let key=144;; + "path_headers-mode") let key=145;; + "path_language-mode") let key=146;; + "path_library_script-mode") let key=147;; + "path_library_shared-mode") let key=148;; + "path_library_static-mode") let key=149;; + "path_object_script-mode") let key=150;; + "path_object_shared-mode") let key=151;; + "path_object_static-mode") let key=152;; + "path_program_script-mode") let key=153;; + "path_program_shared-mode") let key=154;; + "path_program_static-mode") let key=155;; + "path_sources-mode") let key=156;; + "path_sources_object-mode") let key=157;; + "preserve_path_headers-mode") let key=158;; + "process_post-mode") let key=159;; + "process_pre-mode") let key=160;; + "search_exclusive-mode") let key=161;; + "search_shared-mode") let key=162;; + "search_static-mode") let key=163;; + "version_file-mode") let key=164;; + "version_major-mode") let key=165;; + "version_major_prefix-mode") let key=166;; + "version_micro-mode") let key=167;; + "version_micro_prefix-mode") let key=168;; + "version_minor-mode") let key=169;; + "version_minor_prefix-mode") let key=170;; + "version_nano-mode") let key=171;; + "version_nano_prefix-mode") let key=172;; + "version_target-mode") let key=173;; + + "has-build_compiler") let key=174;; + "has-has_path_standard") let key=175;; + "has-path_library_script") let key=176;; + "has-path_library_shared") let key=177;; + "has-path_library_static") let key=178;; + "has-path_object_script") let key=179;; + "has-path_object_shared") let key=180;; + "has-path_object_static") let key=181;; + "has-path_program_script") let key=182;; + "has-path_program_shared") let key=183;; + "has-path_program_static") let key=184;; + "has-path_sources") let key=185;; + "has-path_sources_object") let key=186;; + "has-search_shared") let key=187;; + "has-version_major_prefix") let key=188;; + "has-version_micro_prefix") let key=189;; + "has-version_minor_prefix") let key=190;; + "has-version_nano_prefix") let key=191;; esac } bootstrap_load_settings() { - local -i failure=0 local i= local key= @@ -685,13 +709,13 @@ bootstrap_load_settings() { if [[ ! -d ${path_data}build/ ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: No build settings directory '$c_notice${path_data}build/$c_error' could not be found or is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: No build settings directory '${c_notice}${path_data}build/${c_error}' could not be found or is not a valid directory.${c_reset}" fi let failure=1 elif [[ ! -f $settings_file ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: No settings file $c_notice$settings_file$c_error could not be found or is not a valid file.$c_reset" + echo -e "${c_error}ERROR: No settings file ${c_notice}${settings_file}${c_error} could not be found or is not a valid file.${c_reset}" fi let failure=1 @@ -716,14 +740,15 @@ bootstrap_load_settings() { # Single value Objects. for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_object preserve_path_headers process_post process_pre search_exclusive search_shared search_static version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do - key=$(bootstrap_id $i) + + bootstrap_id "$i" if [[ $key == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Failed to find index for '$c_notice$i$c_error' when calling ${c_notice}bootstrap_id()$c_error.$c_reset" + echo -e "${c_warning}WARNING: Failed to find index for '${c_notice}${i}${c_warning}' when calling ${c_notice}bootstrap_id()${c_warning}.${c_reset}" fi else - value=$(grep -s -o "^[[:space:]]*$i[[:space:]].*\$" $settings_file | sed -e "s|^[[:space:]]*$i\>||" -e 's|^[[:space:]]*||') + value=$(grep -s -o "^[[:space:]]*${i}[[:space:]].*\$" $settings_file | sed -e "s|^[[:space:]]*${i}\>||" -e 's|^[[:space:]]*||') if [[ $value != "" ]] ; then variables[$key]="$value" @@ -733,14 +758,15 @@ bootstrap_load_settings() { # Multi value Objects. for i in build_indexer_arguments build_libraries build_libraries_shared build_libraries_static build_objects_library build_objects_library_shared build_objects_library_static build_objects_program build_objects_program_shared build_objects_program_static build_sources_headers build_sources_headers_shared build_sources_headers_static build_sources_library build_sources_library_shared build_sources_library_static build_sources_program build_sources_program_shared build_sources_program_static build_sources_script build_sources_setting defines defines_library defines_library_shared defines_library_static defines_object defines_object_shared defines_object_static defines_program defines_program_shared defines_program_static defines_shared defines_static environment flags flags_library flags_library_shared flags_library_static flags_object flags_object_shared flags_object_static flags_program flags_program_shared flags_program_static flags_shared flags_static ; do - key=$(bootstrap_id $i) + + bootstrap_id "$i" if [[ $key == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Failed to find index for '$c_notice$i$c_error' when calling ${c_notice}bootstrap_id()$c_error.$c_reset" + echo -e "${c_warning}WARNING: Failed to find index for '${c_notice}${i}${c_warning}' when calling ${c_notice}bootstrap_id()${c_warning}.${c_reset}" fi else - value=$(grep -s -o "^[[:space:]]*$i[[:space:]].*\$" $settings_file | sed -e "s|^[[:space:]]*$i\>||" -e 's|^[[:space:]]*||') + value=$(grep -s -o "^[[:space:]]*${i}[[:space:]].*\$" $settings_file | sed -e "s|^[[:space:]]*${i}\>||" -e 's|^[[:space:]]*||') if [[ $value != "" ]] ; then variables[$key]="$value" @@ -750,7 +776,6 @@ bootstrap_load_settings() { } bootstrap_load_settings_mode() { - local i= local key= local m= @@ -760,14 +785,15 @@ bootstrap_load_settings_mode() { # Single value Objects. for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_object preserve_path_headers process_post process_pre search_exclusive search_shared search_static version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do - key=$(bootstrap_id $i-mode) + + bootstrap_id "${i}-mode" if [[ $key == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Failed to find index for '$c_notice$i-$m$c_error' when calling ${c_notice}bootstrap_id()$c_error.$c_reset" + echo -e "${c_warning}WARNING: Failed to find index for '${c_notice}$i-$m${c_warning}' when calling ${c_notice}bootstrap_id()${c_warning}.${c_reset}" fi else - value=$(grep -s -o "^[[:space:]]*$i-$m[[:space:]].*\$" $settings_file | sed -e "H;/$i-$m/h;\$!d;x" | sed -e "s|^[[:space:]]*$i-$m\>||" -e 's|^[[:space:]]*||') + value=$(grep -s -o "^[[:space:]]*${i}-${m}[[:space:]].*\$" $settings_file | sed -e "H;/${i}-${m}/h;\$!d;x" | sed -e "s|^[[:space:]]*${i}-${m}\>||" -e 's|^[[:space:]]*||') if [[ $value != "" ]] ; then variables[$key]="$value" @@ -777,14 +803,15 @@ bootstrap_load_settings_mode() { # Multi value Objects. for i in build_indexer_arguments build_libraries build_libraries_shared build_libraries_static build_objects_library build_objects_library_shared build_objects_library_static build_objects_program build_objects_program_shared build_objects_program_static build_sources_headers build_sources_headers_shared build_sources_headers_static build_sources_library build_sources_library_shared build_sources_library_static build_sources_object_shared build_sources_object_static build_sources_program build_sources_program_shared build_sources_program_static build_sources_script build_sources_setting build_static defines defines_library defines_library_shared defines_library_static defines_object defines_object_shared defines_object_static defines_program defines_program_shared defines_program_static defines_shared defines_static environment flags flags_library flags_library_shared flags_library_static flags_object flags_object_shared flags_object_static flags_program flags_program_shared flags_program_static flags_shared flags_static ; do - key=$(bootstrap_id $i-mode) + + bootstrap_id "${i}-mode" if [[ $key == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Failed to find index for '$c_notice$i-$m$c_warning' when calling ${c_notice}bootstrap_id()$c_warning.$c_reset" + echo -e "${c_warning}WARNING: Failed to find index for '${c_notice}${i}-${m}${c_warning}' when calling ${c_notice}bootstrap_id()${c_warning}.${c_reset}" fi else - value=$(grep -s -o "^[[:space:]]*$i-$m[[:space:]].*\$" $settings_file | sed -e "s|^[[:space:]]*$i-$m\>||" -e 's|^[[:space:]]*||') + value=$(grep -s -o "^[[:space:]]*${i}-${m}[[:space:]].*\$" $settings_file | sed -e "s|^[[:space:]]*${i}-${m}\>||" -e 's|^[[:space:]]*||') if [[ $value != "" ]] ; then variables[$key]="$value" @@ -795,31 +822,34 @@ bootstrap_load_settings_mode() { } bootstrap_load_settings_has() { - local i= local m= + local key= for i in build_compiler build_indexer build_shared has_path_standard path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_object search_shared version_major_prefix version_minor_prefix version_micro_prefix version_nano_prefix ; do - if [[ $(grep -s -o "^[[:space:]]*$i\>" $settings_file | sed -e "s|^[[:space:]]*||") ]] ; then - variables[$(bootstrap_id has-$i)]="yes" + + bootstrap_id "has-${i}" + + if [[ $(grep -s -o "^[[:space:]]*${i}\>" $settings_file | sed -e "s|^[[:space:]]*||") ]] ; then + variables[$key]="yes" else - variables[$(bootstrap_id has-$i)]="no" + variables[$key]="no" fi - done - for m in $modes ; do - for i in build_compiler build_indexer build_shared has_path_standard path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_object search_shared version_major_prefix version_minor_prefix version_micro_prefix version_nano_prefix ; do - if [[ $(grep -s -o "^[[:space:]]*$i-$m\>" $settings_file | sed -e "s|^[[:space:]]*||") ]] ; then - variables[$(bootstrap_id has-$i-mode)]="yes" + for m in $modes ; do + + bootstrap_id "has-${i}-mode" + + if [[ $(grep -s -o "^[[:space:]]*${i}-${m}\>" $settings_file | sed -e "s|^[[:space:]]*||") ]] ; then + variables[$key]="yes" else - variables[$(bootstrap_id has-$i-mode)]="no" + variables[$key]="no" fi done done } bootstrap_prepare_build() { - local -i failure=0 local alt=$1 local i= @@ -828,21 +858,26 @@ bootstrap_prepare_build() { if [[ $failure -eq 1 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Failed to create build directories in '$c_notice$path_build$c_errror'.$c_reset" + echo -e "${c_warning}WARNING: Failed to create build directories in '${c_notice}${path_build}${c_error}'.${c_reset}" fi return $failure fi - if [[ ${variables[$(bootstrap_id path_headers-mode)]} != "" ]] ; then - mkdir $verbose_common -p ${path_build}includes/${variables[$(bootstrap_id path_headers-mode)]} || failure=1 - elif [[ ${variables[$(bootstrap_id path_headers)]} != "" ]] ; then - mkdir $verbose_common -p ${path_build}includes/${variables[$(bootstrap_id path_headers)]} || failure=1 + bootstrap_id "path_headers-mode" + if [[ ${variables[$key]} != "" ]] ; then + mkdir $verbose_common -p ${path_build}includes/${variables[$key]} || failure=1 + else + bootstrap_id "path_headers" + + if [[ ${variables[$key]} != "" ]] ; then + mkdir $verbose_common -p ${path_build}includes/${variables[$key]} || failure=1 + fi fi if [[ $failure -eq 1 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Failed to create $c_noticepath_heades$c_error build directories in '$c_notice$path_build$c_errror'.$c_reset" + echo -e "${c_warning}WARNING: Failed to create ${c_notice}path_heades${c_error} build directories in '${c_notice}${path_build}${c_error}'.${c_reset}" fi return $failure @@ -852,7 +887,6 @@ bootstrap_prepare_build() { } bootstrap_operation_build() { - local -i failure=0 local i= local n= @@ -860,85 +894,238 @@ bootstrap_operation_build() { local version_target= local alt=$1 local directory= + local key= + + bootstrap_id "build_compiler" + local build_compiler=${variables[$key]} + + bootstrap_id "build_indexer" + local build_indexer=${variables[$key]} + + bootstrap_id "build_indexer_arguments" + local build_indexer_arguments=${variables[$key]} + + bootstrap_id "build_name" + local build_name=${variables[$key]} + + bootstrap_id "build_shared" + local build_shared=${variables[$key]} + + bootstrap_id "build_static" + local build_static=${variables[$key]} + + bootstrap_id "defines" + local defines=${variables[$key]} + + bootstrap_id "defines_library" + local defines_library=${variables[$key]} + + bootstrap_id "defines_library_shared" + local defines_library_shared=${variables[$key]} + + bootstrap_id "defines_library_static" + local defines_library_static=${variables[$key]} + + bootstrap_id "defines_object" + local defines_object=${variables[$key]} + + bootstrap_id "defines_object_shared" + local defines_object_shared=${variables[$key]} + + bootstrap_id "defines_object_static" + local defines_object_static=${variables[$key]} + + bootstrap_id "defines_program" + local defines_program=${variables[$key]} + + bootstrap_id "defines_program_shared" + local defines_program_shared=${variables[$key]} + + bootstrap_id "defines_program_static" + local defines_program_static=${variables[$key]} + + bootstrap_id "defines_shared" + local defines_shared=${variables[$key]} + + bootstrap_id "defines_static" + local defines_static=${variables[$key]} + + bootstrap_id "flags" + local flags=${variables[$key]} + + bootstrap_id "flags_library" + local flags_library=${variables[$key]} + + bootstrap_id "flags_library_shared" + local flags_library_shared=${variables[$key]} + + bootstrap_id "flags_library_static" + local flags_library_static=${variables[$key]} + + bootstrap_id "flags_object" + local flags_object=${variables[$key]} + + bootstrap_id "flags_object_shared" + local flags_object_shared=${variables[$key]} + + bootstrap_id "flags_object_static" + local flags_object_static=${variables[$key]} + + bootstrap_id "flags_program" + local flags_program=${variables[$key]} + + bootstrap_id "flags_program_shared" + local flags_program_shared=${variables[$key]} + + bootstrap_id "flags_program_static" + local flags_program_static=${variables[$key]} + + bootstrap_id "flags_shared" + local flags_shared=${variables[$key]} + + bootstrap_id "flags_static" + local flags_static=${variables[$key]} + + bootstrap_id "build_libraries" + local libraries=${variables[$key]} + + bootstrap_id "build_libraries_shared" + local libraries_shared=${variables[$key]} + + bootstrap_id "build_libraries_static" + local libraries_static=${variables[$key]} + + bootstrap_id "build_objects_library" + local objects_library=${variables[$key]} + + bootstrap_id "build_objects_library_shared" + local objects_library_shared=${variables[$key]} + + bootstrap_id "build_objects_library_static" + local objects_library_static=${variables[$key]} + + bootstrap_id "build_objects_program" + local objects_program=${variables[$key]} + + bootstrap_id "build_objects_program_shared" + local objects_program_shared=${variables[$key]} + + bootstrap_id "build_objects_program_static" + local objects_program_static=${variables[$key]} + + bootstrap_id "path_headers" + local path_headers=${variables[$key]} + + bootstrap_id "preserve_path_headers" + local preserve_path_headers=${variables[$key]} + + bootstrap_id "path_library_script" + local path_library_script=${variables[$key]} + + bootstrap_id "path_library_shared" + local path_library_shared=${variables[$key]} + + bootstrap_id "path_library_static" + local path_library_static=${variables[$key]} + + bootstrap_id "path_object_script" + local path_object_script=${variables[$key]} + + bootstrap_id "path_object_shared" + local path_object_shared=${variables[$key]} + + bootstrap_id "path_object_static" + local path_object_static=${variables[$key]} + + bootstrap_id "path_program_script" + local path_program_script=${variables[$key]} + + bootstrap_id "path_program_shared" + local path_program_shared=${variables[$key]} + + bootstrap_id "path_program_static" + local path_program_static=${variables[$key]} + + bootstrap_id "has_path_standard" + local has_path_standard=${variables[$key]} + + bootstrap_id "search_exclusive" + local search_exclusive=${variables[$key]} + + bootstrap_id "search_shared" + local search_shared=${variables[$key]} + + bootstrap_id "search_static" + local search_static=${variables[$key]} + + bootstrap_id "build_sources_headers" + local sources_headers=${variables[$key]} + + bootstrap_id "build_sources_library" + local sources_library=${variables[$key]} + + bootstrap_id "build_sources_library_shared" + local sources_library_shared=${variables[$key]} + + bootstrap_id "build_sources_library_static" + local sources_library_static=${variables[$key]} + + bootstrap_id "build_sources_object" + local sources_object=${variables[$key]} + + bootstrap_id "build_sources_object_shared" + local sources_object_shared=${variables[$key]} + + bootstrap_id "build_sources_object_static" + local sources_object_static=${variables[$key]} + + bootstrap_id "build_sources_program" + local sources_program=${variables[$key]} + + bootstrap_id "build_sources_program_shared" + local sources_program_shared=${variables[$key]} + + bootstrap_id "build_sources_program_static" + local sources_program_static=${variables[$key]} + + bootstrap_id "build_sources_script" + local sources_script=${variables[$key]} + + bootstrap_id "build_sources_setting" + local sources_setting=${variables[$key]} + + bootstrap_id "version_file" + local version_file_value=${variables[$key]} + + bootstrap_id "version_major" + local version_major=${variables[$key]} + + bootstrap_id "version_major_prefix" + local version_major_prefix=${variables[$key]} + + bootstrap_id "version_minor" + local version_minor=${variables[$key]} + + bootstrap_id "version_minor_prefix" + local version_minor_prefix=${variables[$key]} + + bootstrap_id "version_micro" + local version_micro=${variables[$key]} + + bootstrap_id "version_micro_prefix" + local version_micro_prefix=${variables[$key]} + + bootstrap_id "version_nano" + local version_nano=${variables[$key]} + + bootstrap_id "version_nano_prefix" + local version_nano_prefix=${variables[$key]} + + bootstrap_id "version_target" + local version_target_value=${variables[$key]} - local build_compiler=${variables[$(bootstrap_id build_compiler)]} - local build_indexer=${variables[$(bootstrap_id build_indexer)]} - local build_indexer_arguments=${variables[$(bootstrap_id build_indexer_arguments)]} - local build_name=${variables[$(bootstrap_id build_name)]} - local build_shared=${variables[$(bootstrap_id build_shared)]} - local build_static=${variables[$(bootstrap_id build_static)]} - local defines=${variables[$(bootstrap_id defines)]} - local defines_library=${variables[$(bootstrap_id defines_library)]} - local defines_library_shared=${variables[$(bootstrap_id defines_library_shared)]} - local defines_library_static=${variables[$(bootstrap_id defines_library_static)]} - local defines_object=${variables[$(bootstrap_id defines_object)]} - local defines_object_shared=${variables[$(bootstrap_id defines_object_shared)]} - local defines_object_static=${variables[$(bootstrap_id defines_object_static)]} - local defines_program=${variables[$(bootstrap_id defines_program)]} - local defines_program_shared=${variables[$(bootstrap_id defines_program_shared)]} - local defines_program_static=${variables[$(bootstrap_id defines_program_static)]} - local defines_shared=${variables[$(bootstrap_id defines_shared)]} - local defines_static=${variables[$(bootstrap_id defines_static)]} - local flags=${variables[$(bootstrap_id flags)]} - local flags_library=${variables[$(bootstrap_id flags_library)]} - local flags_library_shared=${variables[$(bootstrap_id flags_library_shared)]} - local flags_library_static=${variables[$(bootstrap_id flags_library_static)]} - local flags_object=${variables[$(bootstrap_id flags_object)]} - local flags_object_shared=${variables[$(bootstrap_id flags_object_shared)]} - local flags_object_static=${variables[$(bootstrap_id flags_object_static)]} - local flags_program=${variables[$(bootstrap_id flags_program)]} - local flags_program_shared=${variables[$(bootstrap_id flags_program_shared)]} - local flags_program_static=${variables[$(bootstrap_id flags_program_static)]} - local flags_shared=${variables[$(bootstrap_id flags_shared)]} - local flags_static=${variables[$(bootstrap_id flags_static)]} - local libraries=${variables[$(bootstrap_id build_libraries)]} - local libraries_shared=${variables[$(bootstrap_id build_libraries_shared)]} - local libraries_static=${variables[$(bootstrap_id build_libraries_static)]} local links= - local objects_library=${variables[$(bootstrap_id build_objects_library)]} - local objects_library_shared=${variables[$(bootstrap_id build_objects_library_shared)]} - local objects_library_static=${variables[$(bootstrap_id build_objects_library_static)]} - local objects_program=${variables[$(bootstrap_id build_objects_program)]} - local objects_program_shared=${variables[$(bootstrap_id build_objects_program_shared)]} - local objects_program_static=${variables[$(bootstrap_id build_objects_program_static)]} - local path_headers=${variables[$(bootstrap_id path_headers)]} - local preserve_path_headers=${variables[$(bootstrap_id preserve_path_headers)]} - local path_library_script=${variables[$(bootstrap_id path_library_script)]} - local path_library_shared=${variables[$(bootstrap_id path_library_shared)]} - local path_library_static=${variables[$(bootstrap_id path_library_static)]} - local path_object_script=${variables[$(bootstrap_id path_object_script)]} - local path_object_shared=${variables[$(bootstrap_id path_object_shared)]} - local path_object_static=${variables[$(bootstrap_id path_object_static)]} - local path_program_script=${variables[$(bootstrap_id path_program_script)]} - local path_program_shared=${variables[$(bootstrap_id path_program_shared)]} - local path_program_static=${variables[$(bootstrap_id path_program_static)]} - local has_path_standard=${variables[$(bootstrap_id has_path_standard)]} - local search_exclusive=${variables[$(bootstrap_id search_exclusive)]} - local search_shared=${variables[$(bootstrap_id search_shared)]} - local search_static=${variables[$(bootstrap_id search_static)]} - local sources_headers=${variables[$(bootstrap_id build_sources_headers)]} - local sources_library=${variables[$(bootstrap_id build_sources_library)]} - local sources_library_shared=${variables[$(bootstrap_id build_sources_library_shared)]} - local sources_library_static=${variables[$(bootstrap_id build_sources_library_static)]} - local sources_object=${variables[$(bootstrap_id build_sources_object)]} - local sources_object_shared=${variables[$(bootstrap_id build_sources_object_shared)]} - local sources_object_static=${variables[$(bootstrap_id build_sources_object_static)]} - local sources_program=${variables[$(bootstrap_id build_sources_program)]} - local sources_program_shared=${variables[$(bootstrap_id build_sources_program_shared)]} - local sources_program_static=${variables[$(bootstrap_id build_sources_program_static)]} - local sources_script=${variables[$(bootstrap_id build_sources_script)]} - local sources_setting=${variables[$(bootstrap_id build_sources_setting)]} local sources= - local version_file_value=${variables[$(bootstrap_id version_file)]} - local version_major=${variables[$(bootstrap_id version_major)]} - local version_major_prefix=${variables[$(bootstrap_id version_major_prefix)]} - local version_minor=${variables[$(bootstrap_id version_minor)]} - local version_minor_prefix=${variables[$(bootstrap_id version_minor_prefix)]} - local version_micro=${variables[$(bootstrap_id version_micro)]} - local version_micro_prefix=${variables[$(bootstrap_id version_micro_prefix)]} - local version_nano=${variables[$(bootstrap_id version_nano)]} - local version_nano_prefix=${variables[$(bootstrap_id version_nano_prefix)]} - local version_target_value=${variables[$(bootstrap_id version_target)]} bootstrap_operation_build_prepare_defaults @@ -966,20 +1153,20 @@ bootstrap_operation_build() { if [[ $build_shared == "yes" && -f ${project_built_shared}.built || $build_static == "yes" && -f ${project_built_static}.built ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: This project has already been built.$c_reset" + echo -e "${c_warning}WARNING: This project has already been built.${c_reset}" fi return 0 fi local arguments_include="-I${path_build}includes/" - local arguments_shared="-L${path_build}libraries/$path_library_shared" - local arguments_static="-L${path_build}libraries/$path_library_static" + local arguments_shared="-L${path_build}libraries/${path_library_shared}" + local arguments_static="-L${path_build}libraries/${path_library_static}" if [[ $path_work != "" ]] ; then arguments_include="$arguments_include -I${path_work}includes/" - arguments_shared="$arguments_shared -L${path_work}libraries/$path_library_shared" - arguments_static="$arguments_static -L${path_work}libraries/$path_library_static" + arguments_shared="$arguments_shared -L${path_work}libraries/${path_library_shared}" + arguments_static="$arguments_static -L${path_work}libraries/${path_library_static}" fi bootstrap_operation_build_validate_paths @@ -1001,12 +1188,12 @@ bootstrap_operation_build() { directory=$(dirname $i) if [[ $directory == "." ]] ; then - cp $verbose_common -R $path_settings$i ${path_build}settings/ || failure=1 + cp $verbose_common -R ${path_settings}${i} ${path_build}settings/ || failure=1 else - mkdir $verbose_common -p ${path_build}settings/$directory || failure=1 + mkdir $verbose_common -p ${path_build}settings/${directory} || failure=1 if [[ $failure -eq 0 ]] ; then - cp $verbose_common -R $path_settings$i ${path_build}settings/${directory}/ || failure=1 + cp $verbose_common -R ${path_settings}${i} ${path_build}settings/${directory}/ || failure=1 fi fi done @@ -1018,20 +1205,20 @@ bootstrap_operation_build() { directory=$(dirname $i) if [[ $directory == "." ]] ; then - cp $verbose_common -f $path_sources$path_language$i ${path_build}includes/$path_headers || failure=1 + cp $verbose_common -f ${path_sources}${path_language}${i} ${path_build}includes/${path_headers} || failure=1 else - if [[ ! -d ${path_build}includes/$path_headers$directory ]] ; then - mkdir $verbose_common -p ${path_build}includes/$path_headers$directory || failure=1 + if [[ ! -d ${path_build}includes/${path_headers}${directory} ]] ; then + mkdir $verbose_common -p ${path_build}includes/${path_headers}${directory} || failure=1 fi if [[ $failure -eq 0 ]] ; then - cp $verbose_common -f $path_sources$path_language$i ${path_build}includes/$path_headers$i || failure=1 + cp $verbose_common -f ${path_sources}${path_language}${i} ${path_build}includes/${path_headers}${i} || failure=1 fi fi done else for i in $sources_headers ; do - cp $verbose_common -f $path_sources$path_language$i ${path_build}includes/$path_headers || failure=1 + cp $verbose_common -f ${path_sources}${path_language}${i} ${path_build}includes/${path_headers} || failure=1 done fi fi @@ -1049,12 +1236,12 @@ bootstrap_operation_build() { if [[ $count -gt 1 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object_shared$c_warning' found, only using the first one found is going to be used.$c_reset" + echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object_shared${c_warning}' found, only using the first one found is going to be used.${c_reset}" fi fi for i in $sources_object_shared ; do - sources="$path_sources_object$path_language$i " + sources="${path_sources_object}${path_language}${i} " break done else @@ -1064,21 +1251,21 @@ bootstrap_operation_build() { if [[ $count -gt 1 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object$c_warning' found, only using the first one found is going to be used.$c_reset" + echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object${c_warning}' found, only using the first one found is going to be used.${c_reset}" fi fi for i in $sources_object ; do - sources="$path_sources_object$path_language$i " + sources="${path_sources_object}${path_language}${i} " break done fi if [[ $verbosity == "verbose" ]] ; then - echo $build_compiler $sources -c -o ${path_build}objects/$path_object_shared$build_name.o $arguments_shared $arguments_include $libraries $libraries_shared $flags $flags_shared $flags_object $flags_object_shared $defines $defines_shared $defines_object $defines_object_shared + echo $build_compiler $sources -c -o ${path_build}objects/${path_object_shared}${build_name}.o $arguments_shared $arguments_include $libraries $libraries_shared $flags $flags_shared $flags_object $flags_object_shared $defines $defines_shared $defines_object $defines_object_shared fi - $build_compiler $sources -c -o ${path_build}objects/$path_object_shared$build_name.o $arguments_shared $arguments_include $libraries $libraries_shared $flags $flags_shared $flags_object $flags_object_shared $defines $defines_shared $defines_object $defines_object_shared || failure=1 + $build_compiler $sources -c -o ${path_build}objects/${path_object_shared}${build_name}.o $arguments_shared $arguments_include $libraries $libraries_shared $flags $flags_shared $flags_object $flags_object_shared $defines $defines_shared $defines_object $defines_object_shared || failure=1 fi if [[ $sources_library != "" || $sources_library_shared != "" ]] ; then @@ -1086,35 +1273,35 @@ bootstrap_operation_build() { if [[ $objects_library != "" || $objects_library_shared != "" ]] ; then for i in $objects_library $objects_library_shared ; do - sources="$sources${path_build}objects/${path_object_shared}$i " + sources="${sources}${path_build}objects/${path_object_shared}${i} " done fi for i in $sources_library $sources_library_shared ; do - sources="$sources$path_sources$path_language$i " + sources="${sources}${path_sources}${path_language}${i} " done if [[ $verbosity == "verbose" ]] ; then - echo $build_compiler $sources -shared -Wl,-soname,lib$build_name.so$version_target -o ${path_build}libraries/${path_library_shared}lib$build_name.so$version_file $arguments_shared $arguments_include $libraries $libraries_shared $flags $flags_shared $flags_library $flags_library_shared $defines $defines_shared $defines_library $defines_library_shared + echo $build_compiler $sources -shared -Wl,-soname,lib${build_name}.so${version_target} -o ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_file} $arguments_shared $arguments_include $libraries $libraries_shared $flags $flags_shared $flags_library $flags_library_shared $defines $defines_shared $defines_library $defines_library_shared fi - $build_compiler $sources -shared -Wl,-soname,lib$build_name.so$version_target -o ${path_build}libraries/${path_library_shared}lib$build_name.so$version_file $arguments_shared $arguments_include $libraries $libraries_shared $flags $flags_shared $flags_library $flags_library_shared $defines $defines_shared $defines_library $defines_library_shared || failure=1 + $build_compiler $sources -shared -Wl,-soname,lib${build_name}.so${version_target} -o ${path_build}libraries/${path_library_shared}lib${build_name}.so$version_file $arguments_shared $arguments_include $libraries $libraries_shared $flags $flags_shared $flags_library $flags_library_shared $defines $defines_shared $defines_library $defines_library_shared || failure=1 if [[ $failure -eq 0 ]] ; then if [[ $version_file_value != "major" ]] ; then if [[ $version_file_value == "minor" ]] ; then - ln $verbose_common -sf lib$build_name.so$version_file ${path_build}libraries/${path_library_shared}lib$build_name.so$version_major_prefix$version_major || failure=1 + ln $verbose_common -sf lib${build_name}.so${version_file} ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_major_prefix}${version_major} || failure=1 else - ln $verbose_common -sf lib$build_name.so$version_major_prefix$version_major$version_minor_prefix$version_minor ${path_build}libraries/${path_library_shared}lib$build_name.so$version_major_prefix$version_major || failure=1 + ln $verbose_common -sf lib${build_name}.so${version_major_prefix}${version_major}${version_minor_prefix}${version_minor} ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_major_prefix}${version_major} || failure=1 if [[ $failure -eq 0 ]] ; then if [[ $version_file_value == "micro" ]] ; then ln $verbose_common -sf lib$build_name.so$version_file ${path_build}libraries/${path_library_shared}lib$build_name.so$version_major_prefix$version_major$version_minor_prefix$version_minor || failure=1 else - ln $verbose_common -sf lib$build_name.so$version_major_prefix$version_major$version_minor_prefix$version_minor$version_micro_prefix$version_micro ${path_build}libraries/${path_library_shared}lib$build_name.so$version_major_prefix$version_major$version_minor_prefix$version_minor || failure=1 + ln $verbose_common -sf lib${build_name}.so${version_major_prefix}${version_major}${version_minor_prefix}${version_minor}${version_micro_prefix}${version_micro} ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_major_prefix}${version_major}${version_minor_prefix}${version_minor} || failure=1 if [[ $failure -eq 0 ]] ; then - ln $verbose_common -sf lib$build_name.so$version_file ${path_build}libraries/${path_library_shared}lib$build_name.so$version_major_prefix$version_major$version_minor_prefix$version_minor_prefix$version_minor$version_micro_prefix$version_micro || failure=1 + ln $verbose_common -sf lib${build_name}.so${version_file} ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_major_prefix}${version_major}${version_minor_prefix}${version_minor_prefix}${version_minor}${version_micro_prefix}${version_micro} || failure=1 fi fi fi @@ -1122,7 +1309,7 @@ bootstrap_operation_build() { fi if [[ $failure -eq 0 ]] ; then - ln $verbose_common -sf lib$build_name.so$version_major_prefix$version_major ${path_build}libraries/${path_library_shared}lib$build_name.so || failure=1 + ln ${verbose_common} -sf lib${build_name}.so${version_major_prefix}${version_major} ${path_build}libraries/${path_library_shared}lib${build_name}.so || failure=1 fi fi fi @@ -1137,19 +1324,19 @@ bootstrap_operation_build() { if [[ $objects_program != "" || $objects_program_shared != "" ]] ; then for i in $objects_program $objects_program_shared ; do - sources="$sources${path_build}objects/${path_object_shared}$i " + sources="${sources}${path_build}objects/${path_object_shared}${i} " done fi for i in $sources_program $sources_program_shared ; do - sources="$sources$path_sources$path_language$i " + sources="${sources}${path_sources}${path_language}${i} " done if [[ $verbosity == "verbose" ]] ; then - echo $build_compiler $sources -o ${path_build}programs/${path_program_shared}$build_name $arguments_shared $arguments_include $links $libraries $libraries_shared $flags $flags_shared $flags_program $flags_program_shared $defines $defines_shared $defines_program $defines_program_shared + echo $build_compiler $sources -o ${path_build}programs/${path_program_shared}${build_name} $arguments_shared $arguments_include $links $libraries $libraries_shared $flags $flags_shared $flags_program $flags_program_shared $defines $defines_shared $defines_program $defines_program_shared fi - $build_compiler $sources -o ${path_build}programs/${path_program_shared}$build_name $arguments_shared $arguments_include $links $libraries $libraries_shared $flags $flags_shared $flags_program $flags_program_shared $defines $defines_shared $defines_program $defines_program_shared || failure=1 + $build_compiler $sources -o ${path_build}programs/${path_program_shared}${build_name} $arguments_shared $arguments_include $links $libraries $libraries_shared $flags $flags_shared $flags_program $flags_program_shared $defines $defines_shared $defines_program $defines_program_shared || failure=1 fi if [[ $failure -eq 0 ]] ; then @@ -1169,12 +1356,12 @@ bootstrap_operation_build() { if [[ $count -gt 1 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object_static$c_warning' found, only using the first one found is going to be used.$c_reset" + echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object_static${c_warning}' found, only using the first one found is going to be used.${c_reset}" fi fi for i in $sources_object_static ; do - sources="$path_sources_object$path_language$i " + sources="${path_sources_object}${path_language}${i} " break done else @@ -1184,21 +1371,21 @@ bootstrap_operation_build() { if [[ $count -gt 1 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object$c_warning' found, only using the first one found is going to be used.$c_reset" + echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object${c_warning}' found, only using the first one found is going to be used.${c_reset}" fi fi for i in $sources_object ; do - sources="$path_sources_object$path_language$i " + sources="${path_sources_object}${path_language}${i} " break done fi if [[ $verbosity == "verbose" ]] ; then - echo $build_compiler $sources -c -o ${path_build}objects/$path_object_static$build_name.o $arguments_static $arguments_include $libraries $libraries_static $flags $flags_static $flags_object $flags_object_static $defines $defines_static $defines_object $defines_object_static + echo $build_compiler $sources -c -o ${path_build}objects/${path_object_static}${build_name}.o $arguments_static $arguments_include $libraries $libraries_static $flags $flags_static $flags_object $flags_object_static $defines $defines_static $defines_object $defines_object_static fi - $build_compiler $sources -c -o ${path_build}objects/$path_object_static$build_name.o $arguments_static $arguments_include $libraries $libraries_static $flags $flags_static $flags_object $flags_object_static $defines $defines_static $defines_object $defines_object_static || failure=1 + $build_compiler $sources -c -o ${path_build}objects/${path_object_static}${build_name}.o $arguments_static $arguments_include $libraries $libraries_static $flags $flags_static $flags_object $flags_object_static $defines $defines_static $defines_object $defines_object_static || failure=1 fi if [[ $sources_library != "" || $sources_library_static != "" ]] ; then @@ -1206,7 +1393,7 @@ bootstrap_operation_build() { if [[ $objects_library != "" || $objects_library_static != "" ]] ; then for i in $objects_library $objects_library_static ; do - sources="$sources${path_build}objects/${path_object_static}$i " + sources="${sources}${path_build}objects/${path_object_static}${i} " done fi @@ -1214,8 +1401,8 @@ bootstrap_operation_build() { directory=$(dirname $i) n=$(basename $i | sed -e 's|\.c$||') - if [[ $directory != "." && ! -d ${path_build}objects/$directory ]] ; then - mkdir $verbose_common -p ${path_build}objects/$directory + if [[ $directory != "." && ! -d ${path_build}objects/${directory} ]] ; then + mkdir $verbose_common -p ${path_build}objects/${directory} if [[ $? -ne 0 ]] ; then let failure=1 @@ -1225,13 +1412,13 @@ bootstrap_operation_build() { fi # These are objects created by the static build step rather than objects created by the object build step. - sources="$sources${path_build}objects/$directory/$n.o " + sources="${sources}${path_build}objects/$directory/$n.o " if [[ $verbosity == "verbose" ]] ; then - echo $build_compiler $path_sources$path_language$i -c -static -o ${path_build}objects/$directory/$n.o $arguments_static $arguments_include $libraries $libraries_static $flags $flags_static $flags_library $flags_library_static $defines $defines_static $defines_library $defines_library_static + echo $build_compiler ${path_sources}${path_language}${i} -c -static -o ${path_build}objects/${directory}/${n}.o $arguments_static $arguments_include $libraries $libraries_static $flags $flags_static $flags_library $flags_library_static $defines $defines_static $defines_library $defines_library_static fi - $build_compiler $path_sources$path_language$i -c -static -o ${path_build}objects/$directory/$n.o $arguments_static $arguments_include $libraries $libraries_static $flags $flags_static $flags_library $flags_library_static $defines $defines_static $defines_library $defines_library_static || failure=1 + $build_compiler ${path_sources}${path_language}${i} -c -static -o ${path_build}objects/${directory}/${n}.o $arguments_static $arguments_include $libraries $libraries_static $flags $flags_static $flags_library $flags_library_static $defines $defines_static $defines_library $defines_library_static || failure=1 if [[ $failure -eq 1 ]] ; then break; @@ -1241,10 +1428,10 @@ bootstrap_operation_build() { if [[ $failure -eq 0 && ( $sources_library != "" || $sources_library_static != "" ) ]] ; then if [[ $verbosity == "verbose" ]] ; then - echo $build_indexer $build_indexer_arguments ${path_build}libraries/${path_library_static}lib$build_name.a $sources + echo $build_indexer $build_indexer_arguments ${path_build}libraries/${path_library_static}lib${build_name}.a $sources fi - $build_indexer $build_indexer_arguments ${path_build}libraries/${path_library_static}lib$build_name.a $sources || failure=1 + $build_indexer $build_indexer_arguments ${path_build}libraries/${path_library_static}lib${build_name}.a $sources || failure=1 fi fi @@ -1253,24 +1440,24 @@ bootstrap_operation_build() { links= if [[ $sources_library != "" || $sources_library_static != "" ]] ; then - links="-l$build_name " + links="-l${build_name} " fi if [[ $objects_program != "" || $objects_program_static != "" ]] ; then for i in $objects_program $objects_program_static ; do - sources="$sources${path_build}objects/${path_object_static}$i " + sources="${sources}${path_build}objects/${path_object_static}${i} " done fi for i in $sources_program $sources_program_static ; do - sources="$sources$path_sources$path_language$i " + sources="${sources}${path_sources}${path_language}${i} " done if [[ $verbosity == "verbose" ]] ; then - echo $build_compiler $sources -static -o ${path_build}programs/${path_program_static}$build_name $arguments_static $arguments_include $links $libraries $libraries_static $flags $flags_static $flags_program $flags_program_static $defines $defines_static $defines_program $defines_program_static + echo $build_compiler $sources -static -o ${path_build}programs/${path_program_static}${build_name} $arguments_static $arguments_include $links $libraries $libraries_static $flags $flags_static $flags_program $flags_program_static $defines $defines_static $defines_program $defines_program_static fi - $build_compiler $sources -static -o ${path_build}programs/${path_program_static}$build_name $arguments_static $arguments_include $links $libraries $libraries_static $flags $flags_static $flags_program $flags_program_static $defines $defines_static $defines_program $defines_program_static || failure=1 + $build_compiler $sources -static -o ${path_build}programs/${path_program_static}${build_name} $arguments_static $arguments_include $links $libraries $libraries_static $flags $flags_static $flags_program $flags_program_static $defines $defines_static $defines_program $defines_program_static || failure=1 fi if [[ $failure -eq 0 ]] ; then @@ -1280,7 +1467,7 @@ bootstrap_operation_build() { if [[ $failure -eq 1 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to build.$c_reset" + echo -e "${c_error}ERROR: Failed to build.${c_reset}" fi return 1 @@ -1288,178 +1475,215 @@ bootstrap_operation_build() { } bootstrap_operation_build_prepare_defaults() { + local key= - if [[ ${variables[$(bootstrap_id has-version_major_prefix)]} != "yes" ]] ; then + bootstrap_id "has-version_major_prefix" + if [[ ${variables[$key]} != "yes" ]] ; then version_major_prefix="." fi - if [[ ${variables[$(bootstrap_id has-version_minor_prefix)]} != "yes" ]] ; then + bootstrap_id "has-version_minor_prefix" + if [[ ${variables[$key]} != "yes" ]] ; then version_minor_prefix="." fi - if [[ ${variables[$(bootstrap_id has-version_micro_prefix)]} != "yes" ]] ; then + bootstrap_id "has-version_micro_prefix" + if [[ ${variables[$key]} != "yes" ]] ; then version_micro_prefix="." fi - if [[ ${variables[$(bootstrap_id has-version_nano_prefix)]} != "yes" ]] ; then + bootstrap_id "has-version_nano_prefix" + if [[ ${variables[$key]} != "yes" ]] ; then version_nano_prefix="." fi - if [[ ${variables[$(bootstrap_id has-build_compiler)]} != "yes" ]] ; then + bootstrap_id "has-build_compiler" + if [[ ${variables[$key]} != "yes" ]] ; then build_compiler="gcc" fi - if [[ ${variables[$(bootstrap_id has-build_indexer)]} != "yes" ]] ; then + bootstrap_id "has-build_indexer" + if [[ ${variables[$key]} != "yes" ]] ; then build_indexer="ar" fi - if [[ ${variables[$(bootstrap_id has-path_library_script)]} != "yes" ]] ; then + bootstrap_id "has-path_library_script" + if [[ ${variables[$key]} != "yes" ]] ; then path_library_script="script/" fi - if [[ ${variables[$(bootstrap_id has-path_library_shared)]} != "yes" ]] ; then + bootstrap_id "has-path_library_shared" + if [[ ${variables[$key]} != "yes" ]] ; then path_library_shared="shared/" fi - if [[ ${variables[$(bootstrap_id has-path_library_static)]} != "yes" ]] ; then + bootstrap_id "has-path_library_static" + if [[ ${variables[$key]} != "yes" ]] ; then path_library_static="static/" fi - if [[ ${variables[$(bootstrap_id has-path_object_script)]} != "yes" ]] ; then + bootstrap_id "has-path_object_script" + if [[ ${variables[$key]} != "yes" ]] ; then path_object_script="script/" fi - if [[ ${variables[$(bootstrap_id has-path_object_shared)]} != "yes" ]] ; then + bootstrap_id "has-path_object_shared" + if [[ ${variables[$key]} != "yes" ]] ; then path_object_shared="shared/" fi - if [[ ${variables[$(bootstrap_id has-path_object_static)]} != "yes" ]] ; then + bootstrap_id "has-path_object_static" + if [[ ${variables[$key]} != "yes" ]] ; then path_object_static="static/" fi - if [[ ${variables[$(bootstrap_id has-path_program_script)]} != "yes" ]] ; then + bootstrap_id "has-path_program_script" + if [[ ${variables[$key]} != "yes" ]] ; then path_program_script="script/" fi - if [[ ${variables[$(bootstrap_id has-path_program_shared)]} != "yes" ]] ; then + bootstrap_id "has-path_program_shared" + if [[ ${variables[$key]} != "yes" ]] ; then path_program_shared="shared/" fi - if [[ ${variables[$(bootstrap_id has-path_program_static)]} != "yes" ]] ; then + bootstrap_id "has-path_program_static" + if [[ ${variables[$key]} != "yes" ]] ; then path_program_static="static/" fi - if [[ ${variables[$(bootstrap_id has-path_sources)]} != "yes" ]] ; then + bootstrap_id "has-path_sources" + if [[ ${variables[$key]} != "yes" ]] ; then path_sources="sources/" fi - if [[ ${variables[$(bootstrap_id has-path_sources_object)]} != "yes" ]] ; then + bootstrap_id "has-path_sources_object" + if [[ ${variables[$key]} != "yes" ]] ; then path_sources_object="sources/" fi - if [[ ${variables[$(bootstrap_id has-has_path_standard)]} != "yes" ]] ; then + bootstrap_id "has-has_path_standard" + if [[ ${variables[$key]} != "yes" ]] ; then has_path_standard="yes" fi - if [[ ${variables[$(bootstrap_id has-search_shared)]} != "yes" ]] ; then + bootstrap_id "has-search_shared" + if [[ ${variables[$key]} != "yes" ]] ; then search_shared="yes" fi - if [[ ${variables[$(bootstrap_id has-build_shared)]} != "yes" ]] ; then + bootstrap_id "has-build_shared" + if [[ ${variables[$key]} != "yes" ]] ; then build_shared="yes" fi } bootstrap_operation_build_prepare_defines() { + local key= + bootstrap_id "defines-mode" if [[ $defines == "" ]] ; then - defines=${variables[$(bootstrap_id defines-mode)]} + defines=${variables[$key]} else - defines="$defines ${variables[$(bootstrap_id defines-mode)]}" + defines="$defines ${variables[$key]}" fi + bootstrap_id "defines_library-mode" if [[ $defines_library == "" ]] ; then - defines_library=${variables[$(bootstrap_id defines_library-mode)]} + defines_library=${variables[$key]} else - defines_library="$defines_library ${variables[$(bootstrap_id defines_library-mode)]}" + defines_library="$defines_library ${variables[$key]}" fi + bootstrap_id "defines_library_shared-mode" if [[ $defines_library_shared == "" ]] ; then - defines_library_shared=${variables[$(bootstrap_id defines_library_shared-mode)]} + defines_library_shared=${variables[$key]} else - defines_library_shared="$defines_library_shared ${variables[$(bootstrap_id defines_library_shared-mode)]}" + defines_library_shared="$defines_library_shared ${variables[$key]}" fi + bootstrap_id "defines_library_static-mode" if [[ $defines_library_static == "" ]] ; then - defines_library_static=${variables[$(bootstrap_id defines_library_static-mode)]} + defines_library_static=${variables[$key]} else - defines_library_static="$defines_library_static ${variables[$(bootstrap_id defines_library_static-mode)]}" + defines_library_static="$defines_library_static ${variables[$key]}" fi + bootstrap_id "defines_object_library-mode" if [[ $defines_object_library == "" ]] ; then - defines_object_library=${variables[$(bootstrap_id defines_object_library-mode)]} + defines_object_library=${variables[$key]} else - defines_object_library="$defines_object_library ${variables[$(bootstrap_id defines_object_library-mode)]}" + defines_object_library="$defines_object_library ${variables[$key]}" fi + bootstrap_id "defines_object_library_shared-mode" if [[ $defines_object_library_shared == "" ]] ; then - defines_object_library_shared=${variables[$(bootstrap_id defines_object_library_shared-mode)]} + defines_object_library_shared=${variables[$key]} else - defines_object_library_shared="$defines_object_library_shared ${variables[$(bootstrap_id defines_object_library_shared-mode)]}" + defines_object_library_shared="$defines_object_library_shared ${variables[$key]}" fi + bootstrap_id "defines_object_library_static-mode" if [[ $defines_object_library_static == "" ]] ; then - defines_object_library_static=${variables[$(bootstrap_id defines_object_library_static-mode)]} + defines_object_library_static=${variables[$key]} else - defines_object_library_static="$defines_object_library_static ${variables[$(bootstrap_id defines_object_library_static-mode)]}" + defines_object_library_static="$defines_object_library_static ${variables[$key]}" fi + bootstrap_id "defines_object_program-mode" if [[ $defines_object_program == "" ]] ; then - defines_object_program=${variables[$(bootstrap_id defines_object_program-mode)]} + defines_object_program=${variables[$key]} else - defines_object_program="$defines_object_program ${variables[$(bootstrap_id defines_object_program-mode)]}" + defines_object_program="$defines_object_program ${variables[$key]}" fi + bootstrap_id "defines_object_program_shared-mode" if [[ $defines_object_program_shared == "" ]] ; then - defines_object_program_shared=${variables[$(bootstrap_id defines_object_program_shared-mode)]} + defines_object_program_shared=${variables[$key]} else - defines_object_program_shared="$defines_object_program_shared ${variables[$(bootstrap_id defines_object_program_shared-mode)]}" + defines_object_program_shared="$defines_object_program_shared ${variables[$key]}" fi + bootstrap_id "defines_object_program_static-mode" if [[ $defines_object_program_static == "" ]] ; then - defines_object_program_static=${variables[$(bootstrap_id defines_object_program_static-mode)]} + defines_object_program_static=${variables[$key]} else - defines_object_program_static="$defines_object_program_static ${variables[$(bootstrap_id defines_object_program_static-mode)]}" + defines_object_program_static="$defines_object_program_static ${variables[$key]}" fi + bootstrap_id "defines_program-mode" if [[ $defines_program == "" ]] ; then - defines_program=${variables[$(bootstrap_id defines_program-mode)]} + defines_program=${variables[$key]} else - defines_program="$defines_program ${variables[$(bootstrap_id defines_program-mode)]}" + defines_program="$defines_program ${variables[$key]}" fi + bootstrap_id "defines_program_shared-mode" if [[ $defines_program_shared == "" ]] ; then - defines_program_shared=${variables[$(bootstrap_id defines_program_shared-mode)]} + defines_program_shared=${variables[$key]} else - defines_program_shared="$defines_program_shared ${variables[$(bootstrap_id defines_program_shared-mode)]}" + defines_program_shared="$defines_program_shared ${variables[$key]}" fi + bootstrap_id "defines_program_static-mode" if [[ $defines_program_static == "" ]] ; then - defines_program_static=${variables[$(bootstrap_id defines_program_static-mode)]} + defines_program_static=${variables[$key]} else - defines_program_static="$defines_program_static ${variables[$(bootstrap_id defines_program_static-mode)]}" + defines_program_static="$defines_program_static ${variables[$key]}" fi + bootstrap_id "defines_shared-mode" if [[ $defines_shared == "" ]] ; then - defines_shared=${variables[$(bootstrap_id defines_shared-mode)]} + defines_shared=${variables[$key]} else - defines_shared="$defines_shared ${variables[$(bootstrap_id defines_shared-mode)]}" + defines_shared="$defines_shared ${variables[$key]}" fi + bootstrap_id "defines_static-mode" if [[ $defines_static == "" ]] ; then - defines_static=${variables[$(bootstrap_id defines_static-mode)]} + defines_static=${variables[$key]} else - defines_static="$defines_static ${variables[$(bootstrap_id defines_static-mode)]}" + defines_static="$defines_static ${variables[$key]}" fi if [[ $defines_override != "" ]] ; then @@ -1474,138 +1698,164 @@ bootstrap_operation_build_prepare_defines() { } bootstrap_operation_build_prepare_flags() { + local key= + bootstrap_id "flags-mode" if [[ $flags == "" ]] ; then - flags=${variables[$(bootstrap_id flags-mode)]} + flags=${variables[$key]} else - flags="$flags ${variables[$(bootstrap_id flags-mode)]}" + flags="$flags ${variables[$key]}" fi + bootstrap_id "flags_library-mode" if [[ $flags_library == "" ]] ; then - flags_library=${variables[$(bootstrap_id flags_library-mode)]} + flags_library=${variables[$key]} else - flags_library="$flags_library ${variables[$(bootstrap_id flags_library-mode)]}" + flags_library="$flags_library ${variables[$key]}" fi + bootstrap_id "flags_library_shared-mode" if [[ $flags_library_shared == "" ]] ; then - flags_library_shared=${variables[$(bootstrap_id flags_library_shared-mode)]} + flags_library_shared=${variables[$key]} else - flags_library_shared="$flags_library_shared ${variables[$(bootstrap_id flags_library_shared-mode)]}" + flags_library_shared="$flags_library_shared ${variables[$key]}" fi + bootstrap_id "flags_library_static-mode" if [[ $flags_library_static == "" ]] ; then - flags_library_static=${variables[$(bootstrap_id flags_library_static-mode)]} + flags_library_static=${variables[$key]} else - flags_library_static="$flags_library_static ${variables[$(bootstrap_id flags_library_static-mode)]}" + flags_library_static="$flags_library_static ${variables[$key]}" fi + bootstrap_id "flags_object_library-mode" if [[ $flags_object_library == "" ]] ; then - flags_object_library=${variables[$(bootstrap_id flags_object_library-mode)]} + flags_object_library=${variables[$key]} else - flags_object_library="$flags_object_library ${variables[$(bootstrap_id flags_object_library-mode)]}" + flags_object_library="$flags_object_library ${variables[$key]}" fi + bootstrap_id "flags_object_library_shared-mode" if [[ $flags_object_library_shared == "" ]] ; then - flags_object_library_shared=${variables[$(bootstrap_id flags_object_library_shared-mode)]} + flags_object_library_shared=${variables[$key]} else - flags_object_library_shared="$flags_object_library_shared ${variables[$(bootstrap_id flags_object_library_shared-mode)]}" + flags_object_library_shared="$flags_object_library_shared ${variables[$key]}" fi + bootstrap_id "flags_object_library_static-mode" if [[ $flags_object_library_static == "" ]] ; then - flags_object_library_static=${variables[$(bootstrap_id flags_object_library_static-mode)]} + flags_object_library_static=${variables[$key]} else - flags_object_library_static="$flags_object_library_static ${variables[$(bootstrap_id flags_object_library_static-mode)]}" + flags_object_library_static="$flags_object_library_static ${variables[$key]}" fi + bootstrap_id "flags_object_program-mode" if [[ $flags_object_program == "" ]] ; then - flags_object_program=${variables[$(bootstrap_id flags_object_program-mode)]} + flags_object_program=${variables[$key]} else - flags_object_program="$flags_object_program ${variables[$(bootstrap_id flags_object_program-mode)]}" + flags_object_program="$flags_object_program ${variables[$key]}" fi + bootstrap_id "flags_object_program_shared-mode" if [[ $flags_object_program_shared == "" ]] ; then - flags_object_program_shared=${variables[$(bootstrap_id flags_object_program_shared-mode)]} + flags_object_program_shared=${variables[$key]} else - flags_object_program_shared="$flags_object_program_shared ${variables[$(bootstrap_id flags_object_program_shared-mode)]}" + flags_object_program_shared="$flags_object_program_shared ${variables[$key]}" fi + bootstrap_id "flags_object_program_static-mode" if [[ $flags_object_program_static == "" ]] ; then - flags_object_program_static=${variables[$(bootstrap_id flags_object_program_static-mode)]} + flags_object_program_static=${variables[$key]} else - flags_object_program_static="$flags_object_program_static ${variables[$(bootstrap_id flags_object_program_static-mode)]}" + flags_object_program_static="$flags_object_program_static ${variables[$key]}" fi + bootstrap_id "flags_program-mode" if [[ $flags_program == "" ]] ; then - flags_program=${variables[$(bootstrap_id flags_program-mode)]} + flags_program=${variables[$key]} else - flags_program="$flags_program ${variables[$(bootstrap_id flags_program-mode)]}" + flags_program="$flags_program ${variables[$key]}" fi + bootstrap_id "flags_program_shared-mode" if [[ $flags_program_shared == "" ]] ; then - flags_program_shared=${variables[$(bootstrap_id flags_program_shared-mode)]} + flags_program_shared=${variables[$key]} else - flags_program_shared="$flags_program_shared ${variables[$(bootstrap_id flags_program_shared-mode)]}" + flags_program_shared="$flags_program_shared ${variables[$key]}" fi + bootstrap_id "flags_program_static-mode" if [[ $flags_program_static == "" ]] ; then - flags_program_static=${variables[$(bootstrap_id flags_program_static-mode)]} + flags_program_static=${variables[$key]} else - flags_program_static="$flags_program_static ${variables[$(bootstrap_id flags_program_static-mode)]}" + flags_program_static="$flags_program_static ${variables[$key]}" fi + bootstrap_id "flags_shared-mode" if [[ $flags_shared == "" ]] ; then - flags_shared=${variables[$(bootstrap_id flags_shared-mode)]} + flags_shared=${variables[$key]} else - flags_shared="$flags_shared ${variables[$(bootstrap_id flags_shared-mode)]}" + flags_shared="$flags_shared ${variables[$key]}" fi + bootstrap_id "flags_static-mode" if [[ $flags_static == "" ]] ; then - flags_static=${variables[$(bootstrap_id flags_static-mode)]} + flags_static=${variables[$key]} else - flags_static="$flags_static ${variables[$(bootstrap_id flags_static-mode)]}" + flags_static="$flags_static ${variables[$key]}" fi } bootstrap_operation_build_prepare_headers() { + local key= + bootstrap_id "build_sources_headers-mode" if [[ $sources_headers == "" ]] ; then - sources_headers=${variables[$(bootstrap_id build_sources_headers-mode)]} + sources_headers=${variables[$key]} else - sources_headers="$sources_headers ${variables[$(bootstrap_id build_sources_headers-mode)]}" + sources_headers="$sources_headers ${variables[$key]}" fi if [[ $build_shared == "yes" ]] ; then + bootstrap_id "build_sources_headers_shared" if [[ $sources_headers == "" ]] ; then - sources_headers=${variables[$(bootstrap_id build_sources_headers_shared)]} + sources_headers=${variables[$key]} else - sources_headers="$sources_headers ${variables[$(bootstrap_id build_sources_headers_shared)]}" + sources_headers="$sources_headers ${variables[$key]}" fi + bootstrap_id "build_sources_headers_static" if [[ $sources_headers == "" ]] ; then - sources_headers=${variables[$(bootstrap_id build_sources_headers_static)]} + sources_headers=${variables[$key]} else - sources_headers="$sources_headers ${variables[$(bootstrap_id build_sources_headers_static)]}" + sources_headers="$sources_headers ${variables[$key]}" fi fi if [[ $build_static == "yes" ]] ; then + bootstrap_id "build_sources_headers_shared-mode" if [[ $sources_headers == "" ]] ; then - sources_headers=${variables[$(bootstrap_id build_sources_headers_shared-mode)]} + sources_headers=${variables[$key]} else - sources_headers="$sources_headers ${variables[$(bootstrap_id build_sources_headers_shared-mode)]}" + sources_headers="$sources_headers ${variables[$key]}" fi + bootstrap_id "build_sources_headers_static-mode" if [[ $sources_headers == "" ]] ; then - sources_headers=${variables[$(bootstrap_id build_sources_headers_static-mode)]} + sources_headers=${variables[$key]} else - sources_headers="$sources_headers ${variables[$(bootstrap_id build_sources_headers_static-mode)]}" + sources_headers="$sources_headers ${variables[$key]}" fi fi - if [[ ${variables[$(bootstrap_id path_headers-mode)]} != "" ]] ; then - path_headers=${variables[$(bootstrap_id path_headers-mode)]} - elif [[ ${variables[$(bootstrap_id path_headers)]} != "" ]] ; then - path_headers=${variables[$(bootstrap_id path_headers)]} + bootstrap_id "path_headers-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_headers=${variables[$key]} + else + bootstrap_id "path_headers" + if [[ ${variables[$key]} != "" ]] ; then + path_headers=${variables[$key]} + fi fi if [[ $path_headers != "" ]] ; then @@ -1614,102 +1864,124 @@ bootstrap_operation_build_prepare_headers() { } bootstrap_operation_build_prepare_libraries() { + local key= + bootstrap_id "build_libraries-mode" if [[ $libraries == "" ]] ; then - libraries=${variables[$(bootstrap_id build_libraries-mode)]} + libraries=${variables[$key]} else - libraries="${variables[$(bootstrap_id build_libraries-mode)]} $libraries" + libraries="${variables[$key]} $libraries" fi + bootstrap_id "build_libraries_shared-mode" if [[ $libraries_shared == "" ]] ; then - libraries_shared=${variables[$(bootstrap_id build_libraries_shared-mode)]} + libraries_shared=${variables[$key]} else - libraries_shared="${variables[$(bootstrap_id build_libraries_shared-mode)]} $libraries_shared" + libraries_shared="${variables[$key]} $libraries_shared" fi + bootstrap_id "build_libraries_static-mode" if [[ $libraries_static == "" ]] ; then - libraries_static=${variables[$(bootstrap_id build_libraries_static-mode)]} + libraries_static=${variables[$key]} else - libraries_static="${variables[$(bootstrap_id build_libraries_static-mode)]} $libraries_static" + libraries_static="${variables[$key]} $libraries_static" fi + bootstrap_id "build_sources_library-mode" if [[ $sources_library == "" ]] ; then - sources_library=${variables[$(bootstrap_id build_sources_library-mode)]} + sources_library=${variables[$key]} else - sources_library="$sources_library ${variables[$(bootstrap_id build_sources_library-mode)]}" + sources_library="$sources_library ${variables[$key]}" fi + bootstrap_id "build_sources_library_shared-mode" if [[ $sources_library_shared == "" ]] ; then - sources_library_shared=${variables[$(bootstrap_id build_sources_library_shared-mode)]} + sources_library_shared=${variables[$key]} else - sources_library_shared="$build_sources_library_shared ${variables[$(bootstrap_id build_sources_library_shared-mode)]}" + sources_library_shared="$build_sources_library_shared ${variables[$key]}" fi + bootstrap_id "build_sources_library_static-mode" if [[ $sources_library_static == "" ]] ; then - sources_library_static=${variables[$(bootstrap_id build_sources_library_static-mode)]} + sources_library_static=${variables[$key]} else - sources_library_static="$build_sources_library_static ${variables[$(bootstrap_id build_sources_library_static-mode)]}" + sources_library_static="$build_sources_library_static ${variables[$key]}" fi } bootstrap_operation_build_prepare_objects() { + local key= + bootstrap_id "build_objects_library-mode" if [[ $objects_library == "" ]] ; then - objects_library=${variables[$(bootstrap_id build_objects_library-mode)]} + objects_library=${variables[$key]} else - objects_library="${variables[$(bootstrap_id build_objects_library-mode)]} $objects_library" + objects_library="${variables[$key]} $objects_library" fi + bootstrap_id "build_objects_library_shared-mode" if [[ $objects_library_shared == "" ]] ; then - objects_library_shared=${variables[$(bootstrap_id build_objects_library_shared-mode)]} + objects_library_shared=${variables[$key]} else - objects_library_shared="${variables[$(bootstrap_id build_objects_library_shared-mode)]} $objects_library_shared" + objects_library_shared="${variables[$key]} $objects_library_shared" fi + bootstrap_id "build_objects_library_static-mode" if [[ $objects_library_static == "" ]] ; then - objects_library_static=${variables[$(bootstrap_id build_objects_library_static-mode)]} + objects_library_static=${variables[$key]} else - objects_library_static="${variables[$(bootstrap_id build_objects_library_static-mode)]} $objects_library_static" + objects_library_static="${variables[$key]} $objects_library_static" fi + bootstrap_id "build_objects_program-mode" if [[ $objects_program == "" ]] ; then - objects_program=${variables[$(bootstrap_id build_objects_program-mode)]} + objects_program=${variables[$key]} else - objects_program="${variables[$(bootstrap_id build_objects_program-mode)]} $objects_program" + objects_program="${variables[$key]} $objects_program" fi + bootstrap_id "build_objects_program_shared-mode" if [[ $objects_program_shared == "" ]] ; then - objects_program_shared=${variables[$(bootstrap_id build_objects_program_shared-mode)]} + objects_program_shared=${variables[$key]} else - objects_program_shared="${variables[$(bootstrap_id build_objects_program_shared-mode)]} $objects_program_shared" + objects_program_shared="${variables[$key]} $objects_program_shared" fi + bootstrap_id "build_objects_program_static-mode" if [[ $objects_program_static == "" ]] ; then - objects_program_static=${variables[$(bootstrap_id build_objects_program_static-mode)]} + objects_program_static=${variables[$key]} else - objects_program_static="${variables[$(bootstrap_id build_objects_program_static-mode)]} $objects_program_static" + objects_program_static="${variables[$key]} $objects_program_static" fi if [[ $sources_object == "" ]] ; then - sources_object=${variables[$(bootstrap_id build_sources_object-mode)]} + bootstrap_id "build_sources_object-mode" + sources_object=${variables[$key]} fi if [[ $sources_object_shared == "" ]] ; then - sources_object_shared=${variables[$(bootstrap_id build_sources_object_shared-mode)]} + bootstrap_id "build_sources_object_shared-mode" + sources_object_shared=${variables[$key]} fi if [[ $sources_object_static == "" ]] ; then - sources_object_static=${variables[$(bootstrap_id build_sources_object_static-mode)]} + bootstrap_id "build_sources_object_static-mode" + sources_object_static=${variables[$key]} fi } bootstrap_operation_build_prepare_paths() { + local key= if [[ $override_path_sources == "" ]] ; then - if [[ ${variables[$(bootstrap_id path_sources-mode)]} != "" ]] ; then - path_sources=${variables[$(bootstrap_id path_sources-mode)]} - elif [[ ${variables[$(bootstrap_id path_sources)]} != "" ]] ; then - path_sources=${variables[$(bootstrap_id path_sources)]} + bootstrap_id "path_sources-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_sources=${variables[$key]} + else + bootstrap_id "path_sources" + if [[ ${variables[$key]} != "" ]] ; then + path_sources=${variables[$key]} + fi fi fi @@ -1717,35 +1989,45 @@ bootstrap_operation_build_prepare_paths() { path_sources=$(echo $path_sources | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_sources_object-mode)]} != "" ]] ; then - path_sources_object=${variables[$(bootstrap_id path_sources_object-mode)]} - elif [[ ${variables[$(bootstrap_id path_sources_object)]} != "" ]] ; then - path_sources_object=${variables[$(bootstrap_id path_sources_object)]} + bootstrap_id "path_sources_object-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_sources_object=${variables[$key]} + else + bootstrap_id "path_sources_object" + if [[ ${variables[$key]} != "" ]] ; then + path_sources_object=${variables[$key]} + fi fi if [[ $path_sources_object != "" ]] ; then path_sources_object=$(echo $path_sources_object | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_headers-mode)]} != "" ]] ; then - path_headers=${variables[$(bootstrap_id path_headers-mode)]} + bootstrap_id "path_headers-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_headers=${variables[$key]} fi if [[ $path_headers != "" ]] ; then path_headers=$(echo $path_headers | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id has_path_standard-mode)]} != "" ]] ; then - has_path_standard=${variables[$(bootstrap_id has_path_standard-mode)]} + bootstrap_id "has_path_standard-mode" + if [[ ${variables[$key]} != "" ]] ; then + has_path_standard=${variables[$key]} fi if [[ $has_path_standard == "no" ]] ; then path_language= else - if [[ ${variables[$(bootstrap_id path_language-mode)]} != "" ]] ; then - path_language=${variables[$(bootstrap_id path_language-mode)]} - elif [[ ${variables[$(bootstrap_id path_language)]} != "" ]] ; then - path_language=${variables[$(bootstrap_id path_language)]} + bootstrap_id "path_language-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_language=${variables[$key]} + else + bootstrap_id "path_language" + if [[ ${variables[$key]} != "" ]] ; then + path_language=${variables[$key]} + fi fi if [[ $path_language != "" ]] ; then @@ -1753,112 +2035,126 @@ bootstrap_operation_build_prepare_paths() { fi fi - if [[ ${variables[$(bootstrap_id path_object_library-mode)]} != "" ]] ; then - path_object_library=${variables[$(bootstrap_id path_object_library-mode)]} + bootstrap_id "path_object_library-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_library=${variables[$key]} fi if [[ $path_object_library != "" ]] ; then path_object_library=$(echo $path_object_library | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_program-mode)]} != "" ]] ; then - path_object_program=${variables[$(bootstrap_id path_object_program-mode)]} + bootstrap_id "path_object_program-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_program=${variables[$key]} fi if [[ $path_object_program != "" ]] ; then path_object_program=$(echo $path_object_program | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_library_script-mode)]} != "" ]] ; then - path_library_script=${variables[$(bootstrap_id path_library_script-mode)]} + bootstrap_id "path_library_script-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_library_script=${variables[$key]} fi if [[ $path_library_script != "" ]] ; then path_library_script=$(echo $path_library_script | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_library_shared-mode)]} != "" ]] ; then - path_library_shared=${variables[$(bootstrap_id path_library_shared-mode)]} + bootstrap_id "path_library_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_library_shared=${variables[$key]} fi if [[ $path_library_shared != "" ]] ; then path_library_shared=$(echo $path_library_shared | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_library_static-mode)]} != "" ]] ; then - path_library_static=${variables[$(bootstrap_id path_library_static-mode)]} + bootstrap_id "path_library_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_library_static=${variables[$key]} fi if [[ $path_library_static != "" ]] ; then path_library_static=$(echo $path_library_static | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_library_script-mode)]} != "" ]] ; then - path_object_library_script=${variables[$(bootstrap_id path_object_library_script-mode)]} + bootstrap_id "path_object_library_script-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_library_script=${variables[$key]} fi if [[ $path_object_library_script != "" ]] ; then path_object_library_script=$(echo $path_object_library_script | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_library_shared-mode)]} != "" ]] ; then - path_object_library_shared=${variables[$(bootstrap_id path_object_library_shared-mode)]} + bootstrap_id "path_object_library_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_library_shared=${variables[$key]} fi if [[ $path_object_library_shared != "" ]] ; then path_object_library_shared=$(echo $path_object_library_shared | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_library_static-mode)]} != "" ]] ; then - path_object_library_static=${variables[$(bootstrap_id path_object_library_static-mode)]} + bootstrap_id "path_object_library_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_library_static=${variables[$key]} fi if [[ $path_object_library_static != "" ]] ; then path_object_library_static=$(echo $path_object_library_static | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_program_script-mode)]} != "" ]] ; then - path_object_program_script=${variables[$(bootstrap_id path_object_program_script-mode)]} + bootstrap_id "path_object_program_script-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_program_script=${variables[$key]} fi if [[ $path_object_program_script != "" ]] ; then path_object_program_script=$(echo $path_object_program_script | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_program_shared-mode)]} != "" ]] ; then - path_object_program_shared=${variables[$(bootstrap_id path_object_program_shared-mode)]} + bootstrap_id "path_object_program_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_program_shared=${variables[$key]} fi if [[ $path_object_program_shared != "" ]] ; then path_object_program_shared=$(echo $path_object_program_shared | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_program_static-mode)]} != "" ]] ; then - path_object_program_static=${variables[$(bootstrap_id path_object_program_static-mode)]} + bootstrap_id "path_object_program_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_program_static=${variables[$key]} fi if [[ $path_object_program_static != "" ]] ; then path_object_program_static=$(echo $path_object_program_static | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_script-mode)]} != "" ]] ; then - path_object_script=${variables[$(bootstrap_id path_object_script-mode)]} + bootstrap_id "path_object_script-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_script=${variables[$key]} fi if [[ $path_object_script != "" ]] ; then path_object_script=$(echo $path_object_script | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_shared-mode)]} != "" ]] ; then - path_object_shared=${variables[$(bootstrap_id path_object_shared-mode)]} + bootstrap_id "path_object_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_shared=${variables[$key]} fi if [[ $path_object_shared != "" ]] ; then path_object_shared=$(echo $path_object_shared | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_object_static-mode)]} != "" ]] ; then - path_object_static=${variables[$(bootstrap_id path_object_static-mode)]} + bootstrap_id "path_object_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_static=${variables[$key]} fi if [[ $path_object_static != "" ]] ; then @@ -1869,24 +2165,27 @@ bootstrap_operation_build_prepare_paths() { path_object_static=$(echo $path_object_static | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_program_script-mode)]} != "" ]] ; then - path_program_script=${variables[$(bootstrap_id path_program_script-mode)]} + bootstrap_id "path_program_script-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_program_script=${variables[$key]} fi if [[ $path_program_script != "" ]] ; then path_program_script=$(echo $path_program_script | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_program_shared-mode)]} != "" ]] ; then - path_program_shared=${variables[$(bootstrap_id path_program_shared-mode)]} + bootstrap_id "path_program_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_program_shared=${variables[$key]} fi if [[ $path_program_shared != "" ]] ; then path_program_shared=$(echo $path_program_shared | sed -e 's|//*|/|g' -e 's|/*$|/|') fi - if [[ ${variables[$(bootstrap_id path_program_static-mode)]} != "" ]] ; then - path_program_static=${variables[$(bootstrap_id path_program_static-mode)]} + bootstrap_id "path_program_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_program_static=${variables[$key]} fi if [[ $path_program_static != "" ]] ; then @@ -1899,154 +2198,191 @@ bootstrap_operation_build_prepare_paths() { } bootstrap_operation_build_prepare_programs() { + local key= + bootstrap_id "build_sources_program-mode" if [[ $sources_program == "" ]] ; then - sources_program=${variables[$(bootstrap_id build_sources_program-mode)]} + sources_program=${variables[$key]} else - sources_program="$sources_program ${variables[$(bootstrap_id build_sources_program-mode)]}" + sources_program="$sources_program ${variables[$key]}" fi + bootstrap_id "build_sources_program_shared-mode" if [[ $sources_program_shared == "" ]] ; then - sources_program_shared=${variables[$(bootstrap_id build_sources_program_shared-mode)]} + sources_program_shared=${variables[$key]} else - sources_program_shared="$sources_program_shared ${variables[$(bootstrap_id build_sources_program_shared-mode)]}" + sources_program_shared="$sources_program_shared ${variables[$key]}" fi + bootstrap_id "build_sources_program_static-mode" if [[ $sources_program_static == "" ]] ; then - sources_program_static=${variables[$(bootstrap_id build_sources_program_static-mode)]} + sources_program_static=${variables[$key]} else - sources_program_static="$sources_program_static ${variables[$(bootstrap_id build_sources_program_static-mode)]}" + sources_program_static="$sources_program_static ${variables[$key]}" fi } bootstrap_operation_build_prepare_remaining() { + local key= - if [[ ${variables[$(bootstrap_id build_name-mode)]} != "" ]] ; then - build_name=${variables[$(bootstrap_id build_name-mode)]} + bootstrap_id "build_name-mode" + if [[ ${variables[$key]} != "" ]] ; then + build_name=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id build_compiler-mode)]} != "" ]] ; then - build_compiler=${variables[$(bootstrap_id build_compiler-mode)]} + bootstrap_id "build_compiler-mode" + if [[ ${variables[$key]} != "" ]] ; then + build_compiler=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id build_indexer-mode)]} != "" ]] ; then - build_indexer=${variables[$(bootstrap_id build_indexer-mode)]} + bootstrap_id "build_indexer-mode" + if [[ ${variables[$key]} != "" ]] ; then + build_indexer=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id build_indexer_arguments-mode)]} != "" ]] ; then - build_indexer_arguments=${variables[$(bootstrap_id build_indexer_arguments)]} + bootstrap_id "build_indexer_arguments-mode" + if [[ ${variables[$key]} != "" ]] ; then + build_indexer_arguments=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id version_major-mode)]} != "" ]] ; then - version_major=${variables[$(bootstrap_id version_major)]} + bootstrap_id "version_major-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_major=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id version_major_prefix-mode)]} != "" ]] ; then - version_major_prefix=${variables[$(bootstrap_id version_major_prefix)]} + bootstrap_id "version_major_prefix-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_major_prefix=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id version_minor-mode)]} != "" ]] ; then - version_minor=${variables[$(bootstrap_id version_minor)]} + bootstrap_id "version_minor-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_minor=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id version_minor_prefix-mode)]} != "" ]] ; then - version_minor_prefix=${variables[$(bootstrap_id version_minor_prefix)]} + bootstrap_id "version_minor_prefix-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_minor_prefix=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id version_micro-mode)]} != "" ]] ; then - version_micro=${variables[$(bootstrap_id version_micro)]} + bootstrap_id "version_micro-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_micro=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id version_micro_prefix-mode)]} != "" ]] ; then - version_micro_prefix=${variables[$(bootstrap_id version_micro_prefix)]} + bootstrap_id "version_micro_prefix-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_micro_prefix=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id version_nano-mode)]} != "" ]] ; then - version_nano=${variables[$(bootstrap_id version_nano)]} + bootstrap_id "version_nano-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_nano=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id version_nano_prefix-mode)]} != "" ]] ; then - version_nano_prefix=${variables[$(bootstrap_id version_nano_prefix)]} + bootstrap_id "version_nano_prefix-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_nano_prefix=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_headers-mode)]} != "" ]] ; then - path_headers=${variables[$(bootstrap_id path_headers)]} + bootstrap_id "path_headers-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_headers=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id preserve_path_headers-mode)]} != "" ]] ; then - preserve_path_headers=${variables[$(bootstrap_id preserve_path_headers)]} + bootstrap_id "preserve_path_headers-mode" + if [[ ${variables[$key]} != "" ]] ; then + preserve_path_headers=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_library_script-mode)]} != "" ]] ; then - path_library_script=${variables[$(bootstrap_id path_library_script)]} + bootstrap_id "path_library_script-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_library_script=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_library_shared-mode)]} != "" ]] ; then - path_library_shared=${variables[$(bootstrap_id path_library_shared)]} + bootstrap_id "path_library_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_library_shared=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_library_static-mode)]} != "" ]] ; then - path_library_static=${variables[$(bootstrap_id path_library_static)]} + bootstrap_id "path_library_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_library_static=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_object_script-mode)]} != "" ]] ; then - path_object_script=${variables[$(bootstrap_id path_object_script)]} + bootstrap_id "path_object_script-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_script=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_object_shared-mode)]} != "" ]] ; then - path_object_shared=${variables[$(bootstrap_id path_object_shared)]} + bootstrap_id "path_object_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_shared=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_object_static-mode)]} != "" ]] ; then - path_object_static=${variables[$(bootstrap_id path_object_static)]} + bootstrap_id "path_object_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_object_static=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_program_script-mode)]} != "" ]] ; then - path_program_script=${variables[$(bootstrap_id path_program_script)]} + bootstrap_id "path_program_script-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_program_script=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_program_shared-mode)]} != "" ]] ; then - path_program_shared=${variables[$(bootstrap_id path_program_shared)]} + bootstrap_id "path_program_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_program_shared=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id path_program_static-mode)]} != "" ]] ; then - path_program_static=${variables[$(bootstrap_id path_program_static)]} + bootstrap_id "path_program_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + path_program_static=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id has_path_standard-mode)]} != "" ]] ; then - has_path_standard=${variables[$(bootstrap_id has_path_standard)]} + bootstrap_id "has_path_standard-mode" + if [[ ${variables[$key]} != "" ]] ; then + has_path_standard=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id search_exclusive-mode)]} != "" ]] ; then - search_exclusive=${variables[$(bootstrap_id search_exclusive)]} + bootstrap_id "search_exclusive-mode" + if [[ ${variables[$key]} != "" ]] ; then + search_exclusive=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id search_shared-mode)]} != "" ]] ; then - search_shared=${variables[$(bootstrap_id search_shared)]} + bootstrap_id "search_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + search_shared=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id search_static-mode)]} != "" ]] ; then - search_static=${variables[$(bootstrap_id search_static)]} + bootstrap_id "search_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + search_static=${variables[$key]} fi } bootstrap_operation_build_prepare_settings() { + local key= + bootstrap_id "build_sources_setting-mode" if [[ $sources_setting == "" ]] ; then - sources_setting=${variables[$(bootstrap_id build_sources_setting-mode)]} + sources_setting=${variables[$key]} else - sources_setting="$sources_setting ${variables[$(bootstrap_id build_sources_setting-mode)]}" + sources_setting="$sources_setting ${variables[$key]}" fi } bootstrap_operation_build_prepare_shared_static() { + local key= - if [[ ${variables[$(bootstrap_id build_shared-mode)]} != "" ]] ; then - build_shared=${variables[$(bootstrap_id build_shared-mode)]} + bootstrap_id "build_shared-mode" + if [[ ${variables[$key]} != "" ]] ; then + build_shared=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id build_static-mode)]} != "" ]] ; then - build_static=${variables[$(bootstrap_id build_static-mode)]} + bootstrap_id "build_static-mode" + if [[ ${variables[$key]} != "" ]] ; then + build_static=${variables[$key]} fi if [[ $enable_shared == "yes" ]] ; then @@ -2078,7 +2414,7 @@ bootstrap_operation_build_validate_build() { if [[ $build_compiler == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, no '${c_notice}build_compiler${c_error}' specified, such as '${c_notice}gcc${c_error}'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, no '${c_notice}build_compiler${c_error}' specified, such as '${c_notice}gcc${c_error}'.${c_reset}" fi let failure=1 @@ -2086,7 +2422,7 @@ bootstrap_operation_build_validate_build() { if [[ $build_indexer == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, no '${c_notice}build_indexer${c_error}' specified, such as '${c_notice}ar${c_error}'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, no '${c_notice}build_indexer${c_error}' specified, such as '${c_notice}ar${c_error}'.${c_reset}" fi let failure=1 @@ -2097,7 +2433,7 @@ bootstrap_operation_build_validate_paths() { if [[ $path_sources == "" || ! -d $path_sources ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The sources directory $c_notice$path_sources$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The sources directory ${c_notice}${path_sources}${c_error} is not a valid directory.${c_reset}" fi let failure=1 @@ -2105,7 +2441,7 @@ bootstrap_operation_build_validate_paths() { if [[ $failure -eq 0 && $path_sources_object != "" && ! -d $path_sources_object ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The sources object directory $c_notice$path_sources_object$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The sources object directory ${c_notice}${path_sources_object}${c_error} is not a valid directory.${c_reset}" fi let failure=1 @@ -2124,7 +2460,7 @@ bootstrap_operation_build_validate_shared_static() { if [[ $build_shared != "yes" && $build_static != "yes" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, either build_shared or build_static must be set to 'yes'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, either build_shared or build_static must be set to 'yes'.${c_reset}" fi let failure=1 @@ -2132,7 +2468,7 @@ bootstrap_operation_build_validate_shared_static() { if [[ $search_shared != "yes" && $search_static != "yes" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, either search_shared or search_static must be set to 'yes'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, either search_shared or search_static must be set to 'yes'.${c_reset}" fi let failure=1 @@ -2144,7 +2480,7 @@ bootstrap_operation_build_validate_sources() { for i in $sources_script ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_script path provided: '$i'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, invalid sources_script path provided: '${i}'.${c_reset}" fi let failure=1 @@ -2154,7 +2490,7 @@ bootstrap_operation_build_validate_sources() { for i in $sources_headers ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_headers path provided: '$i'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, invalid sources_headers path provided: '${i}'.${c_reset}" fi let failure=1 @@ -2164,7 +2500,7 @@ bootstrap_operation_build_validate_sources() { for i in $sources_library ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_library path provided: '$i'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, invalid sources_library path provided: '${i}'.${c_reset}" fi let failure=1 @@ -2174,7 +2510,7 @@ bootstrap_operation_build_validate_sources() { for i in $sources_library_object ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_library_object path provided: '$i'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, invalid sources_library_object path provided: '${i}'.${c_reset}" fi let failure=1 @@ -2184,7 +2520,7 @@ bootstrap_operation_build_validate_sources() { for i in $sources_program_object ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_program_object path provided: '$i'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, invalid sources_program_object path provided: '${i}'.${c_reset}" fi let failure=1 @@ -2194,7 +2530,7 @@ bootstrap_operation_build_validate_sources() { for i in $sources_program ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_program path provided: '$i'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, invalid sources_program path provided: '${i}'.${c_reset}" fi let failure=1 @@ -2204,7 +2540,7 @@ bootstrap_operation_build_validate_sources() { for i in $sources_setting ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_setting path provided: '$i'.$c_reset" + echo -e "${c_error}ERROR: Cannot Build, invalid sources_setting path provided: '${i}'.${c_reset}" fi let failure=1 @@ -2213,13 +2549,16 @@ bootstrap_operation_build_validate_sources() { } bootstrap_operation_build_prepare_versions() { + local key= - if [[ ${variables[$(bootstrap_id version_file-mode)]} != "" ]] ; then - version_file_value=${variables[$(bootstrap_id version_file-mode)]} + bootstrap_id "version_file-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_file_value=${variables[$key]} fi - if [[ ${variables[$(bootstrap_id version_target-mode)]} != "" ]] ; then - version_target_value=${variables[$(bootstrap_id version_target-mode)]} + bootstrap_id "version_target-mode" + if [[ ${variables[$key]} != "" ]] ; then + version_target_value=${variables[$key]} fi if [[ $version_file_value == "" ]] ; then diff --git a/build/scripts/install.sh b/build/scripts/install.sh index 8006e49..0dcda72 100644 --- a/build/scripts/install.sh +++ b/build/scripts/install.sh @@ -6,9 +6,19 @@ # This assumes the destination directories already exist and does not attempt to create them. # Ideally, the package manager of the system should be used, but this is provided as a guide or a fallback. # Settings files are not copied over, but a warning will be printed to inform the installer of their existence. +# # The dependencies of this script are: bash, grep, and sed. +# +# This script can also be run under zsh rather than bash by setting the environment variable SHELL_ENGINE to "zsh", such as: +# SHELL_ENGINE="zsh" zsh ./install.sh --help +# install_main() { + + if [[ $SHELL_ENGINE == "zsh" ]] ; then + emulate ksh + fi + local public_name="Simple FLL Project Install Script" local system_name=install local called_name=$(basename $0) @@ -20,6 +30,7 @@ install_main() { local i=0 local p= local t=0 + local key= local c_reset="\\033[0m" local c_title="\\033[1;33m" @@ -31,7 +42,7 @@ install_main() { local c_subtle="\\033[1;30m" local c_prefix="\\" - local variables= + local -A variables=() local settings_file=data/build/settings local operation= local operation_failure= @@ -71,7 +82,12 @@ install_main() { while [[ $i -lt $t ]] ; do let i=$i+1 - p=${!i} + + if [[ $SHELL_ENGINE == "zsh" ]] ; then + p=${(P)i} + else + p=${!i} + fi if [[ $grab_next == "" ]] ; then if [[ $p == "-h" || $p == "--help" ]] ; then @@ -193,7 +209,7 @@ install_main() { if [[ $operation_failure == "fail-unsupported" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The operation $c_notice$operation$c_error was not recognized.$c_reset" + echo -e "${c_error}ERROR: The operation ${c_notice}$operation${c_error} was not recognized.${c_reset}" fi install_cleanup @@ -203,7 +219,7 @@ install_main() { if [[ ! -d $path_build ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The build path $c_notice$path_build$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The build path ${c_notice}$path_build${c_error} is not a valid directory.${c_reset}" fi install_cleanup @@ -213,7 +229,7 @@ install_main() { if [[ $work == "" && $destination_prefix != "" && ! -d $destination_prefix ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The destination prefix $c_notice$destination_prefix$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The destination prefix ${c_notice}$destination_prefix${c_error} is not a valid directory.${c_reset}" fi install_cleanup @@ -269,7 +285,7 @@ install_main() { if [[ $work != "" && ! -d $work ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The work directory $c_notice$work$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The work directory ${c_notice}$work${c_error} is not a valid directory.${c_reset}" fi install_cleanup @@ -279,7 +295,7 @@ install_main() { if [[ $work == "" && ! -d $destination_programs ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The destination bindir $c_notice$destination_programs$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The destination bindir ${c_notice}$destination_programs${c_error} is not a valid directory.${c_reset}" fi install_cleanup @@ -289,7 +305,7 @@ install_main() { if [[ $work == "" && ! -d $destination_programs_static ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The destination (${c_notice}static$c_error) bindir $c_notice$destination_programs_static$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The destination (${c_notice}static${c_error}) bindir ${c_notice}$destination_programs_static${c_error} is not a valid directory.${c_reset}" fi install_cleanup @@ -299,7 +315,7 @@ install_main() { if [[ $work == "" && ! -d $destination_programs_shared ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The destination (${c_notice}shared$c_error) bindir $c_notice$destination_programs_shared$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The destination (${c_notice}shared${c_error}) bindir ${c_notice}$destination_programs_shared${c_error} is not a valid directory.${c_reset}" fi install_cleanup @@ -309,7 +325,7 @@ install_main() { if [[ $work == "" && ! -d $destination_includes ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The destination incluedir $c_notice$destination_includes$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The destination incluedir ${c_notice}$destination_includes${c_error} is not a valid directory.${c_reset}" fi install_cleanup @@ -319,7 +335,7 @@ install_main() { if [[ $work == "" && ! -d $destination_libraries_static ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The destination (${c_notice}static$c_error) libdir $c_notice$destination_libraries_static$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The destination (${c_notice}static${c_error}) libdir ${c_notice}$destination_libraries_static${c_error} is not a valid directory.${c_reset}" fi install_cleanup @@ -329,7 +345,7 @@ install_main() { if [[ $work == "" && ! -d $destination_libraries_shared ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The destination (${c_notice}shared$c_error) libdir $c_notice$destination_libraries_shared$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The destination (${c_notice}shared${c_error}) libdir ${c_notice}$destination_libraries_shared${c_error} is not a valid directory.${c_reset}" fi install_cleanup @@ -371,32 +387,32 @@ install_handle_colors() { install_help() { echo - echo -e "${c_title}$public_name$c_reset" - echo -e " ${c_notice}Version $version$c_reset" + echo -e "${c_title}${public_name}${c_reset}" + echo -e " ${c_notice}Version ${version}${c_reset}" echo - echo -e "$c_highlight$system_name$c_reset $c_notice[${c_reset} options $c_notice]$c_reset" + echo -e "${c_highlight}${system_name}${c_reset} ${c_notice}[${c_reset} options ${c_notice}]${c_reset}" echo - echo -e "${c_highlight}Options:$c_reset" - echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." - echo -e " +${c_important}d$c_reset, ++${c_important}dark$c_reset Use color modes that show up better on dark backgrounds." - echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." - echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." - echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity, silencing most output." - echo -e " +${c_important}N$c_reset, ++${c_important}normal$c_reset Set verbosity to normal." - echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." - echo -e " +${c_important}D$c_reset, ++${c_important}debug$c_reset Enable debugging, significantly increasing verbosity beyond normal output." - echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." + echo -e "${c_highlight}Options:${c_reset}" + echo -e " -${c_important}h${c_reset}, --${c_important}help${c_reset} Print this help screen." + echo -e " +${c_important}d${c_reset}, ++${c_important}dark${c_reset} Use color modes that show up better on dark backgrounds." + echo -e " +${c_important}l${c_reset}, ++${c_important}light${c_reset} Use color modes that show up better on light backgrounds." + echo -e " +${c_important}n${c_reset}, ++${c_important}no_color${c_reset} Do not use color." + echo -e " +${c_important}q${c_reset}, ++${c_important}quiet${c_reset} Decrease verbosity, silencing most output." + echo -e " +${c_important}N${c_reset}, ++${c_important}normal${c_reset} Set verbosity to normal." + echo -e " +${c_important}V${c_reset}, ++${c_important}verbose${c_reset} Increase verbosity beyond normal output." + echo -e " +${c_important}D${c_reset}, ++${c_important}debug${c_reset} Enable debugging, significantly increasing verbosity beyond normal output." + echo -e " +${c_important}v${c_reset}, ++${c_important}version${c_reset} Print the version number of this program." echo - echo -e "${c_highlight}Install Options:$c_reset" - echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset} Custom build directory." - echo -e " -${c_important}s$c_reset, --${c_important}settings${c_reset} Custom build settings file." - echo -e " -${c_important}P$c_reset, --${c_important}prefix${c_reset} Custom destination prefix." - echo -e " -${c_important}B$c_reset, --${c_important}bindir${c_reset} Custom destination bin/ directory." - echo -e " -${c_important}I$c_reset, --${c_important}includedir${c_reset} Custom destination include/ directory." - echo -e " -${c_important}L$c_reset, --${c_important}libdir${c_reset} Custom destination lib/ directory." - echo -e " -${c_important}w$c_reset, --${c_important}work${c_reset} Install to this directory instead of system." + echo -e "${c_highlight}Install Options:${c_reset}" + echo -e " -${c_important}b${c_reset}, --${c_important}build${c_reset} Custom build directory." + echo -e " -${c_important}s${c_reset}, --${c_important}settings${c_reset} Custom build settings file." + echo -e " -${c_important}P${c_reset}, --${c_important}prefix${c_reset} Custom destination prefix." + echo -e " -${c_important}B${c_reset}, --${c_important}bindir${c_reset} Custom destination bin/ directory." + echo -e " -${c_important}I${c_reset}, --${c_important}includedir${c_reset} Custom destination include/ directory." + echo -e " -${c_important}L${c_reset}, --${c_important}libdir${c_reset} Custom destination lib/ directory." + echo -e " -${c_important}w${c_reset}, --${c_important}work${c_reset} Install to this directory instead of system." echo - echo -e "${c_highlight}Special Options:$c_reset" + echo -e "${c_highlight}Special Options:${c_reset}" echo -e " --${c_important}enable-shared${c_reset} Forcibly do install shared files." echo -e " --${c_important}disable-shared${c_reset} Forcibly do not install shared files." echo -e " --${c_important}disable-shared-programs${c_reset} Forcibly do not install shared programs." @@ -418,28 +434,29 @@ install_id() { local name=$1 case $name in - "build_sources_library") echo -n 1;; - "build_sources_program") echo -n 2;; - "build_sources_headers") echo -n 3;; - "build_sources_setting") echo -n 4;; - "build_shared") echo -n 5;; - "build_static") echo -n 6;; + "build_sources_library") let key=1;; + "build_sources_program") let key=2;; + "build_sources_headers") let key=3;; + "build_sources_setting") let key=4;; + "build_shared") let key=5;; + "build_static") let key=6;; esac } install_load_settings() { local failure= local i= + local key= if [[ $settings_file == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: No settings file has been defined.$c_reset" + echo -e "${c_error}ERROR: No settings file has been defined.${c_reset}" fi failure=1 elif [[ ! -f $settings_file ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: No settings file $c_notice$settings_file$c_error could not be found or is not a valid file.$c_reset" + echo -e "${c_error}ERROR: No settings file ${c_notice}${settings_file}${c_error} could not be found or is not a valid file.${c_reset}" fi failure=1 @@ -451,17 +468,34 @@ install_load_settings() { fi for i in build_sources_library build_sources_program build_sources_headers build_sources_setting build_shared build_static ; do - variables[$(install_id $i)]=$(grep -s -o "^[[:space:]]*$i\>.*$" $settings_file | sed -e "s|^[[:space:]]*$i\>||" -e 's|^[[:space:]]*||') + + install_id "$i" + + variables[$key]=$(grep -s -o "^[[:space:]]*${i}\>.*$" $settings_file | sed -e "s|^[[:space:]]*${i}\>||" -e 's|^[[:space:]]*||') done } install_perform_install() { - local build_sources_library=${variables[$(install_id build_sources_library)]} - local build_sources_program=${variables[$(install_id build_sources_program)]} - local build_sources_headers=${variables[$(install_id build_sources_headers)]} - local build_sources_setting=${variables[$(install_id build_sources_setting)]} - local build_shared=${variables[$(install_id build_shared)]} - local build_static=${variables[$(install_id build_static)]} + local key= + + install_id "build_sources_library" + local build_sources_library=${variables[$key]} + + install_id "build_sources_program" + local build_sources_program=${variables[$key]} + + install_id "build_sources_headers" + local build_sources_headers=${variables[$key]} + + install_id "build_sources_setting" + local build_sources_setting=${variables[$key]} + + install_id "build_shared" + local build_shared=${variables[$key]} + + install_id "build_static" + local build_static=${variables[$key]} + local failure= if [[ $build_shared == "yes" ]] ; then @@ -567,7 +601,7 @@ install_perform_install() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create work directories $c_notice${work}programs$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create work directories ${c_notice}${work}programs${c_error}.${c_reset}" fi failure=1 @@ -579,7 +613,7 @@ install_perform_install() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create work directories $c_notice${work}programs/shared$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create work directories ${c_notice}${work}programs/shared${c_error}.${c_reset}" fi failure=1 @@ -591,7 +625,7 @@ install_perform_install() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create work directories $c_notice${work}programs/static$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create work directories ${c_notice}${work}programs/static${c_error}.${c_reset}" fi failure=1 @@ -605,7 +639,7 @@ install_perform_install() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create work directories $c_notice${work}libraries$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create work directories ${c_notice}${work}libraries${c_error}.${c_reset}" fi failure=1 @@ -617,7 +651,7 @@ install_perform_install() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create work directories $c_notice${work}libraries/shared$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create work directories ${c_notice}${work}libraries/shared${c_error}.${c_reset}" fi failure=1 @@ -629,7 +663,7 @@ install_perform_install() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create work directories $c_notice${work}libraries/static$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create work directories ${c_notice}${work}libraries/static${c_error}.${c_reset}" fi failure=1 @@ -643,7 +677,7 @@ install_perform_install() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create work directories $c_notice${work}includes$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create work directories ${c_notice}${work}includes${c_error}.${c_reset}" fi failure=1 @@ -666,14 +700,14 @@ install_perform_install() { if [[ $failure == "" && $build_sources_headers != "" && $enable_includes == "yes" ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Installing Includes to: $c_reset$c_notice$destination_includes$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Installing Includes to: ${c_reset}${c_notice}${destination_includes}${c_reset}${c_highlight}.${c_reset}" fi cp $verbose_common -R $path_build${path_includes}* $destination_includes if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy include files from $c_notice$path_build$path_includes$c_error to $c_notice$destination_includes$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy include files from ${c_notice}${path_build}${path_includes}${c_error} to ${c_notice}${destination_includes}${c_error}.${c_reset}" fi failure=1 @@ -684,14 +718,14 @@ install_perform_install() { if [[ $enable_static_libraries == "yes" ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Installing (${c_notice}static$c_highlight) Libraries to: $c_reset$c_notice$destination_libraries_static$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Installing (${c_notice}static${c_highlight}) Libraries to: ${c_reset}${c_notice}${destination_libraries_static}${c_reset}${c_highlight}.${c_reset}" fi - cp $verbose_common -R $path_build$path_libraries${path_static}* $destination_libraries_static + cp $verbose_common -R ${path_build}${path_libraries}${path_static}* $destination_libraries_static if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy (${c_notice}static$c_error) library files from $c_notice$path_build$path_libraries$path_static$c_error to $c_notice$destination_libraries_static$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy (${c_notice}static${c_error}) library files from ${c_notice}${path_build}${path_libraries}${path_static}${c_error} to ${c_notice}${destination_libraries_static}${c_error}.${c_reset}" fi failure=1 @@ -701,14 +735,14 @@ install_perform_install() { if [[ $failure == "" && $build_sources_library != "" && $enable_shared_libraries == "yes" ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Installing (${c_notice}shared$c_highlight) Libraries to: $c_reset$c_notice$destination_libraries_shared$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Installing (${c_notice}shared${c_highlight}) Libraries to: ${c_reset}${c_notice}${destination_libraries_shared}${c_reset}${c_highlight}.${c_reset}" fi - cp $verbose_common -R $path_build$path_libraries${path_shared}* $destination_libraries_shared + cp $verbose_common -R ${path_build}${path_libraries}${path_shared}* $destination_libraries_shared if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy (${c_notice}shared$c_error) library files from $c_notice$path_build$path_libraries$path_shared$c_error to $c_notice$destination_libraries_shared$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy (${c_notice}shared${c_error}) library files from ${c_notice}${path_build}${path_libraries}${path_shared}${c_error} to ${c_notice}${destination_libraries_shared}${c_error}.${c_reset}" fi failure=1 @@ -720,14 +754,14 @@ install_perform_install() { if [[ $enable_static_programs == "yes" ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Installing (${c_notice}static$c_highlight) Programs to: $c_reset$c_notice$destination_programs_static$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Installing (${c_notice}static${c_highlight}) Programs to: ${c_reset}${c_notice}${destination_programs_static}${c_reset}${c_highlight}.${c_reset}" fi - cp $verbose_common -R $path_build$path_programs${path_static}* $destination_programs_static + cp $verbose_common -R ${path_build}${path_programs}${path_static}* $destination_programs_static if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: failed to copy (${c_notice}static$c_error) program files from $c_notice$path_build$path_programs$path_static$c_error to $c_notice$destination_programs_static$c_error.$c_reset" + echo -e "${c_error}ERROR: failed to copy (${c_notice}static${c_error}) program files from ${c_notice}${path_build}${path_programs}${path_static}${c_error} to ${c_notice}${destination_programs_static}${c_error}.${c_reset}" fi failure=1 @@ -737,14 +771,14 @@ install_perform_install() { if [[ $failure == "" && $build_sources_program != "" && $enable_shared_programs == "yes" ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Installing (${c_notice}shared$c_highlight) Programs to: $c_reset$c_notice$destination_programs_shared$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Installing (${c_notice}shared${c_highlight}) Programs to: ${c_reset}${c_notice}${destination_programs_shared}${c_reset}${c_highlight}.${c_reset}" fi - cp $verbose_common -R $path_build$path_programs${path_shared}* $destination_programs_shared + cp $verbose_common -R ${path_build}${path_programs}${path_shared}* $destination_programs_shared if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: failed to copy (${c_notice}shared$c_error) program files from $c_notice$path_build$path_programs$path_shared$c_error to $c_notice$destination_programs_shared$c_error.$c_reset" + echo -e "${c_error}ERROR: failed to copy (${c_notice}shared${c_error}) program files from ${c_notice}${path_build}${path_programs}${path_shared}${c_error} to ${c_notice}${destination_programs_shared}${c_error}.${c_reset}" fi failure=1 @@ -754,7 +788,7 @@ install_perform_install() { if [[ $failure == "" && $build_sources_setting != "" && $verbosity != "quiet" ]] ; then echo - echo -e "${c_warning}Settings Files Detected, see: $c_reset$c_notice$path_build$path_settings$c_reset${c_warning}.$c_reset" + echo -e "${c_warning}Settings Files Detected, see: ${c_reset}${c_notice}${path_build}${path_settings}${c_reset}${c_warning}.${c_reset}" fi if [[ $failure != "" ]] ; then diff --git a/build/scripts/package.sh b/build/scripts/package.sh index 93896ec..097e89a 100644 --- a/build/scripts/package.sh +++ b/build/scripts/package.sh @@ -4,9 +4,19 @@ # # The purpose of this script is to create releases from the project source. # These release directories can then be used to compile the project or to package the project. +# # The dependencies of this script are: basename, bash, chmod, grep, sed, and sort. +# +# This script can also be run under zsh rather than bash by setting the environment variable SHELL_ENGINE to "zsh", such as: +# SHELL_ENGINE="zsh" zsh ./package.sh --help +# package_main() { + + if [[ $SHELL_ENGINE == "zsh" ]] ; then + emulate ksh + fi + local public_name="Simple FLL Project Package Script" local system_name=package local called_name=$(basename $0) @@ -29,7 +39,7 @@ package_main() { local c_subtle="\\033[1;30m" local c_prefix="\\" - local variables= + local -A variables=() local operation= local operation_failure= local mode_individual= @@ -50,7 +60,12 @@ package_main() { while [[ $i -lt $t ]] ; do let i=$i+1 - p=${!i} + + if [[ $SHELL_ENGINE == "zsh" ]] ; then + p=${(P)i} + else + p=${!i} + fi if [[ $grab_next == "" ]] ; then if [[ $p == "-h" || $p == "--help" ]] ; then @@ -134,7 +149,7 @@ package_main() { if [[ $operation_failure == "fail-multiple" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Only one operation may be specified at a time.$c_reset" + echo -e "${c_error}ERROR: Only one operation may be specified at a time.${c_reset}" fi package_cleanup @@ -147,7 +162,7 @@ package_main() { if [[ ! -f build/stand_alone/$i.settings ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Unknown or unsupported stand alone program '$c_notice$i$c_error'.$c_reset" + echo -e "${c_error}ERROR: Unknown or unsupported stand alone program '${c_notice}$i${c_error}'.${c_reset}" fi package_cleanup @@ -160,7 +175,7 @@ package_main() { if [[ $operation == "build" || $operation == "rebuild" ]] ; then if [[ ! -d $path_build ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Build directory '$c_notice$path_build$c_error' is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Build directory '${c_notice}$path_build${c_error}' is invalid or missing.${c_reset}" fi package_cleanup @@ -172,7 +187,7 @@ package_main() { mkdir $verbose_common -p $path_destination if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Package directory '$c_notice$path_destination$c_error' is invalid or could not be created.$c_reset" + echo -e "${c_error}ERROR: Package directory '${c_notice}$path_destination${c_error}' is invalid or could not be created.${c_reset}" fi package_cleanup @@ -183,7 +198,7 @@ package_main() { if [[ ! -d $path_sources ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Sources directory '$c_notice$path_sources$c_error' is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Sources directory '${c_notice}$path_sources${c_error}' is invalid or missing.${c_reset}" fi package_cleanup @@ -193,7 +208,7 @@ package_main() { if [[ ! -d ${path_sources}level_0/ ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Build sources directory '$c_notice${path_sources}level_0/$c_error' is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Build sources directory '${c_notice}${path_sources}level_0/${c_error}' is invalid or missing.${c_reset}" fi package_cleanup @@ -203,7 +218,7 @@ package_main() { if [[ ! -d ${path_sources}level_1/ ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Build sources directory '$c_notice${path_sources}level_1/$c_error' is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Build sources directory '${c_notice}${path_sources}level_1/${c_error}' is invalid or missing.${c_reset}" fi package_cleanup @@ -213,7 +228,7 @@ package_main() { if [[ ! -d ${path_sources}level_2/ ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Build sources directory '$c_notice${path_sources}level_2/$c_error' is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Build sources directory '${c_notice}${path_sources}level_2/${c_error}' is invalid or missing.${c_reset}" fi package_cleanup @@ -223,7 +238,7 @@ package_main() { if [[ ! -d ${path_sources}level_3/ ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Build sources directory '$c_notice${path_sources}level_3/$c_error' is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Build sources directory '${c_notice}${path_sources}level_3/${c_error}' is invalid or missing.${c_reset}" fi package_cleanup @@ -265,7 +280,7 @@ package_main() { elif [[ $operation == "dependencies" ]] ; then if [[ ! -d $path_sources ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Sources directory '$c_notice$path_sources$c_error' is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Sources directory '${c_notice}${path_sources}${c_error}' is invalid or missing.${c_reset}" fi package_cleanup @@ -277,7 +292,7 @@ package_main() { elif [[ $operation == "clean" ]] ; then if [[ ! -d $path_destination ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Package directory '$c_notice$path_destination$c_error' does not exist, there is nothing to clean.$c_reset" + echo -e "${c_warning}WARNING: Package directory '${c_notice}${path_destination}${c_error}' does not exist, there is nothing to clean.${c_reset}" fi package_cleanup @@ -288,7 +303,7 @@ package_main() { package_operation_clean elif [[ $operation == "" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: No operation was given.$c_reset" + echo -e "${c_error}ERROR: No operation was given.${c_reset}" fi package_cleanup @@ -296,7 +311,7 @@ package_main() { return 1 else if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The operation $c_notice$operation$c_error was not recognized.$c_reset" + echo -e "${c_error}ERROR: The operation ${c_notice}${operation}${c_error} was not recognized.${c_reset}" fi package_cleanup @@ -339,35 +354,35 @@ package_handle_colors() { package_help() { echo - echo -e "${c_title}$public_name$c_reset" - echo -e " ${c_notice}Version $version$c_reset" + echo -e "${c_title}${public_name}${c_reset}" + echo -e " ${c_notice}Version ${version}${c_reset}" echo - echo -e "$c_highlight$system_name$c_reset $c_notice[${c_reset} options $c_notice]$c_reset $c_notice[${c_reset} operation $c_notice]$c_reset" + echo -e "${c_highlight}${system_name}${c_reset} ${c_notice}[${c_reset} options ${c_notice}]${c_reset} ${c_notice}[${c_reset} operation ${c_notice}]${c_reset}" echo -e " ${c_important}build${c_reset} Build the package." echo -e " ${c_important}clean${c_reset} Delete all built packages." echo -e " ${c_important}dependencies${c_reset} Rebuild all dependencies." echo -e " ${c_important}rebuild${c_reset} Delete all built packages then build the package." echo - echo -e "${c_highlight}Options:$c_reset" - echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." - echo -e " +${c_important}d$c_reset, ++${c_important}dark$c_reset Use color modes that show up better on dark backgrounds." - echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." - echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." - echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity, silencing most output." - echo -e " +${c_important}N$c_reset, ++${c_important}normal$c_reset Set verbosity to normal." - echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." - echo -e " +${c_important}D$c_reset, ++${c_important}debug$c_reset Enable debugging, significantly increasing verbosity beyond normal output." - echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." + echo -e "${c_highlight}Options:${c_reset}" + echo -e " -${c_important}h${c_reset}, --${c_important}help${c_reset} Print this help screen." + echo -e " +${c_important}d${c_reset}, ++${c_important}dark${c_reset} Use color modes that show up better on dark backgrounds." + echo -e " +${c_important}l${c_reset}, ++${c_important}light${c_reset} Use color modes that show up better on light backgrounds." + echo -e " +${c_important}n${c_reset}, ++${c_important}no_color${c_reset} Do not use color." + echo -e " +${c_important}q${c_reset}, ++${c_important}quiet${c_reset} Decrease verbosity, silencing most output." + echo -e " +${c_important}N${c_reset}, ++${c_important}normal${c_reset} Set verbosity to normal." + echo -e " +${c_important}V${c_reset}, ++${c_important}verbose${c_reset} Increase verbosity beyond normal output." + echo -e " +${c_important}D${c_reset}, ++${c_important}debug${c_reset} Enable debugging, significantly increasing verbosity beyond normal output." + echo -e " +${c_important}v${c_reset}, ++${c_important}version${c_reset} Print the version number of this program." echo - echo -e "${c_highlight}Package Options:$c_reset" - echo -e " -${c_important}d$c_reset, --${c_important}destination${c_reset} Specify a custom package destination directory." - echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset} Specify a custom build directory." - echo -e " -${c_important}i$c_reset, --${c_important}individual${c_reset} Build packages by individual package (levels 0. 1. and 2)." - echo -e " -${c_important}l$c_reset, --${c_important}level${c_reset} Build packages by level (levels 0. 1. and 2)." - echo -e " -${c_important}m$c_reset, --${c_important}monolithic${c_reset} Build a monolithic package (levels 0. 1. and 2)." - echo -e " -${c_important}p$c_reset, --${c_important}program${c_reset} Build program packages (level 3)." - echo -e " -${c_important}s$c_reset, --${c_important}sources${c_reset} Specify a custom sources directory." - echo -e " -${c_important}S$c_reset, --${c_important}stand_alone${c_reset} Build a specified program package as stand alone." + echo -e "${c_highlight}Package Options:${c_reset}" + echo -e " -${c_important}d${c_reset}, --${c_important}destination${c_reset} Specify a custom package destination directory." + echo -e " -${c_important}b${c_reset}, --${c_important}build${c_reset} Specify a custom build directory." + echo -e " -${c_important}i${c_reset}, --${c_important}individual${c_reset} Build packages by individual package (levels 0. 1. and 2)." + echo -e " -${c_important}l${c_reset}, --${c_important}level${c_reset} Build packages by level (levels 0. 1. and 2)." + echo -e " -${c_important}m${c_reset}, --${c_important}monolithic${c_reset} Build a monolithic package (levels 0. 1. and 2)." + echo -e " -${c_important}p${c_reset}, --${c_important}program${c_reset} Build program packages (level 3)." + echo -e " -${c_important}s${c_reset}, --${c_important}sources${c_reset} Specify a custom sources directory." + echo -e " -${c_important}S${c_reset}, --${c_important}stand_alone${c_reset} Build a specified program package as stand alone." echo } @@ -378,7 +393,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -387,7 +402,7 @@ package_create_base_files() { if [[ $failure == "" && ! -d ${path_build}documents ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The build directory $c_notice${path_build}documents$c_error cannot be found or is invalid.$c_reset" + echo -e "${c_error}ERROR: The build directory ${c_notice}${path_build}documents${c_error} cannot be found or is invalid.${c_reset}" fi let failure=1 @@ -398,7 +413,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy directory $c_notice${path_build}documents$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy directory ${c_notice}${path_build}documents${c_error} to ${c_notice}$package${c_error}.${c_reset}" fi let failure=1 @@ -411,7 +426,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy directory $c_notice${path_build}licenses$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy directory ${c_notice}${path_build}licenses${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -421,14 +436,14 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy directory $c_notice${path_build}../licenses$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy directory ${c_notice}${path_build}../licenses${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 fi else if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Neither directory $c_notice${path_build}licenses$c_error nor $c_notice${path_build}../licenses$c_error can be found or are invalid.$c_reset" + echo -e "${c_error}ERROR: Neither directory ${c_notice}${path_build}licenses${c_error} nor ${c_notice}${path_build}../licenses${c_error} can be found or are invalid.${c_reset}" fi let failure=1 @@ -440,7 +455,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy script $c_notice${path_build}bootstrap.sh$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy script ${c_notice}${path_build}bootstrap.sh${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -451,7 +466,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to set executable permissions on script $c_notice${package}bootstrap.sh$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to set executable permissions on script ${c_notice}${package}bootstrap.sh${c_error}.${c_reset}" fi let failure=1 @@ -463,7 +478,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy script $c_notice${path_build}install.sh$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy script ${c_notice}${path_build}install.sh${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -475,7 +490,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to set executable permissions on script $c_notice${package}install.sh$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to set executable permissions on script ${c_notice}${package}install.sh${c_error}.${c_reset}" fi let failure=1 @@ -488,7 +503,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}build$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}build${c_error}.${c_reset}" fi let failure=1 @@ -500,7 +515,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}sources$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}sources${c_error}.${c_reset}" fi let failure=1 @@ -512,7 +527,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}documents$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}documents${c_error}.${c_reset}" fi let failure=1 @@ -524,7 +539,7 @@ package_create_base_files() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}licenses$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}licenses${c_error}.${c_reset}" fi let failure=1 @@ -568,12 +583,12 @@ package_dependencies_individual() { if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Building Dependencies for $c_reset$c_notice${name}$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Building Dependencies for ${c_reset}${c_notice}${name}${c_reset}${c_highlight}.${c_reset}" fi if [[ ! -f ${directory}/data/build/dependencies ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot build dependencies, failed to find $c_notice${directory}/data/build/dependencies$c_error.$c_reset" + echo -e "${c_error}ERROR: Cannot build dependencies, failed to find ${c_notice}${directory}/data/build/dependencies${c_error}.${c_reset}" fi let failure=1 @@ -583,7 +598,7 @@ package_dependencies_individual() { if [[ ! -f ${directory}/data/build/settings ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Cannot build dependencies for $c_reset$c_notice${name}$c_reset${c_error}, failed to find $c_notice${directory}/data/build/settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Cannot build dependencies for ${c_reset}${c_notice}${name}${c_reset}${c_error}, failed to find ${c_notice}${directory}/data/build/settings${c_error}.${c_reset}" fi let failure=1 @@ -617,7 +632,7 @@ package_dependencies_individual() { level=level_2 else if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Failed to detect level for dependency $c_notice$dependency$c_warning.$c_reset" + echo -e "${c_warning}WARNING: Failed to detect level for dependency ${c_notice}${dependency}${c_warning}.${c_reset}" fi continue @@ -625,7 +640,7 @@ package_dependencies_individual() { if [[ ! -d ${path_sources}${level}/${dependency}/data/build/ ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to find dependency data directory $c_notice${path_sources}${level}/${dependency}/data/build/$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to find dependency data directory ${c_notice}${path_sources}${level}/${dependency}/data/build/${c_error}.${c_reset}" fi let failure=1 @@ -646,7 +661,7 @@ package_dependencies_individual() { sub_level=level_1 else if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Failed to detect level for sub-dependency $c_notice$sub_dependency$c_warning.$c_reset" + echo -e "${c_warning}WARNING: Failed to detect level for sub-dependency ${c_notice}${sub_dependency}${c_warning}.${c_reset}" fi continue @@ -654,7 +669,7 @@ package_dependencies_individual() { if [[ ! -d ${path_sources}${sub_level}/${sub_dependency}/data/build/ ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to find dependency data directory $c_notice${path_sources}${sub_level}/${sub_dependency}/data/build/$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to find dependency data directory ${c_notice}${path_sources}${sub_level}/${sub_dependency}/data/build/${c_error}.${c_reset}" fi let failure=1 @@ -673,7 +688,7 @@ package_dependencies_individual() { sub_sub_level=level_0 else if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_warning}WARNING: Failed to detect level for sub-sub-dependency $c_notice$sub_sub_dependency$c_warning.$c_reset" + echo -e "${c_warning}WARNING: Failed to detect level for sub-sub-dependency ${c_notice}$sub_sub_dependency${c_warning}.${c_reset}" fi continue @@ -718,12 +733,12 @@ package_dependencies_individual() { fi settings=${directory}/data/build/settings - sed -i -e "s|^\s*build_libraries-individual[[:space:]].*\$|build_libraries-individual$dependencies_individual|" $settings && - sed -i -e "s|^\s*build_libraries-individual\$|build_libraries-individual$dependencies_individual|" $settings + sed -i -e "s|^\s*build_libraries-individual[[:space:]].*\$|build_libraries-individual${dependencies_individual}|" $settings && + sed -i -e "s|^\s*build_libraries-individual\$|build_libraries-individual${dependencies_individual}|" $settings if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to update settings file $c_notice${settings}$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to update settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -739,12 +754,12 @@ package_dependencies_individual() { fi settings=${directory}/data/build/settings - sed -i -e "s|^\s*build_libraries-individual_threadless[[:space:]].*\$|build_libraries-individual_threadless$dependencies_individual_threadless|" $settings && - sed -i -e "s|^\s*build_libraries-individual_threadless\$|build_libraries-individual_threadless$dependencies_individual_threadless|" $settings + sed -i -e "s|^\s*build_libraries-individual_threadless[[:space:]].*\$|build_libraries-individual_threadless${dependencies_individual_threadless}|" $settings && + sed -i -e "s|^\s*build_libraries-individual_threadless\$|build_libraries-individual_threadless${dependencies_individual_threadless}|" $settings if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to update settings file $c_notice${settings}$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to update settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -760,7 +775,7 @@ package_dependencies_individual() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to update settings file $c_notice${settings}$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to update settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -773,7 +788,7 @@ package_dependencies_individual() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to update settings file $c_notice${settings}$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to update settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -793,7 +808,7 @@ package_dependencies_individual_append() { settings=${path_sources}${level}/${dependency}/data/build/settings if [[ ! -f $settings ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to find dependency settings file $c_notice$settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to find dependency settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -887,17 +902,17 @@ package_dependencies_level_update() { if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Building Dependencies: $c_notice$level${c_highlight}.$c_reset" + echo -e "${c_highlight}Building Dependencies: ${c_notice}${level}${c_highlight}.${c_reset}" fi for directory in $path_sources${level}/* ; do - name="$(echo $directory | sed -e "s|$path_sources${level}/||")" + name="$(echo $directory | sed -e "s|${path_sources}${level}/||")" settings=${directory}/data/build/settings if [[ ! -f $settings ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to find settings file $c_notice$settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to find settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -911,10 +926,10 @@ package_dependencies_level_update() { if [[ $name == "f_thread" ]] ; then level_sources_library_threaded="$level_sources_library_threaded $library" - monolithic_libraries_threaded="$monolithic_libraries_threaded $level/$library" + monolithic_libraries_threaded="$monolithic_libraries_threaded ${level}/${library}" else level_sources_library="$level_sources_library $library" - monolithic_libraries="$monolithic_libraries $level/$library" + monolithic_libraries="$monolithic_libraries ${level}/${library}" fi done @@ -924,10 +939,10 @@ package_dependencies_level_update() { if [[ $name == "f_thread" ]] ; then level_sources_headers_threaded="$level_sources_headers_threaded $header" - monolithic_headers_threaded="$monolithic_headers_threaded $level/$header" + monolithic_headers_threaded="$monolithic_headers_threaded ${level}/${header}" else level_sources_headers="$level_sources_headers $header" - monolithic_headers="$monolithic_headers $level/$header" + monolithic_headers="$monolithic_headers ${level}/${header}" fi done done @@ -936,7 +951,7 @@ package_dependencies_level_update() { if [[ ! -f $settings ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to find settings file $c_notice$settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to find settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -944,14 +959,14 @@ package_dependencies_level_update() { return fi - sed -i -e "s|^\s*build_libraries-level\s.*\$|build_libraries-level$level_libraries|" $settings && - sed -i -e "s|^\s*build_libraries-level\$|build_libraries-level$level_libraries|" $settings && - sed -i -e "s|^\s*build_libraries-level_threadless\s.*\$|build_libraries-level_threadless$level_libraries|" $settings && - sed -i -e "s|^\s*build_libraries-level_threadless\$|build_libraries-level_threadless$level_libraries|" $settings + sed -i -e "s|^\s*build_libraries-level\s.*\$|build_libraries-level${level_libraries}|" $settings && + sed -i -e "s|^\s*build_libraries-level\$|build_libraries-level${level_libraries}|" $settings && + sed -i -e "s|^\s*build_libraries-level_threadless\s.*\$|build_libraries-level_threadless${level_libraries}|" $settings && + sed -i -e "s|^\s*build_libraries-level_threadless\$|build_libraries-level_threadless${level_libraries}|" $settings if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to update libraries for settings file $c_notice$settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to update libraries for settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -965,14 +980,14 @@ package_dependencies_level_update() { level_sources_library=" $level_sources_library" fi - sed -i -e "s|^\s*build_sources_library\s.*\$|build_sources_library$level_sources_library|" $settings && - sed -i -e "s|^\s*build_sources_library\$|build_sources_library$level_sources_library|" $settings && - sed -i -e "s|^\s*build_sources_library-level\s.*\$|build_sources_library-level$level_sources_library_threaded|" $settings && - sed -i -e "s|^\s*build_sources_library-level\$|build_sources_library-level$level_sources_library_threaded|" $settings + sed -i -e "s|^\s*build_sources_library\s.*\$|build_sources_library${level_sources_library}|" $settings && + sed -i -e "s|^\s*build_sources_library\$|build_sources_library${level_sources_library}|" $settings && + sed -i -e "s|^\s*build_sources_library-level\s.*\$|build_sources_library-level${level_sources_library_threaded}|" $settings && + sed -i -e "s|^\s*build_sources_library-level\$|build_sources_library-level${level_sources_library_threaded}|" $settings if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to update libraries for settings file $c_notice$settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to update libraries for settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -986,14 +1001,14 @@ package_dependencies_level_update() { level_sources_headers=" $level_sources_headers" fi - sed -i -e "s|^\s*build_sources_headers\s.*\$|build_sources_headers$level_sources_headers|" $settings && - sed -i -e "s|^\s*build_sources_headers\$|build_sources_headers$level_sources_headers|" $settings && - sed -i -e "s|^\s*build_sources_headers-level\s.*\$|build_sources_headers-level$level_sources_headers_threaded|" $settings && - sed -i -e "s|^\s*build_sources_headers-level\$|build_sources_headers-level$level_sources_headers_threaded|" $settings + sed -i -e "s|^\s*build_sources_headers\s.*\$|build_sources_headers${level_sources_headers}|" $settings && + sed -i -e "s|^\s*build_sources_headers\$|build_sources_headers${level_sources_headers}|" $settings && + sed -i -e "s|^\s*build_sources_headers-level\s.*\$|build_sources_headers-level${level_sources_headers_threaded}|" $settings && + sed -i -e "s|^\s*build_sources_headers-level\$|build_sources_headers-level${level_sources_headers_threaded}|" $settings if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to update headers for settings file $c_notice$settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to update headers for settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -1030,7 +1045,7 @@ package_dependencies_monolithic() { if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Building Dependencies: ${c_notice}monolithic${c_highlight}.$c_reset" + echo -e "${c_highlight}Building Dependencies: ${c_notice}monolithic${c_highlight}.${c_reset}" fi if [[ $level_0_libraries != "" ]] ; then @@ -1131,14 +1146,14 @@ package_dependencies_monolithic() { monolithic_libraries_threaded=" $monolithic_libraries_threaded" fi - sed -i -e "s|^\s*build_sources_library\s.*\$|build_sources_library$monolithic_libraries|" $settings && - sed -i -e "s|^\s*build_sources_library\$|build_sources_library$monolithic_libraries|" $settings && - sed -i -e "s|^\s*build_sources_library-monolithic\s.*\$|build_sources_library-monolithic$monolithic_libraries_threaded|" $settings && - sed -i -e "s|^\s*build_sources_library-monolithic\$|build_sources_library-monolithic$monolithic_libraries_threaded|" $settings + sed -i -e "s|^\s*build_sources_library\s.*\$|build_sources_library${monolithic_libraries}|" $settings && + sed -i -e "s|^\s*build_sources_library\$|build_sources_library${monolithic_libraries}|" $settings && + sed -i -e "s|^\s*build_sources_library-monolithic\s.*\$|build_sources_library-monolithic${monolithic_libraries_threaded}|" $settings && + sed -i -e "s|^\s*build_sources_library-monolithic\$|build_sources_library-monolithic${monolithic_libraries_threaded}|" $settings if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to update libraries for settings file $c_notice$settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to update libraries for settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -1162,14 +1177,14 @@ package_dependencies_monolithic() { monolithic_headers_threaded=" $monolithic_headers_threaded" fi - sed -i -e "s|^\s*build_sources_headers\s.*\$|build_sources_headers$monolithic_headers|" $settings && - sed -i -e "s|^\s*build_sources_headers\$|build_sources_headers$monolithic_headers|" $settings && - sed -i -e "s|^\s*build_sources_headers-monolithic\s.*\$|build_sources_headers-monolithic$monolithic_headers_threaded|" $settings && - sed -i -e "s|^\s*build_sources_headers-monolithic\$|build_sources_headers-monolithic$monolithic_headers_threaded|" $settings + sed -i -e "s|^\s*build_sources_headers\s.*\$|build_sources_headers${monolithic_headers}|" $settings && + sed -i -e "s|^\s*build_sources_headers\$|build_sources_headers${monolithic_headers}|" $settings && + sed -i -e "s|^\s*build_sources_headers-monolithic\s.*\$|build_sources_headers-monolithic${monolithic_headers_threaded}|" $settings && + sed -i -e "s|^\s*build_sources_headers-monolithic\$|build_sources_headers-monolithic${monolithic_headers_threaded}|" $settings if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to update headers for settings file $c_notice$settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to update headers for settings file ${c_notice}${settings}${c_error}.${c_reset}" fi let failure=1 @@ -1254,8 +1269,8 @@ package_operation_clean() { for i in $mode_stand_alone ; do - if [[ -d ${path_destination}stand_alone/$i-$version/ ]] ; then - rm $verbose_common -Rf ${path_destination}stand_alone/$i-$version/ + if [[ -d ${path_destination}stand_alone/${i}-${version}/ ]] ; then + rm $verbose_common -Rf ${path_destination}stand_alone/${i}-${version}/ if [[ $? -ne 0 ]] ; then let failure=1 @@ -1266,7 +1281,7 @@ package_operation_clean() { if [[ $verbosity != "quiet" ]] ; then echo - echo "Cleaned '${path_destination}stand_alone/$i-$version/'." + echo "Cleaned '${path_destination}stand_alone/${i}-${version}/'." fi done @@ -1287,7 +1302,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy the data directory $c_notice${package}sources/data$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy the data directory ${c_notice}${package}sources/data${c_error} to ${c_notice}$package${c_error}.${c_reset}" fi let failure=1 @@ -1299,7 +1314,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to remove directory $c_notice${package}sources/data$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to remove directory ${c_notice}${package}sources/data${c_error}.${c_reset}" fi let failure=1 @@ -1315,7 +1330,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to move sources documents directory $c_notice${path_sources}sources/documents$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to move sources documents directory ${c_notice}${path_sources}sources/documents${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -1327,7 +1342,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to remove sources documents directory $c_notice${path_sources}sources/documents$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to remove sources documents directory ${c_notice}${path_sources}sources/documents${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -1341,7 +1356,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to move sources licenses directory $c_notice${path_sources}sources/licenses$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to move sources licenses directory ${c_notice}${path_sources}sources/licenses${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -1353,7 +1368,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to remove sources licenses directory $c_notice${path_sources}sources/licenses$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to remove sources licenses directory ${c_notice}${path_sources}sources/licenses${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -1367,7 +1382,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to move sources specifications directory $c_notice${path_sources}sources/specifications$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to move sources specifications directory ${c_notice}${path_sources}sources/specifications${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -1379,7 +1394,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to remove sources specifications directory $c_notice${path_sources}sources/specifications$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to remove sources specifications directory ${c_notice}${path_sources}sources/specifications${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -1393,7 +1408,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to move sources tests directory $c_notice${path_sources}sources/tests$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to move sources tests directory ${c_notice}${path_sources}sources/tests${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -1405,7 +1420,7 @@ package_operation_copy_package() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to remove sources tests directory $c_notice${path_sources}sources/tests$c_error to $c_notice$package$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to remove sources tests directory ${c_notice}${path_sources}sources/tests${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -1437,7 +1452,7 @@ package_operation_create_config_stubs() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to insert the config.c into $c_notice${package}data/build/settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to insert the config.c into ${c_notice}${package}data/build/settings${c_error}.${c_reset}" fi let failure=1 @@ -1449,7 +1464,7 @@ package_operation_create_config_stubs() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to insert the config.c into $c_notice${package}data/build/settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to insert the config.c into ${c_notice}${package}data/build/settings${c_error}.${c_reset}" fi let failure=1 @@ -1464,7 +1479,7 @@ package_operation_create_config_stubs() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create the config.c at $c_notice${package}sources/c/config.c$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create the config.c at ${c_notice}${package}sources/c/config.c${c_error}.${c_reset}" fi let failure=1 @@ -1478,7 +1493,7 @@ package_operation_create_config_stubs() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to insert the config.cpp into $c_notice${package}data/build/settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to insert the config.cpp into ${c_notice}${package}data/build/settings${c_error}.${c_reset}" fi let failure=1 @@ -1490,7 +1505,7 @@ package_operation_create_config_stubs() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to insert the config.cpp into $c_notice${package}data/build/settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to insert the config.cpp into ${c_notice}${package}data/build/settings${c_error}.${c_reset}" fi let failure=1 @@ -1505,7 +1520,7 @@ package_operation_create_config_stubs() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create the config.cpp at $c_notice${package}sources/c++/config.cpp$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create the config.cpp at ${c_notice}${package}sources/c++/config.cpp${c_error}.${c_reset}" fi let failure=1 @@ -1521,7 +1536,7 @@ package_operation_create_config_stubs() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create the config.cpp at $c_notice${package}sources/c/config.h$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create the config.cpp at ${c_notice}${package}sources/c/config.h${c_error}.${c_reset}" fi let failure=1 @@ -1533,7 +1548,7 @@ package_operation_create_config_stubs() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create the config.cpp at $c_notice${package}sources/c++/config.h$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create the config.cpp at ${c_notice}${package}sources/c++/config.h${c_error}.${c_reset}" fi let failure=1 @@ -1579,7 +1594,7 @@ package_operation_individual() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${path_destination}individual$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${path_destination}individual${c_error}.${c_reset}" fi package_cleanup @@ -1591,11 +1606,11 @@ package_operation_individual() { for directory in ${path_sources}level_0/* ${path_sources}level_1/* ${path_sources}level_2/* ; do name="$(echo $directory | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||")" - package="${path_destination}individual/$name-$version/" + package="${path_destination}individual/${name}-${version}/" if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Packaging Project$c_reset (individual) $c_notice$name-$version$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Packaging Project${c_reset} (individual) ${c_notice}${name}-${version}${c_reset}${c_highlight}.${c_reset}" fi package_create_base_files @@ -1604,7 +1619,7 @@ package_operation_individual() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy sources directory ${c_notice}${directory}${c_error} to ${c_notice}${package}sources${c_error}.${c_reset}" fi let failure=1 @@ -1636,16 +1651,16 @@ package_operation_level() { for level in level_0 level_1 level_2 ; do name="fll-$level" - package="${path_destination}level/$name-$version/" + package="${path_destination}level/${name}-${version}/" if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Packaging Project$c_reset (level) $c_notice$name-$version$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Packaging Project${c_reset} (level) ${c_notice}${name}-${version}${c_reset}${c_highlight}.${c_reset}" fi if [[ ! -d $path_build$level ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Build settings directory $c_notice$path_build$level$c_error is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Build settings directory ${c_notice}${path_build}${level}${c_error} is invalid or missing.${c_reset}" fi let failure=1 @@ -1660,7 +1675,7 @@ package_operation_level() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}data$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}data${c_error}.${c_reset}" fi let failure=1 @@ -1670,14 +1685,14 @@ package_operation_level() { fi if [[ -d $path_build${level}/build ]] ; then - cp $verbose_common -R $path_build${level}/build ${package}data/ + cp $verbose_common -R ${path_build}${level}/build ${package}data/ else - cp $verbose_common -R $path_build$level ${package}data/build + cp $verbose_common -R ${path_build}${level} ${package}data/build fi if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to move the directory ${c_notice}${path_build}${level}${c_error} as ${c_notice}${path_build}${level}build${c_error}.${c_reset}" fi let failure=1 @@ -1690,7 +1705,7 @@ package_operation_level() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}sources$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}sources${c_error}.${c_reset}" fi let failure=1 @@ -1699,13 +1714,13 @@ package_operation_level() { fi fi - for directory in $path_sources${level}/* ; do + for directory in ${path_sources}${level}/* ; do - cp $verbose_common -R $directory/* ${package}sources/ + cp $verbose_common -R ${directory}/* ${package}sources/ if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy files from sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy files from sources directory ${c_notice}${directory}${c_error} to ${c_notice}${package}sources${c_error}.${c_reset}" fi let failure=1 @@ -1717,7 +1732,7 @@ package_operation_level() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to remove directory ${c_notice}${package}sources/data/build${c_error}.${c_reset}" fi let failure=1 @@ -1753,16 +1768,16 @@ package_operation_monolithic() { local path_name= name="fll" - package="${path_destination}monolithic/$name-$version/" + package="${path_destination}monolithic/${name}-${version}/" if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Packaging Project$c_reset (monolithic) $c_notice$name-$version$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Packaging Project${c_reset} (monolithic) ${c_notice}${name}-${version}${c_reset}${c_highlight}.${c_reset}" fi if [[ ! -d ${path_build}monolithic ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Build settings directory $c_notice${path_build}monolithic$c_error is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Build settings directory ${c_notice}${path_build}monolithic${c_error} is invalid or missing.${c_reset}" fi package_cleanup @@ -1777,7 +1792,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}data$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}data${c_error}.${c_reset}" fi package_cleanup @@ -1794,7 +1809,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to move the directory ${c_notice}${path_build}${level}${c_error} as ${c_notice}${path_build}${level}build${c_error}.${c_reset}" fi package_cleanup @@ -1807,7 +1822,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}sources$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}sources${c_error}.${c_reset}" fi package_cleanup @@ -1821,7 +1836,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}tests$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}tests${c_error}.${c_reset}" fi package_cleanup @@ -1844,7 +1859,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create package data directory $c_notice${package}data/$level$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create package data directory ${c_notice}${package}data/${level}${c_error}.${c_reset}" fi let failure=1 @@ -1857,7 +1872,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy files from data directory $c_notice$directory_sub$c_error to $c_notice${package}sources/data$level$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/data$level${c_error}.${c_reset}" fi let failure=1 @@ -1869,7 +1884,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to remove directory ${c_notice}${package}sources/data/build${c_error}.${c_reset}" fi let failure=1 @@ -1878,11 +1893,11 @@ package_operation_monolithic() { fi if [[ "$(ls ${package}sources/data)" != "" ]] ; then - cp $verbose_common -R ${package}sources/data/* ${package}data/$level + cp $verbose_common -R ${package}sources/data/* ${package}data/${level} if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy the data directory $c_notice${package}sources/data/$level/data$c_error to $c_notice${package}data/$level$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy the data directory ${c_notice}${package}sources/data/${level}/data${c_error} to ${c_notice}${package}data/${level}${c_error}.${c_reset}" fi let failure=1 @@ -1895,7 +1910,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to remove directory $c_notice${package}sources/data$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to remove directory ${c_notice}${package}sources/data${c_error}.${c_reset}" fi let failure=1 @@ -1907,7 +1922,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy files from data directory $c_notice$directory_sub$c_error to $c_notice${package}sources/documents$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/documents${c_error}.${c_reset}" fi let failure=1 @@ -1919,7 +1934,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy files from data directory $c_notice$directory_sub$c_error to $c_notice${package}sources/licenses$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/licenses${c_error}.${c_reset}" fi let failure=1 @@ -1931,7 +1946,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy files from data directory $c_notice$directory_sub$c_error to $c_notice${package}sources/specifications$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/specifications${c_error}.${c_reset}" fi let failure=1 @@ -1943,7 +1958,7 @@ package_operation_monolithic() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy files from data directory $c_notice$directory_sub$c_error to $c_notice${package}tests$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}tests${c_error}.${c_reset}" fi let failure=1 @@ -1951,12 +1966,12 @@ package_operation_monolithic() { break fi else - if [[ ! -d ${package}sources/$path_name/$level ]] ; then - mkdir $verbose_common -p ${package}sources/$path_name/$level + if [[ ! -d ${package}sources/${path_name}/${level} ]] ; then + mkdir $verbose_common -p ${package}sources/${path_name}/${level} if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create package sources directory $c_notice${package}sources/$path_name/$level$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create package sources directory ${c_notice}${package}sources/${path_name}/${level}${c_error}.${c_reset}" fi let failure=1 @@ -1965,11 +1980,11 @@ package_operation_monolithic() { fi fi - cp $verbose_common -R $directory_sub/* ${package}sources/$path_name/$level + cp $verbose_common -R ${directory_sub}/* ${package}sources/${path_name}/${level} if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy files from sources directory $c_notice$directory_sub$c_error to $c_notice${package}sources/$path_name/$level$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy files from sources directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/${path_name}/${level}${c_error}.${c_reset}" fi let failure=1 @@ -2011,7 +2026,7 @@ package_operation_program() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${path_destination}program$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${path_destination}program${c_error}.${c_reset}" fi package_cleanup @@ -2023,11 +2038,11 @@ package_operation_program() { for directory in ${path_sources}level_3/* ; do name="$(echo $directory | sed -e "s|${path_sources}level_3/||")" - package="${path_destination}program/$name-$version/" + package="${path_destination}program/${name}-${version}/" if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Packaging Project$c_reset (program) $c_notice$name-$version$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Packaging Project${c_reset} (program) ${c_notice}${name}-${version}${c_reset}${c_highlight}.${c_reset}" fi package_create_base_files @@ -2036,7 +2051,7 @@ package_operation_program() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy sources directory ${c_notice}${directory}${c_error} to ${c_notice}${package}sources${c_error}.${c_reset}" fi let failure=1 @@ -2068,7 +2083,7 @@ package_operation_stand_alone() { local package_sub= local packages= local level= - local path= + local path_= local path_sub= local path_name= local path_name_sub= @@ -2078,7 +2093,7 @@ package_operation_stand_alone() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create directory $c_notice${path_destination}stand_alone$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${path_destination}stand_alone${c_error}.${c_reset}" fi package_cleanup @@ -2089,12 +2104,12 @@ package_operation_stand_alone() { for name in $mode_stand_alone ; do - directory="${path_sources}level_3/$name" - package="${path_destination}stand_alone/$name-$version/" + directory="${path_sources}level_3/${name}" + package="${path_destination}stand_alone/${name}-${version}/" if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Packaging Project$c_reset (stand_alone) $c_notice$name-$version$c_reset${c_highlight}.$c_reset" + echo -e "${c_highlight}Packaging Project${c_reset} (stand_alone) ${c_notice}${name}-${version}${c_reset}${c_highlight}.${c_reset}" fi package_create_base_files @@ -2103,7 +2118,7 @@ package_operation_stand_alone() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy sources directory ${c_notice}${directory}${c_error} to ${c_notice}${package}sources${c_error}.${c_reset}" fi let failure=1 @@ -2117,11 +2132,11 @@ package_operation_stand_alone() { break fi - cp $verbose_common -R ${path_build}stand_alone/$name.settings ${package}data/build/settings + cp $verbose_common -R ${path_build}stand_alone/${name}.settings ${package}data/build/settings if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy file $c_notice${path_build}stand_alone/$name.settings$c_error to $c_notice${package}data/build/settings$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy file ${c_notice}${path_build}stand_alone/${name}.settings${c_error} to ${c_notice}${package}data/build/settings${c_error}.${c_reset}" fi let failure=1 @@ -2129,12 +2144,12 @@ package_operation_stand_alone() { break fi - if [[ ! -d ${package}sources/c/program/$name/ ]] ; then + if [[ ! -d ${package}sources/c/program/${name}/ ]] ; then mkdir $verbose_common -p ${package}sources/c/program/$name/ if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create package sources directory $c_notice${package}sources/c/program/$name/$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create package sources directory ${c_notice}${package}sources/c/program/${name}/${c_error}.${c_reset}" fi let failure=1 @@ -2144,11 +2159,11 @@ package_operation_stand_alone() { fi # Copy all sources into a named sub-directory. - for path in ${package}sources/* ; do + for path_ in ${package}sources/* ; do - path_name="$(basename $path)" + path_name="$(basename $path_)" - for path_sub in ${package}sources/$path_name/* ; do + for path_sub in ${package}sources/${path_name}/* ; do path_name_sub="$(basename $path_sub)" @@ -2157,12 +2172,12 @@ package_operation_stand_alone() { continue fi - if [[ ! -d ${package}sources/$path_name/program/$name/ ]] ; then - mkdir $verbose_common -p ${package}sources/$path_name/program/$name/ + if [[ ! -d ${package}sources/${path_name}/program/${name}/ ]] ; then + mkdir $verbose_common -p ${package}sources/${path_name}/program/${name}/ if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create package sources directory $c_notice${package}sources/$path_name/program/$name/$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create package sources directory ${c_notice}${package}sources/${path_name}/program/${name}/${c_error}.${c_reset}" fi let failure=1 @@ -2171,11 +2186,11 @@ package_operation_stand_alone() { fi fi - mv $verbose_common $path_sub ${package}sources/$path_name/program/$name/ + mv $verbose_common $path_sub ${package}sources/${path_name}/program/${name}/ if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to move path $c_notice$path_sub$c_error to $c_notice${package}sources/$path_name/program/$name/$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to move path ${c_notice}${path_sub}${c_error} to ${c_notice}${package}sources/${path_name}/program/${name}/${c_error}.${c_reset}" fi let failure=1 @@ -2193,12 +2208,12 @@ package_operation_stand_alone() { break fi - if [[ -f ${path_build}stand_alone/$name.config.h ]] ; then - cp $verbose_common -R ${path_build}stand_alone/$name.config.h ${package}sources/c/config.h + if [[ -f ${path_build}stand_alone/${name}.config.h ]] ; then + cp $verbose_common -R ${path_build}stand_alone/${name}.config.h ${package}sources/c/config.h if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy file $c_notice${path_build}stand_alone/config.h$c_error to $c_notice${package}sources/c/$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy file ${c_notice}${path_build}stand_alone/config.h${c_error} to ${c_notice}${package}sources/c/${c_error}.${c_reset}" fi let failure=1 @@ -2213,11 +2228,11 @@ package_operation_stand_alone() { if [[ $packages != "" ]] ; then for package_sub in $packages ; do - if [[ -d ${path_sources}level_0/$package_sub/ ]] ; then + if [[ -d ${path_sources}level_0/${package_sub}/ ]] ; then level=level_0 - elif [[ -d ${path_sources}level_1/$package_sub/ ]] ; then + elif [[ -d ${path_sources}level_1/${package_sub}/ ]] ; then level=level_1 - elif [[ -d ${path_sources}level_2/$package_sub/ ]] ; then + elif [[ -d ${path_sources}level_2/${package_sub}/ ]] ; then level=level_2 else @@ -2225,7 +2240,7 @@ package_operation_stand_alone() { continue fi - directory_level="$path_sources$level/$package_sub/" + directory_level="${path_sources}${level}/${package_sub}/" for directory_sub in ${directory_level}* ; do @@ -2236,12 +2251,12 @@ package_operation_stand_alone() { continue fi - if [[ ! -d ${package}sources/$path_name/fll/$level/ ]] ; then - mkdir $verbose_common -p ${package}sources/$path_name/fll/$level/ + if [[ ! -d ${package}sources/${path_name}/fll/${level}/ ]] ; then + mkdir $verbose_common -p ${package}sources/${path_name}/fll/${level}/ if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to create package sources directory $c_notice${package}sources/$path_name/fll/$level/$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to create package sources directory ${c_notice}${package}sources/${path_name}/fll/${level}/${c_error}.${c_reset}" fi let failure=1 @@ -2250,11 +2265,11 @@ package_operation_stand_alone() { fi fi - cp $verbose_common -R $directory_level$path_name/* ${package}sources/$path_name/fll/$level/ + cp $verbose_common -R ${directory_level}${path_name}/* ${package}sources/${path_name}/fll/${level}/ if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Failed to copy files from sources directory $c_notice$directory_level$path_name/$c_error to $c_notice${package}sources/$path_name/fll/$level/$c_error.$c_reset" + echo -e "${c_error}ERROR: Failed to copy files from sources directory ${c_notice}${directory_level}${path_name}/${c_error} to ${c_notice}${package}sources/${path_name}/fll/${level}/${c_error}.${c_reset}" fi let failure=1 diff --git a/build/scripts/test.sh b/build/scripts/test.sh index 7539770..66d6b84 100644 --- a/build/scripts/test.sh +++ b/build/scripts/test.sh @@ -6,9 +6,22 @@ # This is intended to be run directly from the bare source tree. # The tests can still be run as normal by directly running the appropriate fake command (such as "fake make -f testfile") inside the appropriate project. # This calls other scripts and expects this to be run in the project root. +# # The dependencies of this script are: bash, grep, and sed. +# +# This script can also be run under zsh rather than bash by setting the environment variable SHELL_ENGINE to "zsh", such as: +# SHELL_ENGINE="zsh" zsh ./test.sh --help +# test_main() { + local shell_command=bash + + if [[ $SHELL_ENGINE == "zsh" ]] ; then + shell_command=zsh + + emulate ksh + fi + local public_name="FLL Project Mass Test Script" local system_name=install local called_name=$(basename $0) @@ -62,7 +75,12 @@ test_main() { while [[ $i -lt $t ]] ; do let i=$i+1 - p=${!i} + + if [[ $SHELL_ENGINE == "zsh" ]] ; then + p=${(P)i} + else + p=${!i} + fi if [[ $grab_next == "" ]] ; then if [[ $p == "-h" || $p == "--help" ]] ; then @@ -144,7 +162,7 @@ test_main() { if [[ $operation_failure == "fail-too_many" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Only a single build system is supported, received the following test systems $c_notice$test_system $operation$c_error was not recognized.$c_reset" + echo -e "${c_error}ERROR: Only a single build system is supported, received the following test systems ${c_notice}${test_system} ${operation}${c_error} was not recognized.${c_reset}" fi let failure=1 @@ -160,7 +178,7 @@ test_main() { if [[ $failure -eq 0 && $test_system != "normal" && $test_system != "github" && $test_system != "gitlab" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The test system must be one of ${c_notice}normal$c_error, ${c_notice}github$c_error, or ${c_notice}gitlab$c_error.$c_reset" + echo -e "${c_error}ERROR: The test system must be one of ${c_notice}normal${c_error}, ${c_notice}github${c_error}, or ${c_notice}gitlab${c_error}.${c_reset}" fi let failure=1 @@ -168,7 +186,7 @@ test_main() { if [[ $failure -eq 0 && $build_compiler != "gcc" && $build_compiler != "clang" ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The build compiler $c_notice$build_compiler$c_error is not currently directly supported.$c_reset" + echo -e "${c_error}ERROR: The build compiler ${c_notice}${build_compiler}${c_error} is not currently directly supported.${c_reset}" fi let failure=1 @@ -176,7 +194,7 @@ test_main() { if [[ $failure -eq 0 && ! -d $path_scripts ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The build scripts path $c_notice$path_scripts$c_error is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The build scripts path ${c_notice}${path_scripts}${c_error} is not a valid directory.${c_reset}" fi let failure=1 @@ -184,7 +202,7 @@ test_main() { if [[ $failure -eq 0 && ! -f $path_scripts_package ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: Unable to find the package build script file under the build scripts path at $c_notice$path_scripts_package$c_error.$c_reset" + echo -e "${c_error}ERROR: Unable to find the package build script file under the build scripts path at ${c_notice}${path_scripts_package}${c_error}.${c_reset}" fi let failure=1 @@ -195,7 +213,7 @@ test_main() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The test path $c_notice$path_test$c_error, does not exist and could not be created or exists and is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The test path ${c_notice}${path_test}${c_error}, does not exist and could not be created or exists and is not a valid directory.${c_reset}" fi let failure=1 @@ -207,7 +225,7 @@ test_main() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The package path $c_notice$path_test_package$c_error, does not exist and could not be created or exists and is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The package path ${c_notice}${path_test_package}${c_error}, does not exist and could not be created or exists and is not a valid directory.${c_reset}" fi let failure=1 @@ -219,7 +237,7 @@ test_main() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The test project path $c_notice$path_test_project$c_error, does not exist and could not be created or exists and is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The test project path ${c_notice}${path_test_project}${c_error}, does not exist and could not be created or exists and is not a valid directory.${c_reset}" fi let failure=1 @@ -231,7 +249,7 @@ test_main() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then - echo -e "${c_error}ERROR: The test work path $c_notice$path_test_work$c_error, does not exist and could not be created or exists and is not a valid directory.$c_reset" + echo -e "${c_error}ERROR: The test work path ${c_notice}${path_test_work}${c_error}, does not exist and could not be created or exists and is not a valid directory.${c_reset}" fi let failure=1 @@ -277,30 +295,30 @@ test_handle_colors() { test_help() { echo - echo -e "${c_title}$public_name$c_reset" - echo -e " ${c_notice}Version $version$c_reset" + echo -e "${c_title}${public_name}${c_reset}" + echo -e " ${c_notice}Version ${version}${c_reset}" echo - echo -e "$c_highlight$system_name$c_reset $c_notice[${c_reset} options $c_notice]$c_reset $c_notice[${c_reset} test_system $c_notice]$c_reset" + echo -e "${c_highlight}${system_name}${c_reset} ${c_notice}[${c_reset} options ${c_notice}]${c_reset} ${c_notice}[${c_reset} test_system ${c_notice}]${c_reset}" echo -e " ${c_important}normal${c_reset} Perform a normal test (default)." echo -e " ${c_important}github${c_reset} Perform a test meant to be used within Github." echo -e " ${c_important}gitlab${c_reset} Perform a test meant to be used within Gitlab (not yet supported)." echo - echo -e "${c_highlight}Options:$c_reset" - echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." - echo -e " +${c_important}d$c_reset, ++${c_important}dark$c_reset Use color modes that show up better on dark backgrounds." - echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." - echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." - echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity, silencing most output." - echo -e " +${c_important}N$c_reset, ++${c_important}normal$c_reset Set verbosity to normal." - echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." - echo -e " +${c_important}D$c_reset, ++${c_important}debug$c_reset Enable debugging, significantly increasing verbosity beyond normal output." - echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." + echo -e "${c_highlight}Options:${c_reset}" + echo -e " -${c_important}h${c_reset}, --${c_important}help${c_reset} Print this help screen." + echo -e " +${c_important}d${c_reset}, ++${c_important}dark${c_reset} Use color modes that show up better on dark backgrounds." + echo -e " +${c_important}l${c_reset}, ++${c_important}light${c_reset} Use color modes that show up better on light backgrounds." + echo -e " +${c_important}n${c_reset}, ++${c_important}no_color${c_reset} Do not use color." + echo -e " +${c_important}q${c_reset}, ++${c_important}quiet${c_reset} Decrease verbosity, silencing most output." + echo -e " +${c_important}N${c_reset}, ++${c_important}normal${c_reset} Set verbosity to normal." + echo -e " +${c_important}V${c_reset}, ++${c_important}verbose${c_reset} Increase verbosity beyond normal output." + echo -e " +${c_important}D${c_reset}, ++${c_important}debug${c_reset} Enable debugging, significantly increasing verbosity beyond normal output." + echo -e " +${c_important}v${c_reset}, ++${c_important}version${c_reset} Print the version number of this program." echo - echo -e "${c_highlight}Install Options:$c_reset" - echo -e " -${c_important}c$c_reset, --${c_important}compiler${c_reset} Specify the compiler, either gcc (default) or clang." - echo -e " -${c_important}p$c_reset, --${c_important}project${c_reset} Designate that the project files must also be built." - echo -e " -${c_important}s$c_reset, --${c_important}path_scripts${c_reset} Specify a custom directory where the build scripts are found." - echo -e " -${c_important}t$c_reset, --${c_important}path_test${c_reset} Specify a custom directory where the test environment is found." + echo -e "${c_highlight}Install Options:${c_reset}" + echo -e " -${c_important}c${c_reset}, --${c_important}compiler${c_reset} Specify the compiler, either gcc (default) or clang." + echo -e " -${c_important}p${c_reset}, --${c_important}project${c_reset} Designate that the project files must also be built." + echo -e " -${c_important}s${c_reset}, --${c_important}path_scripts${c_reset} Specify a custom directory where the build scripts are found." + echo -e " -${c_important}t${c_reset}, --${c_important}path_test${c_reset} Specify a custom directory where the test environment is found." echo } @@ -313,15 +331,15 @@ test_operate() { local ci_arguments= if [[ $PATH != "" ]] ; then - env_path="$env_path:$PATH" + env_path="${env_path}:${PATH}" fi if [[ $LD_LIBRARY_PATH != "" ]] ; then - env_libs="$env_libs:$LD_LIBRARY_PATH" + env_libs="${env_libs}:${LD_LIBRARY_PATH}" fi if [[ $test_system == "github" || $test_system == "gitlab" ]] ; then - ci_arguments="-d -I$includes_path -d -L$libraries_path" + ci_arguments="-d -I${includes_path} -d -L${libraries_path}" test_operate_ci_prebuild @@ -364,21 +382,21 @@ test_operate_build_individual() { if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Cleaning and building package.$c_reset" - echo -e "${c_title}------------------------------$c_reset" + echo -e "${c_highlight}Cleaning and building package.${c_reset}" + echo -e "${c_title}------------------------------${c_reset}" fi if [[ $verbosity == "debug" ]] ; then echo - echo "bash ${path_scripts_package} $verbose $context -d $path_test_package -i rebuild" + echo "$shell_command ${path_scripts_package} $verbose $context -d $path_test_package -i rebuild" fi - bash ${path_scripts_package} $verbose $context -d $path_test_package -i rebuild + $shell_command ${path_scripts_package} $verbose $context -d $path_test_package -i rebuild if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to clean and build the individual packages.$c_reset" + echo -e "${c_error}ERROR: Failed to clean and build the individual packages.${c_reset}" fi return 1 @@ -403,16 +421,16 @@ test_operate_build_individual() { } test_operate_build_project() { - local path="$1" + local path_="$1" local destination="$2" local project="$3" local mode="$4" local bootstrap="$5" - if [[ ! -d ${path}$project-$version/ ]] ; then + if [[ ! -d ${path_}${project}-${version}/ ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Package directory '${c_notice}${path}$project-$version$c_error' is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Package directory '${c_notice}${path_}${project}-${version}${c_error}' is invalid or missing.${c_reset}" fi return 1 @@ -420,15 +438,15 @@ test_operate_build_project() { if [[ $verbosity == "debug" ]] ; then echo - echo -e "Running '${c_notice}cd ${path}$project-$version/$c_reset'." + echo -e "Running '${c_notice}cd ${path_}${project}-${version}/${c_reset}'." fi - cd ${path}$project-$version/ + cd ${path_}${project}-${version}/ if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to change into directory '${c_notice}${path}$project-$version$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to change into directory '${c_notice}${path_}${project}-${version}${c_error}'.${c_reset}" fi return 1 @@ -451,27 +469,45 @@ test_operate_build_project() { PATH="$env_path" LD_LIBRARY_PATH="$env_libs" fake $verbose $context -w "$destination" -m $mode -m test -m $build_compiler clean build $ci_arguments fi else - if [[ $verbosity == "debug" ]] ; then - echo + if [[ $SHELL_ENGINE == "zsh" ]] ; then + if [[ $verbosity == "debug" ]] ; then + echo + + if [[ $build_compiler == "gcc" ]] ; then + echo "zsh ./bootstrap.sh $verbose $context -w \"$destination\" -m $mode -m test build" + else + echo "zsh ./bootstrap.sh $verbose $context -w \"$destination\" -m $mode -m test -m $build_compiler build" + fi + fi if [[ $build_compiler == "gcc" ]] ; then - echo "./bootstrap.sh $verbose $context -w \"$destination\" -m $mode -m test build" + zsh ./bootstrap.sh $verbose $context -w "$destination" -m $mode -m test build else - echo "./bootstrap.sh $verbose $context -w \"$destination\" -m $mode -m test -m $build_compiler build" + zsh ./bootstrap.sh $verbose $context -w "$destination" -m $mode -m test -m $build_compiler build fi - fi - - if [[ $build_compiler == "gcc" ]] ; then - ./bootstrap.sh $verbose $context -w "$destination" -m $mode -m test build else - ./bootstrap.sh $verbose $context -w "$destination" -m $mode -m test -m $build_compiler build + if [[ $verbosity == "debug" ]] ; then + echo + + if [[ $build_compiler == "gcc" ]] ; then + echo "./bootstrap.sh $verbose $context -w \"$destination\" -m $mode -m test build" + else + echo "./bootstrap.sh $verbose $context -w \"$destination\" -m $mode -m test -m $build_compiler build" + fi + fi + + if [[ $build_compiler == "gcc" ]] ; then + ./bootstrap.sh $verbose $context -w "$destination" -m $mode -m test build + else + ./bootstrap.sh $verbose $context -w "$destination" -m $mode -m test -m $build_compiler build + fi fi fi if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to build $mode project '$c_notice$project$c_reset$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to build $mode project '${c_notice}$project${c_reset}${c_error}'.${c_reset}" fi return 1 @@ -479,15 +515,19 @@ test_operate_build_project() { if [[ $verbosity != "quiet" ]] ; then echo - echo -e "Installing $mode project '$c_notice$project$c_reset'." + echo -e "Installing $mode project '${c_notice}$project${c_reset}'." fi - ./install.sh $verbose $context -w "$destination" + if [[ $SHELL_ENGINE == "zsh" ]] ; then + zsh ./install.sh $verbose $context -w "$destination" + else + ./install.sh $verbose $context -w "$destination" + fi if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to install $mode project '$c_notice$project$c_reset$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to install $mode project '${c_notice}$project${c_reset}${c_error}'.${c_reset}" fi return 1 @@ -502,21 +542,21 @@ test_operate_build_tools() { if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Building project build tools.$c_reset" - echo -e "${c_title}-----------------------------$c_reset" + echo -e "${c_highlight}Building project build tools.${c_reset}" + echo -e "${c_title}-----------------------------${c_reset}" fi if [[ $verbosity == "debug" ]] ; then echo - echo "bash ${path_scripts_package} $verbose $context -d $path_test_package -S fake rebuild" + echo "$shell_command ${path_scripts_package} $verbose $context -d $path_test_package -S fake rebuild" fi - bash ${path_scripts_package} $verbose $context -d $path_test_package -S fake rebuild + $shell_command ${path_scripts_package} $verbose $context -d $path_test_package -S fake rebuild if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to clean and build the stand_alone fake package.$c_reset" + echo -e "${c_error}ERROR: Failed to clean and build the stand_alone fake package.${c_reset}" fi return 1 @@ -544,8 +584,8 @@ test_operate_ci_prebuild() { if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Performing Github Specific Pre-Build Operations.$c_reset" - echo -e "${c_title}------------------------------------------------$c_reset" + echo -e "${c_highlight}Performing Github Specific Pre-Build Operations.${c_reset}" + echo -e "${c_title}------------------------------------------------${c_reset}" fi test_operate_ci_prebuild_libcap @@ -567,8 +607,8 @@ test_operate_ci_pretest() { if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Performing Github Specific Pre-Test Operations.$c_reset" - echo -e "${c_title}-----------------------------------------------$c_reset" + echo -e "${c_highlight}Performing Github Specific Pre-Test Operations.${c_reset}" + echo -e "${c_title}-----------------------------------------------${c_reset}" fi test_operate_ci_pretest_cmocka @@ -590,7 +630,7 @@ test_operate_ci_pretest_cmocka() { if [[ -d $cmocka_path ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "Detected existing cmocka repository at \"$c_notice$cmocka_path$c_reset\", skipping the cmocka process." + echo -e "Detected existing cmocka repository at \"${c_notice}$cmocka_path${c_reset}\", skipping the cmocka process." fi return 0 @@ -606,7 +646,7 @@ test_operate_ci_pretest_cmocka() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to git clone '${c_notice}$cmocka_uri$c_error' onto '${c_notice}$cmocka_path$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to git clone '${c_notice}$cmocka_uri${c_error}' onto '${c_notice}$cmocka_path${c_error}'.${c_reset}" fi return 1 @@ -622,7 +662,7 @@ test_operate_ci_pretest_cmocka() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to create cmocka build data directory '$c_notice$cmocka_data$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to create cmocka build data directory '${c_notice}$cmocka_data${c_error}'.${c_reset}" fi return 1 @@ -638,7 +678,7 @@ test_operate_ci_pretest_cmocka() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to copy cmocka build settings: '$c_notice$cmocka_settings$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to copy cmocka build settings: '${c_notice}$cmocka_settings${c_error}'.${c_reset}" fi return 1 @@ -654,7 +694,7 @@ test_operate_ci_pretest_cmocka() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to change cmocka source directory '$c_notice$cmocka_path$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to change cmocka source directory '${c_notice}$cmocka_path${c_error}'.${c_reset}" fi return 1 @@ -670,7 +710,7 @@ test_operate_ci_pretest_cmocka() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to build '${c_notice}cmocka$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to build '${c_notice}cmocka${c_error}'.${c_reset}" fi return 1 @@ -686,7 +726,7 @@ test_operate_ci_pretest_cmocka() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to install cmocka headers to '$c_notice${work_path}includes/$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to install cmocka headers to '${c_notice}${work_path}includes/${c_error}'.${c_reset}" fi return 1 @@ -702,7 +742,7 @@ test_operate_ci_pretest_cmocka() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to install cmocka libraries to '$c_notice${work_path}libraries/shared/$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to install cmocka libraries to '${c_notice}${work_path}libraries/shared/${c_error}'.${c_reset}" fi return 1 @@ -719,7 +759,7 @@ test_operate_ci_prebuild_libcap() { if [[ -d $libcap_path ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "Detected existing libcap repository at \"$c_notice$libcap_path$c_reset\", skipping the libcap process." + echo -e "Detected existing libcap repository at \"${c_notice}$libcap_path${c_reset}\", skipping the libcap process." fi return 0 @@ -735,7 +775,7 @@ test_operate_ci_prebuild_libcap() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to git clone '${c_notice}$libcap_uri$c_error' onto '${c_notice}$libcap_path$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to git clone '${c_notice}$libcap_uri${c_error}' onto '${c_notice}$libcap_path${c_error}'.${c_reset}" fi return 1 @@ -751,7 +791,7 @@ test_operate_ci_prebuild_libcap() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to change libcap source directory '$c_notice$libcap_path$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to change libcap source directory '${c_notice}$libcap_path${c_error}'.${c_reset}" fi return 1 @@ -767,7 +807,7 @@ test_operate_ci_prebuild_libcap() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to build and install libcap into the work directory '$c_notice${work_path}$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to build and install libcap into the work directory '${c_notice}${work_path}${c_error}'.${c_reset}" fi return 1 @@ -786,14 +826,14 @@ test_operate_tests() { if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_highlight}Testing Project $project.$c_reset" - echo -e "${c_title}--------------------------------------$c_reset" + echo -e "${c_highlight}Testing Project $project.${c_reset}" + echo -e "${c_title}--------------------------------------${c_reset}" fi if [[ ! -d $path_test_package_individual$project-$version/ ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Package directory '$c_notice$path_test_package_individual$project-$version$c_error' is invalid or missing.$c_reset" + echo -e "${c_error}ERROR: Package directory '${c_notice}$path_test_package_individual$project-$version${c_error}' is invalid or missing.${c_reset}" fi let failure=1 @@ -804,11 +844,11 @@ test_operate_tests() { if [[ $(echo $projects_no_tests | grep -o "\<$project\>") == "" ]] ; then if [[ $verbosity == "verbose" || $verbosity == "debug" ]] ; then echo - echo -e "${c_warning}WARNING: Project '$c_notice$project$c_warning' does not have a testfile.$c_reset" + echo -e "${c_warning}WARNING: Project '${c_notice}$project${c_warning}' does not have a testfile.${c_reset}" fi else echo - echo -e "Project '$c_notice$project$c_reset' has no tests and is not expected to.$c_reset" + echo -e "Project '${c_notice}$project${c_reset}' has no tests and is not expected to.${c_reset}" fi continue @@ -818,7 +858,7 @@ test_operate_tests() { if [[ $failure -eq 0 ]] ; then if [[ $verbosity == "debug" ]] ; then echo - echo -e "Running '${c_notice}cd $path_test_package_individual$project-$version/$c_reset'." + echo -e "Running '${c_notice}cd $path_test_package_individual$project-$version/${c_reset}'." fi cd $path_test_package_individual$project-$version/ @@ -826,7 +866,7 @@ test_operate_tests() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failed to change into directory '$c_notice$path_test_package_individual$project-$version$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failed to change into directory '${c_notice}$path_test_package_individual$project-$version${c_error}'.${c_reset}" fi let failure=1 @@ -853,7 +893,7 @@ test_operate_tests() { if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then echo - echo -e "${c_error}ERROR: Failure while testing project '$c_notice$project$c_reset$c_error'.$c_reset" + echo -e "${c_error}ERROR: Failure while testing project '${c_notice}$project${c_reset}${c_error}'.${c_reset}" fi let failure=1 -- 1.8.3.1