Having support for the '%' operator makes it easier to implement
even/odd version checks, like:
enable_debug = get_option('enable-debug')
if enable_debug == 'auto'
if minor_version % 2 == 0
enable_debug = 'minimum'
else
enable_debug = 'yes'
endif
endif
which would be impossible without resorting to less obvious long-hand
forms like:
a - (b * (a / b))
Passing an absolute path to `install_dir` would previously always
attempt to install there, instead of obeying DESTDIR, since os.path.join
will 'reset' on absolute paths.
* Add a new compiler object method: has_members
Identical to 'cc.has_member', except that this takes multiple members
and all of them must exist else it returns false.
This is useful when you want to verify that a structure has all of
a given set of fields. Individually checking each member is horrifying.
* Fix typo in exceptions for has_member(s)
For commands that always output to stdout and don't have a "-o" or
"--output" or some other similar option, this 'capture' setting allows
the build to capture the result and place it in the output file.
This allows us to disable the shared library test if the GNU D compiler
is detected.
This is useful, because gdc can not yet build proper shared libraries.
We also add a new test here which tests versioning of D shared
libraries.
D allows programmers to define their tests alongside the actual code in
a unittest scope[1].
When compiled with a special flag, the compiler will build a binary
containing the tests instead of the actual application.
This is a strightforward and easy way to run tests and works well with
Mesons test() command.
Since using just one flag name to enable unittest mode would be too
boring, compiler developers invented multiple ones.
Adding this helper method makes it easy for people writing Meson build
descriptions for D projects to enable unittestmode.
[1]: https://dlang.org/spec/unittest.html
Alex Băluț reported that on OS X libfoo.0.dylib cannot be found as -lfoo by the
linker, and you must use -lfoo.0 instead. Add a test for this so the CI can
catch such problems. The next commit will contain the fix.
At the same time, this also adds a bunch of tests that document and keep
track of how we expect quoting to pass through via Ninja to the
compiler.
We need at least Ninja 1.6.0 for this.
This fixes https://github.com/mesonbuild/meson/issues/489
Also add new tests for the platform-specific and compiler-specific
versioning scheme.
A rough summary is:
1. A bug in how run_tests.py:validate_install checked for files has been
fixed. Earlier it wasn't checking the install directory properly.
2. Shared libraries are no longer installed in common tests, and the
library name/path testing is now done in platform-specific tests.
3. Executables are now always called something?exe in the
installed_files.txt file, and the suffix automatically corrected
depending on the platform.
4. If a test installs a file called 'no-installed-files', the installed
files for that test are not validated. This is required to implement
compiler-specific tests for library names/paths such as MSVC vs MinGW
5. The platform-specific file renaming in run_tests.py has been mostly
removed since it is broken for shared libraries and isn't needed for
static libraries.
6. run_tests.py now reports all missing and extra files. The logic for
finding these has been reworked.