defineReplace(yesNo) { if ($$1):return("yes") else:return("no") } defineTest(printConfigLine) { !build_pass:return msg="$$1" val=$$2 color=$$3 width=$$4 isEmpty(width):width = 30 unix:system("test -t 2") { # check if we are on unix and stderr is a tty osx:echo="echo" else:echo="/bin/echo -e" equals(color, "auto") { yesmatch = $$find(val, "^yes") nomatch = $$find(val, "^no") automatch = $$find(val, "^auto") !isEmpty(yesmatch):color = "green" else:!isEmpty(nomatch):color = "red" else:!isEmpty(automatch):color = "yellow" } equals(color, "red"): prolog=$$system($$echo "\\\\033")[31;1m else:equals(color, "green"): prolog=$$system($$echo "\\\\033")[32;1m else:equals(color, "yellow"): prolog=$$system($$echo "\\\\033")[33;1m else:equals(color, "orange"): prolog=$$system($$echo "\\\\033")[33m else:equals(color, "white"): prolog=$$system($$echo "\\\\033")[37;1m epilog = $$system($$echo "\\\\033")[0m } isEmpty(msg)|contains(msg, "^-- .*") { log($$prolog$$section(msg, "-- ", 1, -1)$$epilog$$escape_expand(\\n)) return() } # The tricky part: there are no arithmetic functions in qmake! # Start by createing an array of strings, where the string at [i] consists of i dots # We need it the other way around though, hence the reverse at the end (sadly you # cannot run a $$width..1 loop, although 30..1 does work). for(i, 1..$$width) { spacingEntry="" for (j, 1..$$i) { spacingEntry += "." } spacing += $$join(spacingEntry) } spacing = $$reverse(spacing) # convert a string into an array of characters, so we can get the length via size() msgArray = $$split(msg,) log(" $$msg $$member(spacing, $$size(msgArray)) $$prolog$$val$$epilog$$escape_expand(\\n)") }