From 40d5bf64408a0e103f8149f941ea50fbbb11dc91 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 23 Nov 2018 22:14:07 -0800 Subject: Add moxiebox as a choice for libc This required some rework of the libc selection, as moxiebox is a layer on top of another libc - newlib. Also, moxiebox'es host VM (`sandbox`) needs a libcrypto on the host. We will not have it if we're cross-compiling a canadian cross. Fortunately, all moxiebox needs from libcrypto is SHA256, and it already includes a standalone implementation of SHA256 in its runtime. Provide a little wrapper that allows moxiebox use that implementation for the host binary, too. Also, automate collecting/printing the list of all packages in a given category (e.g. LIBC or COMP_TOOLS), generate a list of all Kconfig symbols for a given category. Signed-off-by: Alexey Neyman --- bootstrap | 86 ++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 26 deletions(-) (limited to 'bootstrap') diff --git a/bootstrap b/bootstrap index c55c3e22..f7b9b416 100755 --- a/bootstrap +++ b/bootstrap @@ -22,6 +22,19 @@ fi # Iterate over NAME entities (the iterator must be set up first # using the set_iter function), processing the lines until the matching # #!end-foreach line. +# +# Also, several forms of @@VAR@@ expansions are possible: +# +# @@VAR@@ +# Just the value of the variable VAR +# @@VAR|@@ +# The value of VAR made into Kconfig-name: all non-alphanumeric character +# replaced with underscores; upper-cased. +# @@VAR?val@@ +# If VAR is non-empty, insert value "val". Otherwise, insert nothing. +# @@*ITER@@ +# Expands to a space separated list of values for the iterator ITER. +# Postprocess operations, if any, are applied to each value. declare -A info @@ -183,7 +196,8 @@ run_lines() { local start="${1}" local end="${2}" - local l lnext s s1 v vp pp p val + local l lnext s s1 v vn vp pp p val val0 is_iter pp_saved + local -a vpl debug "Running lines ${start}..${end}" l=${start} @@ -199,33 +213,53 @@ run_lines() *@@*@@*) v="${s#*@@}" v="${v%%@@*}" - # $v now includes variable name + any postprocessing - vp="${v%%[|?]*}" - pp="${v#${vp}}" - # $vp is name of the variable proper, $pp is any postprocessing - if [ "${info[${vp}]+set}" != "set" ]; then - error "${template}:${l}: reference to undefined variable '${vp}'" - fi + # $v now has the complete reference. First check if it is cached already. if [ "${info[${v}]+set}" != "set" ]; then - # We know the base variable, need to cache postprocessed value - val="${info[${vp}]}" - # Apply postprocessing(s) - while [ -n "${pp}" ]; do - case "${pp}" in - "|"*) - # Kconfigize - pp="${pp#|}" - val=${val//[^0-9A-Za-z_]/_} - val=${val^^} - ;; - "?"*) - pp="${pp#?}" - p="${pp%%[|?]*}" - pp="${pp#${p}}" - val="${val:+${p}}" - ;; - esac + case "${v}" in + "*"*) is_iter=y; vn="${v#\*}";; + *) is_iter=n; vn="${v}";; + esac + # $vn is now the reference without the preceding iterator + vp="${vn%%[|?]*}" + pp="${vn#${vp}}" + # $vp is name of the variable proper, $pp is any postprocessing + if [ "${is_iter}" = "n" ]; then + if [ "${info[${vp}]+set}" != "set" ]; then + error "${template}:${l}: reference to undefined variable '${vp}'" + fi + vpl=( "${info[${vp}]}" ) + else + if [ "${info[iter_${vp}]+set}" != "set" ]; then + error "${template}:${l}: iterator over '${vp} is not defined" + fi + vpl=( ${info[iter_${vp}]} ) + fi + # ${vpl[@]} now is an array of values to be transformed. + val= + pp_saved="${pp}" + for val0 in "${vpl[@]}"; do + debug "val0 [${val0}]" + pp="${pp_saved}" + # Apply postprocessing(s) + while [ -n "${pp}" ]; do + case "${pp}" in + "|"*) + # Kconfigize + pp="${pp#|}" + val0=${val0//[^0-9A-Za-z_]/_} + val0=${val0^^} + ;; + "?"*) + pp="${pp#?}" + p="${pp%%[|?]*}" + pp="${pp#${p}}" + val0="${val0:+${p}}" + ;; + esac + done + val="${val:+${val} }${val0}" done + # Cache for future references. info[${v}]="${val}" fi s1="${s1}${s%%@@*}\${info[${v}]}" -- cgit v1.2.3