1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
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
macos: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)")
}
|