raz / src / fixpoint.sh

28 lines · 1.0 KiB · executable · raw · history · last change a2ea2c5e

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.
11set -e
12d=build/fix
13rm -rf $d
14mkdir -p $d/v
15ln -s ../../lib $d/lib
16printf 'module Version;\nconst Text* = "%s";\nend Version.\n' "$(tr -d "'" < build/version.inc)" >$d/v/Version.raz
17cp build/boot/raz $d/stage0
18for 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
21done
22cmp $d/stage2 $d/stage3
23echo "fixpoint: stages 2 and 3 are the same, $(wc -c <$d/stage3) bytes"
24cp raz $d/made
25trap 'cp $d/made raz' EXIT
26cp $d/stage3 raz
27make check
28make bench