Description
To get started with the (two-way) build script, let's begin with something simple to explore how we can implement the basic required infrastructure.
Getting a list of source files, that is something fpm usually does automatically, but maybe if you have submodules which implement different functionality like in the Focal project this could be needed.
The output of the build script could look like this (maybe we find better/shorter keywords):
fpm:library-source="src/lib.f90"
fpm:app-<name>-source="app/util.f90"
fpm:app-<name>-main="app/main.f90"
fpm:demo-<name>-source="example/util.f90"
fpm:demo-<name>-main="example/main.f90"
fpm:test-<name>-source="test/util.f90"
fpm:test-<name>-main="test/main.f90"
...
The input would be given by environment variables or maybe command line arguments.
FPM_COMPILER=gfortran
FPM_BUILD_PROFILE=debug
...
In case of Focal the build script could decide depending on the value of FPM_BUILD_PROFILE
which submodule source files to compile.
For the initial implementation we could just rely on the build script being executable, which would already allow shell, python, ruby, ... scripts as input. The input for the script would be in the build table:
[build]
script = "build.py"