1# meson_to_hermetic: automated build system generation 2 3Goal: ease the integration of Mesa as a component inside larger projects like 4Android (AOSP). 5 6How: parse the meson build tree into a python build script, which can be used 7together with configuration and options to generate other kinds of build scripts. 8 9Status: useful, but rough. Supports Android (Soong) and Fuchsia (Bazel). 10 11## Python Dependencies 12- Python 3.11+ 13 - See `requirements.txt` 14 - [](https://github.com/astral-sh/ruff) 15 16## Environment Setup 17 181. Open a terminal within `mesa3d/meson_to_hermetic` 192. Run the `setup-venv.sh` file to automatically create a python3 venv and install dependencies. 20 21## Linting the code 221. Before pushing code for review; run `lint.sh` to automatically lint all of the python scripts. 23 - IMPORTANT: Run the lint.sh from the `meson_to_hermetic` directory. 24 25## 1 - Generate python from meson 26 27generate_python_build.py: reads meson.build files (following subdir() commands) 28and uses meson2python to transform the meson into python. 29 30meson2python.py: passes meson.build input and the meson grammar to 31[python lark](https://github.com/lark-parser/lark) to perform lexing and parsing; then 32transforms the parse tree into valid python. The result is one large python script. 33 34## 2 - Generate Android.bp from python 35 36meson_android.py defines the meson API entry points and emits Android.bp build 37constructs. A config file is read to determine some build parameters such as 38`cpu_family` (similar to meson's cross file). 39 40## Limitations 41 42Meson build options must be set by modifying the defaults in meson_options.txt. 43