Hash :
e3199b5f
Author :
Date :
2024-11-21T14:17:47
Add bison/flex binaries on Mac. Use the same bucket as Windows and Linux (mac folder). Update documentation for how to get and update these binaries. Bug: angleproject:377941128 Change-Id: Ia2de3bb4e98109821d1adeb22d0cbc49edc07b1d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6042552 Commit-Queue: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
This folder contains the flex and bison binaries. We use these binaries to generate the ANGLE translator’s lexer and parser.
Use the script update_flex_bison_binaries.py
to update the versions of these binaries in cloud storage. It must be run on
Linux or Windows. It will update the SHAs for your platform. After running the
script run git commit and then git cl upload to code review using the normal
review process. You will also want to run
scripts/run_code_generation.py to
update the generated files.
Please update Windows, Linux and Mac binaries at the same time. Start with Windows, then merge your work into a single CL that updates all binaries simultaneously.
If you get authentication errors while uploading, try running:
$ download_from_google_storage --config
Contact syoussefi for any help with updating the binaries.
This is expected to be a rare operation, and is currently done based on the following instructions. Note: get the binaries first on windows, as only a single option is available, then build the binaries for the same version on Linux/Mac.
Install MSys2 (x86_64) from http://www.msys2.org/ on Windows. flex should
already be installed. Install bison:
$ pacman -S bison
Note the versions of flex and bison, so you can build the exact same versions on Linux. For example:
$ flex --version
flex 2.6.4
$ bison --version
bison (GNU Bison) 3.8.2
The only dependencies outside /Windows/ from MSys2 should be the following:
msys-intl-8.dll
msys-iconv-2.dll
msys-2.0.dll
This can be verified with:
$ ldd /usr/bin/flex
$ ldd /usr/bin/bison
Additionally, we need the binary for m4 at /usr/bin/m4.
Copy all these 5 files to this directory:
$ cd angle/
$ cp /usr/bin/flex.exe \
/usr/bin/bison.exe \
/usr/bin/m4.exe \
/usr/bin/msys-intl-8.dll \
/usr/bin/msys-iconv-2.dll \
/usr/bin/msys-2.0.dll \
tools/flex-bison/windows/
Upload the binaries:
$ cd angle/
$ py tools/flex-bison/update_flex_bison_binaries.py
# Get the source of flex
$ git clone https://github.com/westes/flex.git
$ cd flex/
# Checkout the same version as msys2 on windows
$ git checkout v2.6.4
# Build
$ autoreconf -i
$ mkdir build && cd build
$ ../configure CFLAGS="-O2 -D_GNU_SOURCE"
$ make -j
# Get the source of bison
$ curl http://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz | tar -xJ
$ cd bison-3.8.2
# Build
$ mkdir build && cd build
$ ../configure CFLAGS="-O2"
$ make -j
Note: Bison’s home page lists ftp server and other mirrors. If the above link is broken, replace with a mirror.
Copy the 2 executables to this directory:
$ cd angle/
$ cp /path/to/flex/build/src/flex \
/path/to/bison/build/src/bison \
tools/flex-bison/linux/
Upload the binaries:
$ cd angle/
$ ./tools/flex-bison/update_flex_bison_binaries.py
Use homebrew to install flex and bison:
$ brew install flex bison
Find the install locations using brew info:
$ brew info bison
...
/opt/homebrew/Cellar/bison/3.8.2 (100 files, 3.7MB)
...
Copy the 2 executables to this directory:
$ cd angle/
$ cp -r \
/path/to/bison/install/bin \
/path/to/flex/install/bin \
tools/flex-bison/mac/
Upload the binaries:
$ cd angle/
$ ./tools/flex-bison/update_flex_bison_binaries.py
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
# flex and bison binaries
This folder contains the flex and bison binaries. We use these binaries to
generate the ANGLE translator's lexer and parser.
Use the script [`update_flex_bison_binaries.py`](update_flex_bison_binaries.py)
to update the versions of these binaries in cloud storage. It must be run on
Linux or Windows. It will update the SHAs for your platform. After running the
script run `git commit` and then `git cl upload` to code review using the normal
review process. You will also want to run
[`scripts/run_code_generation.py`](../../scripts/run_code_generation.py) to
update the generated files.
Please update Windows, Linux and Mac binaries at the same time. Start with
Windows, then merge your work into a single CL that updates all binaries
simultaneously.
If you get authentication errors while uploading, try running:
```
$ download_from_google_storage --config
```
Contact syoussefi for any help with updating the binaries.
## Updating flex and bison binaries
This is expected to be a rare operation, and is currently done based on the
following instructions. Note: get the binaries first on windows, as only a
single option is available, then build the binaries for the same version on
Linux/Mac.
### On Windows
Install MSys2 (x86_64) from http://www.msys2.org/ on Windows. `flex` should
already be installed. Install bison:
```
$ pacman -S bison
```
Note the versions of flex and bison, so you can build the exact same versions on Linux.
For example:
```
$ flex --version
flex 2.6.4
$ bison --version
bison (GNU Bison) 3.8.2
```
The only dependencies outside /Windows/ from MSys2 should be the following:
```
msys-intl-8.dll
msys-iconv-2.dll
msys-2.0.dll
```
This can be verified with:
```
$ ldd /usr/bin/flex
$ ldd /usr/bin/bison
```
Additionally, we need the binary for m4 at `/usr/bin/m4`.
Copy all these 5 files to this directory:
```
$ cd angle/
$ cp /usr/bin/flex.exe \
/usr/bin/bison.exe \
/usr/bin/m4.exe \
/usr/bin/msys-intl-8.dll \
/usr/bin/msys-iconv-2.dll \
/usr/bin/msys-2.0.dll \
tools/flex-bison/windows/
```
Upload the binaries:
```
$ cd angle/
$ py tools/flex-bison/update_flex_bison_binaries.py
```
### On Linux
```
# Get the source of flex
$ git clone https://github.com/westes/flex.git
$ cd flex/
# Checkout the same version as msys2 on windows
$ git checkout v2.6.4
# Build
$ autoreconf -i
$ mkdir build && cd build
$ ../configure CFLAGS="-O2 -D_GNU_SOURCE"
$ make -j
```
```
# Get the source of bison
$ curl http://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz | tar -xJ
$ cd bison-3.8.2
# Build
$ mkdir build && cd build
$ ../configure CFLAGS="-O2"
$ make -j
```
Note: Bison's [home page][Bison] lists ftp server and other mirrors. If the
above link is broken, replace with a mirror.
Copy the 2 executables to this directory:
```
$ cd angle/
$ cp /path/to/flex/build/src/flex \
/path/to/bison/build/src/bison \
tools/flex-bison/linux/
```
Upload the binaries:
```
$ cd angle/
$ ./tools/flex-bison/update_flex_bison_binaries.py
```
### On Mac
Use homebrew to install flex and bison:
```
$ brew install flex bison
```
Find the install locations using `brew info`:
```
$ brew info bison
...
/opt/homebrew/Cellar/bison/3.8.2 (100 files, 3.7MB)
...
```
Copy the 2 executables to this directory:
```
$ cd angle/
$ cp -r \
/path/to/bison/install/bin \
/path/to/flex/install/bin \
tools/flex-bison/mac/
```
Upload the binaries:
```
$ cd angle/
$ ./tools/flex-bison/update_flex_bison_binaries.py
```
[Bison]: https://www.gnu.org/software/bison/