-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Remaining work
- Reintroduce dynamic linking support #908
-
skip_testequivalent support and documentation.
Context
I am experimenting with building and packaging MESA for nixos using nix. I did the same with GYRE recently. In order to do that properly, I wanted to understand how MESA actually gets build. I found the existing combination of bash scripts and makefiles difficult to understand and adapt, so I ended up re-implementing the build system mostly from scratch. This issue is for me to check if what I'm proposing below is considered a meaningful improvement.
What I found to be not ideal in the current build system
- The combination of bash scripts and multiple makefiles in each module was confusing to look at at the start
- Quite some things were duplicated between different modules
- The
makesubfolders end up containing both the makefiles and build artifacts
What I ended up implementing
The implementation, with a few modules (const, utils, math, mtx, chem) ported can be found on https://github.com/VincentVanlaer/mesa/tree/new-build. The main flow is as follows:
Makefile (in repository root) -> single Makefile in each module -> makefiles in the make subfolder doing the heavy lifting
The system has the following benefits:
- All files produced by the build process end up in the build subfolder, making cleaning just deleting this folder
- Each module only has a single short Makefile as configuration
- Modules that do not depend on each other are built in parallel
In terms of lines of code, the changes are 162 files changed, 563 insertions(+), 2888 deletions(-) for the five modules ported.
Caveats & remarks
- Some files got updated to be buildable with Fortran 2008
- Minimal GNU make version required is 4.3 (released 2020) and would probably need to be packaged in the mesasdk
- Dependencies (including external dependencies such as lapack) are implemented using pkg-config (which would mean some small changes to the mesasdk). This is useful if you want to build without the sdk.
- I implemented and tested this only on my Linux installation
- Some aspects such as a updating the install script (i.e. as a user friendly wrapper) and openmp support are not yet done
Conclusions
I have two questions after all of this (which are difficult to answer for me given that I have written them):
- Are the new makefiles and scripts actually cleaner?
- If so, is it worth the further effort of development and testing to swap things over?
It might also be worth considering alternatives such as only applying some of the concepts, or porting to another build system such as Meson.
If you want to play with the Makefiles I can also upload a patched version of the mesasdk that contains the necessary changes and a gnumake install with at least version 4.3.