• Home
Name Date Size #Lines LOC

..--

linux/03-May-2024-22

third_party/03-May-2024-23,37418,158

windows/03-May-2024-66

README.mdD03-May-20243.1 KiB131100

update_flex_bison_binaries.pyD03-May-20242.1 KiB7043

README.md

1# flex and bison binaries
2
3This folder contains the flex and bison binaries. We use these binaries to
4generate the ANGLE translator's lexer and parser.
5
6Use the script [`update_flex_bison_binaries.py`](update_flex_bison_binaries.py)
7to update the versions of these binaries in cloud storage. It must be run on
8Linux or Windows. It will update the SHAs for your platform. After running the
9script run `git commit` and then `git cl upload` to code review using the normal
10review process. You will also want to run
11[`scripts/run_code_generation.py`](../../scripts/run_code_generation.py) to
12update the generated files.
13
14Please update both Windows and Linux binaries at the same time. Start with
15Windows, then merge your work into a single CL that updates both binaries
16simultaneously. Note that we don't currently support Mac for generating the
17lexer and parser files. If we do we should add a flex/bison download for Mac
18as well.
19
20Contact jmadill or syoussefi for any help with updating the binaries.
21
22## Updating flex and bison binaries
23
24This is expected to be a rare operation, and is currently done based on the
25following instructions.  Note: get the binaries first on windows, as only a
26single option is available, then build the binaries for the same version on
27Linux.
28
29### On Windows
30
31Install MSys2 (x86_64) from http://www.msys2.org/ on Windows.  `flex` should
32already be installed.  Install bison:
33
34```
35$ pacman -S bison
36```
37
38Note the versions of flex and bison, so you can build the exact same versions on Linux.
39For example:
40
41```
42$ flex --version
43flex 2.6.4
44
45$ bison --version
46bison (GNU Bison) 3.8.2
47```
48
49The only dependencies outside /Windows/ from MSys2 should be the following:
50
51```
52msys-intl-8.dll
53msys-iconv-2.dll
54msys-2.0.dll
55```
56
57This can be verified with:
58
59```
60$ ldd /usr/bin/flex
61$ ldd /usr/bin/bison
62```
63
64Additionally, we need the binary for m4 at `/usr/bin/m4`.
65
66Copy all these 5 files to this directory:
67
68```
69$ cd angle/
70$ cp /usr/bin/flex.exe \
71     /usr/bin/bison.exe \
72     /usr/bin/m4.exe \
73     /usr/bin/msys-intl-8.dll \
74     /usr/bin/msys-iconv-2.dll \
75     /usr/bin/msys-2.0.dll \
76     tools/flex-bison/windows/
77```
78
79Upload the binaries:
80
81```
82$ cd angle/
83$ py tools/flex-bison/update_flex_bison_binaries.py
84```
85
86### On Linux
87
88```
89# Get the source of flex
90$ git clone https://github.com/westes/flex.git
91$ cd flex/
92# Checkout the same version as msys2 on windows
93$ git checkout v2.6.4
94# Build
95$ autoreconf -i
96$ mkdir build && cd build
97$ ../configure CFLAGS="-O2 -D_GNU_SOURCE"
98$ make -j
99```
100
101```
102# Get the source of bison
103$ curl http://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz | tar -xJ
104$ cd bison-3.8.2
105# Build
106$ mkdir build && cd build
107$ ../configure CFLAGS="-O2"
108$ make -j
109```
110
111Note: Bison's [home page][Bison] lists ftp server and other mirrors.  If the
112above link is broken, replace with a mirror.
113
114Copy the 2 executables to this directory:
115
116```
117$ cd angle/
118$ cp /path/to/flex/build/src/flex \
119     /path/to/bison/build/src/bison \
120     tools/flex-bison/linux/
121```
122
123Upload the binaries:
124
125```
126$ cd angle/
127$ ./tools/flex-bison/update_flex_bison_binaries.py
128```
129
130[Bison]: https://www.gnu.org/software/bison/
131