Before, the logic initialization compiler options from environment
variables vs config files was strewn about. Now, it is consolidated. We
leverage the new `envconfig.py` module to expose the configuration data
to `compilers.py` without creating an import cycle.
1. They (and the others) all use PerMachineDefaultable. It's not the
best class, but consistency come first. (It and all of them can be
improved accross the board later.)
2. They use `None` as the default argument so as not to mutate what's
effectively a global variables. (Thanks @dcbaker!)
3. They have a `fallback` field to centralize authority on when
environment variables should be consulted.
First of all, I'd like compilers and other modules that environment.py
currently imports to be able to take these without creating
hard-to-follow module cycles.
Second of all, environment.py's exact purpose seems a bit obscured.
Splitting the data types (and basic pure functions) from the more
complex logic that infers that data seems like a good way to separate
concerns.
By using private_dir_include() instead of enumerating headers in sources
of declare_dependency. Much more convenient, especially when there are
many headers.
Found out about this by reading #4638. It is not documented anywhere as
far as I can tell.
This makes the testsuite work better with other test runners, like
pytest. This is important because better test runners are very useful to
development (e.g. avoiding running succeeding tests again and again),
even if we want to still support 0 dependency testing of Meson though
keeping the default test runnner working.
Fix get_library_dirs() on FreeBSD to only return /usr/local/lib,
/usr/lib and /lib as the default location to look for libraries.
FreeBSD does not use lib/${platform} or lib64 by default. In general,
those directories should not exist, but in case they do, ensure they're
not picked up.
Fix defaul_libdir() on FreeBSD. The current behaviour of using
usr/lib64 if that exists is wrong on FreeBSD. The default should be to
always use usr/lib, even if usr/lib64 exists as a folder in the file
system. Fix this by checking if we're running on FreeBSD and then
always return 'lib' in default_libdir().