This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Ben, All, On Thursday 12 May 2011 22:23:42 Ben Baattheid wrote: > I have an issue with crosstool-NG 1.11.1: When spaces are used for > parameters inside *_EXTRA_CONFIG, the corresponding configure commands > fail. Yes, indeed. That's a limitation. The problem is that we want to: - allow passing more than one configure argument - allow for arguments with spaces But because kconfig only supports strings (and tristates), we have to make a choice between the two requirements. I initially choose to favour passing multiple arguments, and thus discarded the ability to pass argmuents with spaces in them. So, when using the *_EXTRA_CONFIG variables, crosstool-NG does not enclose expansion between double quotes. [--SNIP many examples--] > As you can see, the --with-pkgversion option gets split in all cases > because of the space, independently of the quoting choice, which > breeds the errors. Yes. Sorry... :-/ So basically, if we want to support both multiple args *and* args with spaces in them, then we have to come up with a few tricks. And I have a few ideas. The first, relatively easy one: - use a character as a separator between args. The pipe '|' seems like a rather good candidate here. I can't really see args with pipes in them, and pipes are commonly used in AsciiArt to create tables, so hard-core programmers (they are our target audience, aren't they? ;-]) would not be too disoriented. - then *_EXTRA_CONFIG variables (and potentially others) are split up around pipes to create bash-style arrays. I have a mostly-working code snippet that does the trick (see below). - code that needs to split such variables would call a function, eg. somewhere in the binutils build function: CT_SplitVar CT_BINUTILS_EXTRA_CONFIG extra_config - works in all cases, but breaks existing .config files The second, relatively complex, but maybe more easy to use from an end-user perspective (or maybe not): - allow for bash-style arrays assignments in the menuconfig, such as (note the nultiple conflicting double-quotes): CT_BINUTILS_EXTRA_CONFIG="--arg1="val with space" --arg2=no_space" - of course, this implies that .config is no longer sourceable as-is and needs a bit of love+sed so as to transform such variables into proper bash-style array assignments: CT_BINUTILS_EXTRA_CONFIG=( --arg1="val with space" "--arg2=no_space" ) - then the code that needs that variable should simply treat it as a bash-style array. - much more impact on the infrastructure code, and not very robust. The third idea would be to make kconfig aware of array variables. Well, no... Forget this idea. :-] No need to say that I like the first idea much more than the second one. Thoughts? Regards, Yann E. MORIN. PS. Mostly-working code snippet to split variables, but breaks on empty input variable for now. Easy to fix. split_me() { local var_to_split="${1}" local out_var="${2}" local ___foo local -a ___bar eval ___foo="\${${var_to_split}}\|" while [ -n "${___foo}" ]; do ___bar+=( "${___foo%%|*}" ) ___foo="${___foo#*|}" done eval ${out_var}=\(\"\${___bar[@]}\"\) } I'll see what I can do about it during the WE... Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' -- For unsubscribe information see http://sourceware.org/lists.html#faq
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |