4 trap 'test $? -eq 0 || echo build failed' EXIT
6 date --help |
grep -q GNU-date-that-actually-works-with-N
&& {
20 test -n "$1" || die
"usage: $0 build-directory"
31 test "$cmd" = "$cur_cmd" && {
32 eval "cur_key=\$($key_cmd)" || cur_key
=none
33 test "$cur_key" = "$key" && dirty
="" || dirty
="$cur_key!=$key"
41 eval ocamlc
-depend -bytecode -one-line $incs $s |
{
44 for d
in $
(eval echo $depl); do
47 test $?
-eq 0 || dirty
=transitive
51 cmd
="ocamlc $incs -c -o $o $s"
52 keycmd
="stat -c %Y $o $s 2>/dev/null | tr -d '\n'"
53 getpast
"$o" "$cmd" "$keycmd"
55 printf "%*.s%s -> %s\n" $n '' \
56 "${s#$srcd/}" "${o#$outd/} [${dirty-fresh}]"
57 eval "$cmd" || die
"compilation failed"
58 eval "key=\$($keycmd)"
59 printf "cmd='$cmd'\nkey='$key'\n" >$o.past
60 grep -q "$o" $outd/ordered ||
echo "$o" >>$outd/ordered
63 grep -q "$o" $outd/ordered ||
echo "$o" >>$outd/ordered
72 test ${wocmi%help.cmo} != ${wocmi} && {
76 test "$o" = "$wocmi" && {
84 incs
="-I lablGL -I $outd/lablGL -I wsi/x11 -I $outd/wsi/x11 -I $outd"
85 bocaml1
"$s" "$o" ||
return 1 && return 0
92 muinc
="-I $mudir/include -I $mudir/thirdparty/freetype/include"
93 cmd
="ocamlc -ccopt \"-O2 $muinc -o $o\" $s"
94 keycmd
="stat -c %Y $o 2>/dev/null"
95 getpast
"$o" "$cmd" "$keycmd"
97 printf "%s -> %s\n" "${s#$srcd/}" "${o#$outd/} [${dirty-fresh}]"
98 eval "$cmd" || die
"compilation failed"
99 eval "key=\$($keycmd)" || die
"$keycmd failed"
100 printf "cmd='$cmd'\nkey='$key'\n" >$o.past
104 mkdir
-p $outd/wsi
/x11
105 mkdir
-p $outd/lablGL
108 cmd
="$SHELL $srcd/mkhelp.sh $srcd/KEYS >$outd/help.ml"
109 keycmd
="stat -c %Y $srcd/KEYS 2>/dev/null"
110 getpast
"$outd/help.ml" "$cmd" "$keycmd"
111 test -n "$dirty" && { eval $cmd || die
"mkhelp failed"; }
112 eval "key=\$($keycmd)" || die
"$keycmd: failed"
113 printf "cmd='$cmd'\nkey='$key'\n" >$outd/help.ml.past
115 for m
in lablGL
/glMisc.cmo lablGL
/glTex.cmo wsi
/x11
/wsi.cmo main.cmo
; do
120 libs
="str.cma unix.cma"
121 clibs
="-lGL -lX11 -L$mudir/build/native -lmupdf -lmupdfthird -lpthread"
123 for f
in ml_gl ml_glarray ml_raw
; do
124 bocamlc lablGL
/$f.o || true
125 globjs
="$globjs $outd/lablGL/$f.o"
128 ord
=$
(grep -v \.cmi
$outd/ordered |
tr "\n" " ")
129 cmd
="ocamlc -custom $libs -o $outd/llpp $ord"
130 cmd
="$cmd $globjs $outd/link.o -cclib \"$clibs\""
131 keycmd
="stat -c %Y $outd/llpp 2>/dev/null"
132 getpast
"$outd/llpp" "$cmd" "$keycmd"
133 test -n "$dirty" && {
135 eval "key=\$($keycmd)" || die
"$keycmd: failed"
136 printf "cmd='$cmd'\nkey='$key'\n" >$outd/llpp.past
137 } ||
echo "nothing to be done"
139 printf "took %s sec\n" $
(echo "scale=3; ($(now) - $tstart) / $scl" |
bc -l)