Commit Graph

316 Commits

Author SHA1 Message Date
Nirbheek Chauhan 0565262be3 Add documentation for Builtin options and bitcode
Also add a test that ensures that new base options and compiler options
are always documented.
2018-06-06 07:53:10 +00:00
Nirbheek Chauhan 3e1a610702 Add a new option for building with Apple bitcode support
Normally, people would just pass -fembed-bitcode in CFLAGS, but this
conflicts with -Wl,-dead_strip_dylibs and -bundle, so we need it as
an option so that those can be quietly disabled.
2018-06-06 07:53:10 +00:00
Nirbheek Chauhan 68001193d3 meson introspect: Fix --installed argument
Traceback (most recent call last):
  File "meson.py", line 29, in <module>
    sys.exit(mesonmain.main())
  File "mesonbuild/mesonmain.py", line 411, in main
    return run(sys.argv[1:], launcher)
  File "mesonbuild/mesonmain.py", line 320, in run
    return mintro.run(remaining_args)
  File "mesonbuild/mintro.py", line 234, in run
    list_installed(installdata)
  File "mesonbuild/mintro.py", line 72, in list_installed
    for path, installdir, aliases, unknown1, unknown2 in installdata.targets:
ValueError: too many values to unpack (expected 5)
2018-06-06 06:59:06 +00:00
Jon Turney ac480c1857 Extend test_rc_depends_files test case
Extend test_rc_depends_files test case to also cover depfile generation for
a resource file generated by a custom_target
2018-06-03 21:06:23 +00:00
Jon Turney 7a15214a69 Have the windows.resource_compiler() preprocesor write a depfile
When using binutils's windres, we can instruct it to invoke the preprocessor
in such a way that it writes a depfile, so that dependencies on #included
files are automatically tracked.

Not implemented for MSVC tools, so skip testing it in that case.
2018-06-03 21:06:23 +00:00
Filipe Brandenburger 04c39ad562 Add extended unit test for 'install_mode'
This new unit test will use the targets in '198 install_mode' and
confirm that every file and directory gets the expected mode, ensuring
that the setting is properly applied at install time.
2018-06-02 04:50:32 +00:00
Filipe Brandenburger 0ccc0e92d1 Check mode of file, not subdirectory, in install_subdir.
When using an install_mode in install_subdir(), that should apply to the
files and not to the directory tree.

Otherwise, an install_mode not including the executable bit will make
the tree inaccessible, since directories need it to be traversed.

If the mode needs to be applied to both files and directories, then
install_subdir() is only useful to install files with the executable bit
set, which is not really that useful...

So default to just using the umask for the directories and applying
install_mode to the files only.

This can be reviewed in the future, possibly by adding a separate
install_dir_mode attribute, or perhaps adding an optional fourth field
to FileMode with the mode for directories (this is similar to how RPM
handles specifying mode of directory trees recursively added to the
package.)
2018-06-02 04:50:32 +00:00
Jon Turney 6bab3d40a9 Fix assertRebuiltTarget with VS backend
For the VS backend, assertRebuiltTarget() asserts the that target is both
recompiled and relinked.  This isn't correct for test_rc_depends_files, as
changing the rc script's dependencies only causes the executable to be
relinked, and not to also have it's source recompiled.

assertRebuiltTarget already gets this right for the ninja backend.
2018-06-01 20:21:09 +00:00
Jon Turney b7df392e9f Also run Windows unit tests on Cygwin 2018-06-01 20:21:09 +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
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
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
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 b6995aac70 run_unittests: typo fix 2018-05-30 18:29:16 +00:00
Jussi Pakkanen 55a0831bc3
Merge pull request #3383 from mesonbuild/nirbheek/configure-file-nodata
configure_file: Add a new action 'copy'
2018-05-22 21:09:19 +03:00
Nirbheek Chauhan a00433fdbc configure_file: Add a new action 'copy'
This will copy the file to the build directory without trying to read
it or substitute values into it.

Also do this optimization if the configuration_data() object passed to
the `configuration:` kwarg is empty, and print a warning about it.

See also: https://github.com/mesonbuild/meson/issues/1542
2018-05-22 02:36:55 +05:30
Mathieu Duponchelle 5bb863c891 dict: unit test integer key 2018-05-21 00:23:49 +02:00
Mathieu Duponchelle 10e7566ed8 dict: fix CI issues 2018-05-21 00:19:31 +02:00
Mathieu Duponchelle 195c356f91 dict: address review comments 2018-05-20 22:36:18 +02:00
Jon Turney 13e92223be Generalize message about fallback failure
The fallback might be not used not only because it couldn't be found, but
also because something went wrong trying to use it.

Also, update a test which relies on the specific text
2018-05-17 00:26:58 +03:00
Nirbheek Chauhan 0dd4635842 unit tests: Undo accidental disabling of test
Was accidentally merged.

https://github.com/mesonbuild/meson/pull/3240/files#r181593745
2018-05-10 12:30:47 +02:00
Nirbheek Chauhan 86cc4f2707 gdbus_codegen: Guess the output list for docbook generation
We were setting it to a file list that would always be wrong, and
always out of date since it would never exist.

However, the output list is not predictable. It usually has a 1-1
relationship with the input XML files, but it may not.

This must be fixed later with API for users to provide the output
names.

See: https://github.com/mesonbuild/meson/pull/3539
2018-05-09 21:04:55 +05:30
Nirbheek Chauhan 575ffec62e python module: Move tests to test cases/unit
The tests are only run via unit tests, so that's where they should be.
2018-05-03 18:56:34 +05:30
Mathieu Duponchelle 8bda86faab python module: make it work with pypy
pypy installations don't usuallyy ship with pkg-config files,
we thus need to replicate what their version of distutils does.

In addition, we also try our best to build against other
pythons that do not have pkg-config files.
2018-05-03 18:50:40 +05:30
Nirbheek Chauhan badbfa125c pkgconfig: Don't expose internal libraries in .pc files
Libraries that have been linked with link_whole: are internal
implementation details and should never be exposed to the outside
world in either Libs: or Libs.private:

Closes https://github.com/mesonbuild/meson/issues/3509
2018-05-02 11:46:47 +00:00
Jussi Pakkanen 2b5766980b Keep separator spaces in pkg-config declarations. Closes #3479. 2018-05-02 11:46:47 +00:00
Xavier Claessens 6de68e5201 Passing --default-library=both should override project value
Looks like this has always been broken, had_argument_for() was checking
if we have --default_library instead of --default-library.
2018-04-27 11:19:12 -04:00
Xavier Claessens 5970f1be3c Passing --bindir twice is fine
Unit test was asserting that
"meson --bindir=foo --bindir=bar" must succeed and
"meson configure --bindir=foo --bindir=bar" must fail.
There should be no difference between those 2 command lines.

In this case it's fine to have it twice because there is no ambiguity,
second overrides the first, that's done by python's argparse.
2018-04-27 11:09:14 -04:00
Xavier Claessens 570c108635 Fix --warnlevel being renamed to --warning-level in latest release 2018-04-27 11:09:14 -04:00
Jussi Pakkanen 9b0453d3e9
Merge pull request #3225 from filbranden/fixperms3
Introduce install_umask to determine permissions of files in install tree. Default it to 022
2018-04-26 23:14:00 +03:00
Dylan Baker 185ae3d420 tests: Add the same kind of tests for configure. 2018-04-25 20:59:27 +03:00
Dylan Baker b8f1b84733 Tests: Add some tests for mixing -Dfoo and --foo
These are at least some of the tests that really deserved to be written
for 78e37c4953, but I was lazy.
2018-04-25 20:59:27 +03:00
Jussi Pakkanen 01865899e5 Skip snippet validation if docs dir does not exist. 2018-04-23 03:24:26 +03:00
Jussi Pakkanen 83ffb3ea02 Use the correct file path. Not the wrong one. 2018-04-23 02:16:30 +03:00
Martin Hostettler 247b1a598a regression: pkgconfig module: Fix Fix regression in Requires.private generation.
The fix for Requires generation in #3406 missed a second code path with the same
problem.

Passing a pkgconfig dependency to requires would produce Q, t, 5, C, o,r, e'
instead of 'Qt5Core'.

This was introduced in 8efd940.
2018-04-20 00:59:06 +03:00
Filipe Brandenburger 59b0fa9722 Add a unit test for install_umask.
This test copies a src tree using umask of 002, then runs the build and
install under umask 027. It ensures that the default install_umask of
022 is still applied to all files and directories in the install tree.
2018-04-18 11:44:54 -07:00
Jussi Pakkanen 8d5c33f92f Renamed test dirs so numbers are sequential. 2018-04-18 00:33:41 +03:00
Jussi Pakkanen 3fc1ca8687
Merge pull request #3240 from MathieuDuponchelle/python_module
Implement a generic python module
2018-04-17 23:17:43 +03:00
Aleksey Filippov f4ea6ac454 Add '189 same target name flat layout' test 2018-04-16 22:51:34 +01:00
Aleksey Filippov cb761718f0 Generate target id based on subdirectory instead of subproject
Allows creation of targets with same name in different subdirectories.
Closes #2861 and closes #1867
2018-04-16 22:51:34 +01:00
Nirbheek Chauhan ef81a013a5 cross: Add compiler cross_args after normal args
This way they override all other arguments. This matches the order of
link arguments too.

Note that this means -I flags will come in afterwards and not override
anything else, but this is correct since that's how toolchain paths
work normally too -- they are searched last.

Closes https://github.com/mesonbuild/meson/issues/3089
2018-04-15 22:29:49 +03:00
Jussi Pakkanen 86f725c1e5
Merge pull request #3115 from makise-homura/e2k-lcc-support
Support lcc compiler for e2k (Elbrus) architecture
2018-04-15 17:18:44 +03:00
Martin Hostettler aff597fb99 ninjabackend: Try to guess library dependencies for linker invocation.
The linkers currently do not support ninja compatible output of
dependencies used while linking. Try to guess which files will be used
while linking in python code and generate conservative dependencies to
ensure changes in linked libraries are detected.

This generates dependencies on the best match for static and shared
linking, but this should not be a problem, except for spurious
rebuilding when only one of them changes, which should not be a problem.

Also makes sure to ignore any libraries generated inside the build, to
keep the optimisation working where changes in a shared library only
cause relink if the symbols have changed as well.
2018-04-15 07:29:21 +00:00
Martin Hostettler 3f7c6cf3d6 Improve generation of pkg-config files for static only libraries.
Previously pkg-config files generated by the pkgconfig modules for static libraries
with dependencies could only be used in a dependencies with `static: true`.

This was caused by the dependencies only appearing in Libs.private even
if they are needed in the default linking mode. But a user of a
dependency should not have to know if the default linking mode is static
or dynamic; A dependency('somelib') call should always pull in all
needed pieces into the build.

Now for meson build static libraries passed via `libraries` to the generate
method automatically promote dependencies to public.
2018-04-14 23:43:29 +03:00
textshell 0535f38af9 pkgconfig module: Fix regression that Requires.private is generated as 'Q, t, 5, C, o, r, e' instead of Qt5Core. (#3406) 2018-04-14 21:57:12 +03:00
Daniel Schulte 57654bf367 Deduplicate dependencies resolved to absolute paths
If paths are absolute the order of search directories is not relevant as the path is already resolved.
2018-04-13 01:05:25 +00:00
Mathieu Duponchelle dce770c0a7 [fixup]: Fix python2 detection and unit test 2018-04-09 02:06:22 +02:00
Mathieu Duponchelle 1105ba3afd [fixup]: rename test after rebase 2018-04-07 16:13:59 +02:00
Mathieu Duponchelle ae460f94ce [fixup]: Add test 2018-04-06 23:48:48 +02:00
Mathieu Duponchelle 1ad8b49755 run_unittests: disable testsetup_selection
It randomly stays stuck and breaks CI
2018-04-06 22:43:36 +02:00