| 1 | #!/bin/sh |
| 2 | # The fixpoint: the previous release, BOOT's, builds src/ (stage 1), |
| 3 | # that builds src/ (stage 2), that builds it again (stage 3), and |
| 4 | # stages 2 and 3 must be the same file. A program holds the paths it was made from, so each |
| 5 | # stage is built by the same command in the same place, from the |
| 6 | # compiler before it copied to build/fix/raz. Run from the repository |
| 7 | # root, after `make raz`. Then stage 3 stands in for ./raz (messages name |
| 8 | # the library by its path from the compiler, so it must be at the root) |
| 9 | # while `make check` and `make bench` run on it; the one make built |
| 10 | # comes back. |
| 11 | set -e |
| 12 | d=build/fix |
| 13 | rm -rf $d |
| 14 | mkdir -p $d/v |
| 15 | ln -s ../../lib $d/lib |
| 16 | printf 'module Version;\nconst Text* = "%s";\nend Version.\n' "$(tr -d "'" < build/version.inc)" >$d/v/Version.raz |
| 17 | cp build/boot/raz $d/stage0 |
| 18 | for n in 1 2 3; do |
| 19 | cp $d/stage$((n - 1)) $d/raz |
| 20 | $d/raz -Werror -I src -I $d/v -o $d/stage$n src/Raz.raz |
| 21 | done |
| 22 | cmp $d/stage2 $d/stage3 |
| 23 | echo "fixpoint: stages 2 and 3 are the same, $(wc -c <$d/stage3) bytes" |
| 24 | cp raz $d/made |
| 25 | trap 'cp $d/made raz' EXIT |
| 26 | cp $d/stage3 raz |
| 27 | make check |
| 28 | make bench |