And use generic build/clean/test/install commands in the unit tests,
just like project tests. This sets the groundwork for running the unit
tests with all backends.
When cross compiling with mingw it's problematic to assume that there is
a binary called windres, and having to set it via an environment
variable seems wrong when there is a handy cross-file for just such a
situation.
This patch allows setting windres in the [binaries] section of the cross
file. If the build is a cross build, then the windows module will check
for windres being set in the cross file before checking the WINDRES
environment variable or looking for a windres binary.
I don't really know how to explain this briefly...
If you don't decorate this with dllimport, then a Cygwin runtime relocation
is used (a so called 'pseudo-reloc'). As the relocation offset is only 32
bits, this can fail on x86_64 if the DLL happens to be loaded more than 2GB
away from the reference.
If you decorate with dllimport, then access is indirected via a pointer,
imp_square_unsigned, which is fixed up by the loader.
'test cases/common/12 data' and 'test cases/common/66 install subdir' both
try to install something as 'root'. This user doesn't exist on Cygwin.
Perhaps we should automatically convert this to some other user, but it's
not clear which. For real projects, it's possibly better for the meson.build
to explicitly handle this...
'test cases/common/12 data' also tries to install something with GID 0.
There's no guarantee this group exists.
Including newlib's <stdlib.h> brings in a '#define __has_include 0', so
using -U__has_include on the command line isn't going to remove it (so the
fallback doesn't happen and the test fails)
Instead use a '#undef __has_include' at the end of the prefix to excerise
this.
(newlib's <stdlib.h> is derived from FreeBSD, so the same problem will
probably be seen there)
Cygwin executables are still loaded by the Windows PE loader, so PATH needs
to include any extra directories where required DLLs can be found.
Cygwin uses a unix style ':'-separated PATH. os.pathsep is used correctly
on extra_paths in meson_exe.py, but not in mesontest.py
* Don't crash if a meson.build file is empty
Commit 9adef3a8e8 caused an empty meson.build file to generate a traceback:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/mesonbuild/mparser.py", line 415, in getsym
self.current = next(self.stream)
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 298, in run
app.generate()
File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 180, in generate
intr.run()
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreter.py", line 2529, in run
super().run()
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 125, in run
self.evaluate_codeblock(self.ast, start=1)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 146, in evaluate_codeblock
raise e
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 140, in evaluate_codeblock
self.evaluate_statement(cur)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 151, in evaluate_statement
return self.function_call(cur)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 372, in function_call
return self.funcs[func_name](node, self.flatten(posargs), kwargs)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 47, in wrapped
return f(self, node, args, kwargs)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreter.py", line 2237, in func_subdir
self.evaluate_codeblock(codeblock)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 146, in evaluate_codeblock
raise e
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 140, in evaluate_codeblock
self.evaluate_statement(cur)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 151, in evaluate_statement
return self.function_call(cur)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 372, in function_call
return self.funcs[func_name](node, self.flatten(posargs), kwargs)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 47, in wrapped
return f(self, node, args, kwargs)
File "/usr/lib/python3.6/site-packages/mesonbuild/interpreter.py", line 2233, in func_subdir
codeblock = mparser.Parser(code, self.subdir).parse()
File "/usr/lib/python3.6/site-packages/mesonbuild/mparser.py", line 410, in __init__
self.getsym()
File "/usr/lib/python3.6/site-packages/mesonbuild/mparser.py", line 417, in getsym
self.current = Token('eof', '', self.current.line_start, self.current.lineno, self.current.colno + self.current.bytespan[1] - self.current.bytespan[0], (0, 0), None)
AttributeError: 'Parser' object has no attribute 'current'
This would make it harder to parse an option to mesonconf such
as -Dfoo:bar:baz:fun=value since it could mean either of these:
* For subproject 'foo:bar:baz', set the option 'fun' to 'value'
* For subproject 'foo:bar', an invalid option 'baz:fun' was set
To differentiate between these two we'd need to create the list of
subprojects first and then parse their options later, which
complicates the parsing quite a bit.
The configure_file command raised an exception when an input was specified as a
File, because os.path.join does not take File objects directly. This patch
converts a File object to a string and adjusts the subsequent os.path.join
calls.