Commit Graph

2616 Commits

Author SHA1 Message Date
Nirbheek Chauhan 107e061506 Error out when someone tries to use msys/python to run Meson
This mistake seems to be a very common hiccup for people trying to use
Meson with MSYS2 on Windows from git or with pip.

msys/python uses POSIX paths with '/' as the root instead of a drive
like `C:/`, and also does not identify the platform as Windows.

This means that configure checks will be wrong, and many build tools
will be unable to parse the paths that are returned by functions in
Python such as shutil.which.

Closes https://github.com/mesonbuild/meson/issues/3653
2018-06-03 18:59:24 +00:00
Marvin Scholz d777ffc040 Fix #mesondefine token error message formatting 2018-06-03 21:28:47 +03:00
Mathieu Duponchelle b3feff3032 test extra paths: add extra paths for all build targets 2018-06-02 11:42:48 +00:00
Mathieu Duponchelle 35ab34d6cd test serialisation: determine windows extra paths ..
..  for executable arguments too.

This makes it possible to pass an executable to a test, which
can then run it in an appropriate environment.
2018-06-02 11:42:48 +00:00
Filipe Brandenburger df2f6a71e7 Make windows_proof_rmtree resilient to read-only files
Start the process by traversing the tree and adding the S_IWRITE and
S_IREAD bits to the file's mode (which are also preserved on Windows.)

This fixes windows_proof_rmtree's inability to remove read-only files,
which was uncovered in testing the new `install_mode` feature.

Tested: ./run_tests.py passes on Linux, appveyor CI on Windows passes.
2018-06-02 04:50:32 +00:00
Filipe Brandenburger 05c43cdcd1 Add 'install_mode' to all installable targets
This makes it possible to customize permissions of all installable
targets, such as executable(), libraries, man pages, header files and
custom or generated targets.

This is useful, for instance, to install setuid/setgid binaries, which
was hard to accomplish without access to this attribute.
2018-06-02 04:50:32 +00:00
Jon Turney aa27f7cec9 Add a depend_files: keyword to windows.compile_resources()
Expose depend_files: from the custom_target this creates.

This is the change suggested in #2815, with tests and documentation added.

Fixes #2789 (duplicate #2830)
2018-06-01 20:21:09 +00:00
Jussi Pakkanen bf2e21ec0e
Merge pull request #3486 from Salamandar/salamandar/meson_version_introspection
Add FeatureNew and FeatureDeprecated, to alert the user of bad meson_version
2018-06-01 22:53:06 +03:00
Nirbheek Chauhan 0a035dea6d Set the meson command to use when we know what it is
Instead of using fragile guessing to figure out how to invoke meson,
set the value when meson is run. Also rework how we pass of
meson_script_launcher to regenchecker.py -- it wasn't even being used

With this change, we only need to guess the meson path when running
the tests, and in that case:

1. If MESON_EXE is set in the env, we know how to run meson
   for project tests.
2. MESON_EXE is not set, which means we run the configure in-process
   for project tests and need to guess what meson to run, so either
   - meson.py is found next to run_tests.py, or
   - meson, meson.py, or meson.exe is in PATH

Otherwise, you can invoke meson in the following ways:

1. meson is installed, and mesonbuild is available in PYTHONPATH:
   - meson, meson.py, meson.exe from PATH
   - python3 -m mesonbuild.mesonmain
   - python3 /path/to/meson.py
   - meson is a shell wrapper to meson.real
2. meson is not installed, and is run from git:
   - Absolute path to meson.py
   - Relative path to meson.py
   - Symlink to meson.py

All these are tested in test_meson_commands.py, except meson.exe since
that involves building the meson msi and installing it.
2018-06-01 19:20:04 +00:00
Mathieu Duponchelle 14750b50ea configure_file: Add output_format kwarg (#3636)
* configure_file: Add output_format kwarg

* docs: Reference-manual.md output_format was added in 0.47 [skip ci]
2018-06-01 17:53:07 +00:00
Salamandar c5e85e59cc Add 0.47.0 features 2018-06-01 14:23:24 +02:00
Salamandar 2fb6018763 Add 0.46.0 features 2018-06-01 14:23:24 +02:00
Salamandar 364b8a37b9 Add 0.45.0 features 2018-06-01 14:23:24 +02:00
Salamandar c90885de6d Add 0.44.0 features 2018-06-01 14:23:24 +02:00
Salamandar 2056172595 Add 0.43.0 features 2018-06-01 14:23:24 +02:00
Salamandar 4741f1e243 Add 0.42.0 features 2018-06-01 14:23:24 +02:00
Salamandar d5207e1c4f Add 0.41.0 features 2018-06-01 14:23:24 +02:00
Salamandar fa6550b277 Add 0.40.0 features 2018-06-01 14:23:24 +02:00
Salamandar a1a53e8de1 Add 0.38.0 features 2018-06-01 14:23:24 +02:00
Salamandar accea4889b Add 0.37.0 features 2018-06-01 14:23:24 +02:00
Salamandar 69230ce4ef print features reports after run 2018-06-01 14:23:24 +02:00
Salamandar 00c4cf7d45 Add Feature{New,Deprecated}Kwargs decorators 2018-06-01 14:23:24 +02:00
Salamandar dd91f96867 Move target_version from coredata to mesonlib 2018-06-01 14:23:24 +02:00
Salamandar b9c37e4fd2 Add set instead of list for used features lits 2018-06-01 14:23:24 +02:00
Salamandar 4978dc0124 Cleanup : have more common code between FeatureNew and FeatureDeprecated 2018-06-01 14:23:24 +02:00
Salamandar 806ab181f2 Split function wrapper from a use() method 2018-06-01 14:23:24 +02:00
Salamandar ae19fec952 Add version_compare_condition_with_{min,max} for specific comparison utils.
Split FeatureNew and FeatureDeprecated
Implement features report to be printed in some 'dev mode'
2018-06-01 14:23:24 +02:00
Salamandar ee2f8a0416 Add basic code for feature version detection:
* store target version
* Add empty method decorator
2018-06-01 14:23:24 +02:00
Filipe Brandenburger 4e0a417763 Revert "commandrunner: make run handle python options"
This reverts commit ab599b5733.
2018-06-01 07:22:41 +00:00
Nirbheek Chauhan f56b402a5b Revert "mesonlib: handle meson exe wrappers"
This reverts commit 0627e9d616.

Breaks installation: https://github.com/mesonbuild/meson/issues/3647

Will be restored once that can be fixed.
2018-05-31 15:40:10 +05:30
Jussi Pakkanen 05f8b1bd78
Merge pull request #3643 from mesonbuild/nirbheek/check_header
New compiler method: check_header
2018-05-30 23:32:31 +03:00
Nirbheek Chauhan 00654aeb11 Don't accept an empty string for name_suffix:
This is never going to be useful, and the error message now points
people to what they might be expecting: use the default value for this
platform.
2018-05-30 23:10:43 +03:00
Martin Kelly 0627e9d616 mesonlib: handle meson exe wrappers
There are cases when it is useful to wrap the main meson executable with
a script that sets up environment variables, passes --cross-file, etc.
For example, in a Yocto SDK, we need to point to the right meson.cross
so that everything "just works", and we need to alter CC, CXX, etc. In
such cases, it can happen that the "meson" found in the path is actually
a wrapper script that invokes the real meson, which may be in another
location (e.g. "meson.real" or similar).

Currently, in such a situation, meson gets confused because it tries to
invoke itself using the "meson" executable (which points to the wrapper
script) instead of the actual meson (which may be called "meson.real" or
similar). In fact, the wrapper script is not necessarily even Python, so
the whole thing fails.

Fix this by using Python imports to directly find mesonmain.py instead
of trying to detect it heuristically. In addition to fixing the wrapper
issue, this should make the detection logic much more robust.
2018-05-30 18:29:16 +00:00
Martin Kelly ab599b5733 commandrunner: make run handle python options
Currently, commandrunner breaks when we give options to python because
it assumes python commands are in the form "python script.py", rather
than "python -u script.py" or "python -u -m module script.py". Extend it
to be more resilient and correctly parse python options.
2018-05-30 18:29:16 +00:00
Martin Kelly 0f86df4d23 make ExternalProgram get_path() a bit smarter
Currently, ExternalProgram get_path() assumes the last component in the
path is always the actual command path. However, this is not always
right. For example, in the command "python -u", we should return
"python" and not "-u". However, in other cases, like "python script.py",
then the last component is the right one.

The heuristic that seems to capture this is to use the last argument
that is still a file. This means options get ignored, but "python
script.py" still works. Let's use this heuristic, at least for now.
2018-05-30 18:29:16 +00:00
Nirbheek Chauhan ff07314a86 New compiler method: check_header
This checks not only for existence, but also for usability of the
header, which means it does a full compilation and not just
pre-processing or __has_include.

Fixes https://github.com/mesonbuild/meson/issues/2246
2018-05-30 15:25:39 +05:30
Christoph Reiter a87496addd Don't raise StopIteration in generators, no longer allowed with Python 3.7. Fixes #3622
Raising StopIteration from a generator has been deprecated with Python 3.5 and is now
an error with Python 3.7: https://docs.python.org/3.8/library/exceptions.html#StopIteration

Just use return instead.
2018-05-29 21:58:49 +03:00
George Koehler 64906b0755 Don't call getpgid() when killing a test.
OpenBSD's getpgid(2) fails with EPERM (PermissionError) because the
test is in a different session: https://man.openbsd.org/getpgid

Use p.pid as the process group ID, because setsid() created a process
group with the same ID as the process.  See setsid(2) manuals:

 - FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=setsid
 - illumos: https://illumos.org/man/setsid
 - Linux: http://man7.org/linux/man-pages/man2/setsid.2.html

This change fixes 'manual tests/8 timeout' on OpenBSD.  To verify this
change, one must run the manual test.  For example,

    $ cd 'manual tests/8 timeout'
    $ meson build
    $ ninja -C build test

It should report that the test timed out, and not show
PermissionError.

Fixes https://github.com/mesonbuild/meson/issues/3569
2018-05-29 02:14:52 +02:00
Jussi Pakkanen cc3e0bc469
Merge pull request #3491 from jeandet/qt_private_headers
Qt private headers
2018-05-27 23:50:30 +03:00
Jussi Pakkanen 320a5865d9 Mark even empty confs used appropriately. 2018-05-25 17:43:06 +03:00
Jussi Pakkanen c8256a30a0
Merge pull request #3578 from MathieuDuponchelle/mkenums_gen_templates
gnome/mkenums: allow passing generated files as templates
2018-05-24 22:30:06 +03:00
Jussi Pakkanen 41ab5166e4
Merge pull request #3476 from filbranden/intbase1
Add support for octal and binary int literals
2018-05-24 22:21:40 +03:00
Jussi Pakkanen 160da30732 Typos are fun. [skip ci] 2018-05-24 22:19:49 +03:00
Nirbheek Chauhan 1ffbddc31a backends: Also accept dylibs while finding RPATHs 2018-05-24 14:38:28 +00:00
Nirbheek Chauhan fecd580687 backends: Simplify loop getting rpaths for bundled libs
No functionality changes
2018-05-24 14:38:28 +00:00
Nirbheek Chauhan 165da6fb65 backends: Use a set while gathering RPATHs 2018-05-24 14:38:28 +00:00
Nirbheek Chauhan 9f616e98bf depfixer: Run install_name_tool only once while deleting rpaths 2018-05-24 14:38:28 +00:00
Nirbheek Chauhan a6c9f98c57 depfixer: We no longer run this as a script 2018-05-24 14:38:28 +00:00
Mathieu Duponchelle 6dd896d001 gnome/mkenums: allow passing generated files as templates 2018-05-23 23:23:08 +02:00
Filipe Brandenburger 86d2f57e86 Add support for octal and binary int literals.
Simplify support for alternate bases using int(..., base=0) which
auto-detects it using the standard Python syntax for numbers.

Octal numbers are useful to specify permission bits and umasks.

Binary numbers are not super useful... But considering we get them for
free, let's allow them here too.

v2: Tweak the regex so it doesn't accept a decimal number with a leading
zero, which is invalid for int(..., base=0) and would raise a ValueError
if passed around.
2018-05-23 14:07:38 -07:00