-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathbump_magic_numbers.sh
executable file
·36 lines (26 loc) · 1.14 KB
/
bump_magic_numbers.sh
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
#!/bin/bash
set -eu -o pipefail
# Needs GNU sed which is not the default on macOS
sed=gsed
gsed --version >/dev/null || sed=sed
if [ "$(git status --porcelain --untracked-files=no)" != "" ]; then
echo "There must be a clean 'git status' before running this script"
exit 1
fi
git clean -dfX
(cd ocaml && ./configure && make -j8 coldstart && make -j8 coreall)
# Unfortunately the "e" modifier appears not to work except for replacing
# a whole line
$sed -i \
-e 's/^#define EXEC_MAGIC "Caml1999X\([0-9][0-9][0-9]\)"/echo "#define EXEC_MAGIC \\"Caml1999X$((\1 + 1))\\""/ge' \
ocaml/runtime/caml/exec.h
$sed -i \
-e 's/^#define EXEC_MAGIC "Caml1999X\([0-9][0-9][0-9]\)"/echo "#define EXEC_MAGIC \\"Caml1999X$((\1 + 1))\\""/ge' \
ocaml/runtime4/caml/exec.h
$sed -i \
-e 's/^\(let\|and\) \([a-z][a-z_]*\) = "Caml\([0-9][0-9][0-9][0-9]\)\([a-zA-Z]\)\(5[0-9][0-9]\)"/echo "\1 \2 = \\"Caml\3\4$((\5 + 1))\\""/ge' \
ocaml/utils/config.common.ml
$sed -i \
-e 's/^ "Caml\([0-9][0-9][0-9][0-9]\)\([a-zA-Z]\)\(5[0-9][0-9]\)"/echo " \\"Caml\1\2$((\3 + 1))\\""/ge' \
ocaml/utils/config.common.ml
(cd ocaml && make -j8 coreall && make -j8 bootstrap)