-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathbootstrap.bash
More file actions
executable file
·31 lines (20 loc) · 1013 Bytes
/
bootstrap.bash
File metadata and controls
executable file
·31 lines (20 loc) · 1013 Bytes
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
#!/bin/bash
set -Eeuo pipefail
# Clean the file produced by ./bootstrap
rm -f bootstrap/bootstrap.peg.go
cd cmd/peg-bootstrap
# Remove artefacts from a previous incomplete build
rm -f peg[0123].peg.go peg-bootstrap.peg.go
# Remove files produced by previous versions of the build
rm -f peg[0123] peg-bootstrap bootstrap.peg.go
go run ../../bootstrap > peg0.peg.go
go run -tags bootstrap main.go peg0.peg.go < bootstrap.peg > peg1.peg.go
go run -tags bootstrap main.go peg1.peg.go < peg.bootstrap.peg > peg2.peg.go
go run -tags bootstrap main.go peg2.peg.go < ../../peg.peg > peg3.peg.go
go run -tags bootstrap main.go peg3.peg.go < ../../peg.peg > peg-bootstrap.peg.go
go run -tags bootstrap main.go peg-bootstrap.peg.go < ../../peg.peg > ../../peg.peg.go
# Remove artefacts from the build
rm -f peg[0123].peg.go peg-bootstrap.peg.go
# Final rebuild
cd ../..
go tool peg -inline -switch peg.peg