Commit Graph

12907 Commits

Author SHA1 Message Date
Dylan Baker 37663da83e tests: Add a test for a target with no sources
Since this was broken for a long time, we should have a test for it.
2022-09-09 19:13:46 -04:00
Andres Freund 91206aaeb0 vs: Fix CustomBuild contents.
%% survived into the output since 038b31e72b. That failed to fail, at
least in the common cases, because the whole command sequence is unnecessary /
redundant - it appears to come from cmake, which executes multiple commands
within a single CustomBuild element.
2022-09-09 18:37:30 -04:00
Xavier Claessens 1acccc862a doc: Recommend tags for libraries utilities
GLib installs a few executables that are not needed by applications that
use the glib libraries, but are used either by build systems or by user
scripts. Debian splits them into libglib2.0-dev-bin and libglib2.0-bin
packages. Another example is GStreamer tools (e.g. gst-launch-1.0) that
Debian packages separately in gstreamer1.0-tools.

It is common enough that Meson documentation should recommend a tag for
consistency across projects.
2022-09-09 18:24:18 -04:00
Eli Schwartz 2a76afcef1 compilers: drop some useless info from CompileResult
text_mode was never set, nor used, and pid was set but never used.
2022-09-09 14:12:14 -07:00
Eli Schwartz e3a4dc7218 compilers: fix regression in logging cached compile commands
In commit d326c87fe2 we added a special
holder object for cached compilation results, with some broken
attributes:

- "command", that was never set, but used to print the log

- "args", that was set to some, but not all, of the information a fresh
  compilation would log, but never used

Remove the useless args attribute, call it command, and use it properly.
2022-09-09 14:12:14 -07:00
Eli Schwartz 167356aeab
compilers: correct the MSVC version comparison for turning on __cplusplus
We compared a Visual Studio (the IDE) version, but we wanted a MSVC (the
compiler) version. This caused the option to be passed for a few too
many versions of MSVC, and emit a "D9002 : ignoring unknown option" on
those systems.

Compare the correct version using the version mapping from
https://walbourn.github.io/vs-2017-15-7-update/

Fixes #10787

Co-authored-by: CorrodedCoder <38778644+CorrodedCoder@users.noreply.github.com>
2022-09-07 17:27:55 -04:00
Eli Schwartz 7bdfe7ccb2 wrap: correctly override dependency names with capital letters
When we do wrap resolution, we do a case-insensitive lookup because
keys, i.e. `dep_name = variable_name`, are case insensitive. In order to
check whether we should process a subproject, we need to know if the
lowercased dependency name matches.

We do this by looking up the lowercase name, and assuming that the
stored name is also lowercase. But for dependency_names, this isn't "case
insensitive and stored in lowercase" so we need to manually force it to
be consistent.

Likewise, when looking up the wrap name (which works like
dependency_names and doesn't need a provide section at all) the disk
filename of the wrap file is case sensitive, but needs to be manually
forced for consistency.
2022-09-07 16:19:09 -04:00
Volker Weißmann 5fec9f5db9 Fixed string escaping in AstPrinter 2022-09-07 08:56:51 -04:00
Rosen Penev 26acf2152d minstall: handle extra error for selinuxenabled
Microsoft's WSL2 uses a Plan 9 filesystem, which returns IOError when file is missing.
2022-09-07 08:46:50 -04:00
Mark Bolhuis a289e5416b modules/wayland: Change default value of include_core_only to true
The use of wayland-<client|server>.h is discouraged, therefore
change the default value of include_core_only to true.
2022-09-07 08:43:29 -04:00
Mark Bolhuis b6235a2e42 modules/wayland: Rename core_only to include_core_only
Rename the core_only option in scan_xml to include_core_only
to match the flag used by wayland-scanner.
2022-09-07 08:43:29 -04:00
Mark Bolhuis 25f838fd33 modules/wayland: Support --include-core-only
wayland-scanner can generate header files that only include
wayland-client-core.h using a flag.

Add a core_only option to scan_xml to support this use case.
2022-09-06 18:08:39 -04:00
Thomas Li a4d5442207 Fix install_subdirs not showing up in intro-install_plan.json 2022-09-06 02:09:38 -04:00
Eli Schwartz e6122ba786 interpreter: name typing-only kwargs import with an underscore
To differentiate it from the function parameter itself. Annotating a
function as

```
def func_foo(kwargs: kwargs.FooKwargs):
```

is confusing, both visually and to static linters.
2022-09-05 09:47:35 -07:00
Eli Schwartz c1182b3f74 interpreter: add a few small func annotations 2022-09-05 09:47:35 -07:00
Andres Freund 628effb369 mtest: Run ninja build.ninja before loading tests
When the build definition has changed since the last ninja invocation meson
test operated on an outdated list of tests and their dependencies. That could
lead to some tests not being run / not all dependencies being built. This was
particularly confusing because the user would see the output of
reconfiguration and rebuilding, and the next mtest invocation would have the
updated configuration.

One issue with this is that that we will now output more useless ninja output
when nothing needs to be done (the "Entering directory" part is not repeated,
as we happen to be in the build directory already). It likely is worth
removing that output, perhaps by testing if anything needs to be done with
ninja -n, but that seems better addressed separately.

Fixes: #9852
2022-09-04 19:05:14 -04:00
Andres Freund f501e3b187 mtest: pull detection of ninja into TestHarness
A later commit will add a second invocation of ninja, no point in having the
detection code twice.

This changes the exit code in case ninja isn't found from 125 to 127, which
seems more appropriate given the justification for returning 125 (to make git
bisect run skip that commit). If we can't find ninja we'll not succeed in
other commits either.
2022-09-04 19:05:14 -04:00
Andres Freund 2096e394fc mtest: Move loading of test data into its own function
A subsequent commit will do a bit more during test data loading, making a
dedicated function seem advisable.

The diff looks a bit odd, using git show --diff-algorithm=patience
will make it clearer.
2022-09-04 19:05:14 -04:00
Jan Alexander Steffens (heftig) d682d3f837 Add missing cdata update in genmarshal tests
Otherwise the test is flaky, as it may try to include a header that's
not generated yet.
2022-09-04 00:07:34 -04:00
Nirbheek Chauhan f70895a441 tests/7 gnome: Fix incorrect unref of GResource
The returned GResource is transfer-none, since the generated function
basically calls g_static_resource_get_resource(). It should not be
unreffed. Causes an abort on Debian:

GLib-GIO:ERROR:../../../gio/gresource.c:1451:g_static_resource_fini: assertion failed: (g_atomic_int_get (&resource->ref_count) >= 2)
2022-09-03 20:12:35 +03:00
Nirbheek Chauhan cc1dd6c1dd ci: Fix macOS qt4 detection
Need to link the qt4 install so it's in PATH.
Also need to use a symlink to fix breakage in the Tap.
2022-09-03 19:44:03 +03:00
Konstantin Kharlamov 251113fa67 backend/ninja: omit --backend when regenerating build dir
Currently a cosmetic bug is present: once a build dir was regenerated,
meson would start showing:

  User defined options
    backend: ninja

This is not true as user have not defined the option, it is default.
Fix this by omitting the `--backend ninja` parameter from "regenerate"

In my tests this does not affect the situation when one specifies
`--backend ninja` explicitly, it still shows the backend as user-defined
after reconfiguration.

Fixes: https://github.com/mesonbuild/meson/issues/10632
2022-09-02 16:04:08 -04:00
Jehan a692395186 Fix 2 typos in a single string which can be shown in error messages. 2022-08-31 21:20:47 -04:00
Eli Schwartz 388cb0f805 env2mfile: reuse logical lists of interesting facts from meson itself
Meson internally knows about many languages and tools, and *FLAGS
variables, and which languages to use them for. Instead of duplicating
this logic, import it from mesonbuild.*

This logic was originally standalone, but now that it is merged into the
Meson tree we can have a single source of truth.
2022-09-01 01:05:48 +03:00
aleksander e121cd123c modules/cmake: Fix typo 2022-08-31 17:32:39 +03:00
Eli Schwartz 78bf1ec56e
fix obscure crash on unbound variable
This can be triggered if someone tries to call a non-ID. The example
reproducer was:

```
if (var = dependency(...)).found()
```

This produced a traceback ending in

```
    raise InvalidArguments(f'Variable "{object_name}" is not callable.')
UnboundLocalError: local variable 'object_name' referenced before assignment
```

After this commit, the error is reported as:

```
ERROR: AssignmentNode is not callable.
```
2022-08-30 15:30:55 -04:00
Samay Sharma 2c1ac8ac1d Add LLVM_CONFIG support 2022-08-30 15:06:51 -04:00
Eli Schwartz 8059908888 flake8: run in CI
We should have full coverage now, so make sure we don't regress in the
future.
2022-08-29 23:32:43 +03:00
Eli Schwartz c5db96e051 flake8: fix typing casts to not have actual objects
We use `__future__.annotations` to good effect everywhere we can, and
one of the effects of this is that annotations are automatically
stringized and don't need to be evaluated, using less memory and
computation. But this only affects actual annotations -- a cast is just
a function with an argument, so the compiler has no idea that it's an
annotation to be stringized.

Do this manually.
2022-08-29 23:32:43 +03:00
Eli Schwartz f4cc60bf20 flake8: move typing-only imports into T.TYPE_CHECKING 2022-08-29 23:32:43 +03:00
Eli Schwartz 14b2457627 flake8: fix warnings for unused imports
This is supposed to expose all primitives together, but to do that we
need to actually "use" each variable in `__all__`, which we... didn't.
Sorry about that.
2022-08-29 23:32:43 +03:00
Eli Schwartz ff7d86d05f flake8: fix unnecessary f-strings without any format placeholders
These can just be ordinary strings.
2022-08-29 23:32:43 +03:00
Eli Schwartz 520bb7abbc flake8: fix lingering whitespace errors 2022-08-29 23:32:43 +03:00
Eli Schwartz af28826c24 flake8: fix missing import
This sort of worked, because it was a typing-only import and this file
isn't actually tested by mypy yet.
2022-08-29 23:32:43 +03:00
Eli Schwartz 4f05f877fc
docs: make note of the path restriction on subdir()
It's mentioned in the error message if you try to do it, that you cannot
use `..`, but it is probably useful to mention this in the online docs
too.
2022-08-29 12:09:52 -04:00
Eli Schwartz e8d42bd9a8
docs: mention in the native-file docs, the command line argument to use
We mention --cross-file in the relevant page, but the fact that
--native-file is the command line argument to use is mentioned nowhere
other than a couple of release notes and the --help text for meson
setup.

This should be described in the docs.
2022-08-29 12:09:52 -04:00
Thomas Lange d4733984e9 Users.md: Add Audacious 2022-08-27 23:18:58 -04:00
Alf Henrik Sauge 28dff2ca6d Fix indentation issues reported by flake8, requiring code restructuring
Strictly speaking code restructuring isn't needed, but making this PEP8
compliant results in indentation of the code that reduces the
readability. By moving the offending code on the outside of the method
call, the readability is maintained.
2022-08-26 17:12:40 -04:00
Alf Henrik Sauge 9ad5d0df4a Remove redundant backslash and fix white space issue 2022-08-26 17:12:40 -04:00
Alf Henrik Sauge 06bf9a5cda Fix purely white space issues reported by flake8 2022-08-26 17:12:40 -04:00
Eli Schwartz 47a0ed5924
Revert "Windows: Improve Python 3.8+ module check on Windows"
This reverts commit 99ad11bd9c.

This breaks working setups in conda. It is either wrong or incomplete
and thus cannot be used.

Fixes #10737
2022-08-25 17:41:38 -04:00
Fabian Orccon 83c6fc5b02 wrap: Support netrc files 2022-08-25 10:18:04 -04:00
Eli Schwartz 27748f9cd1
fix linker regression for compilers that don't accept LDFLAGS directly
e.g. ldc -- the compiler needs to process args before consuming them.

Fixes #10693
2022-08-24 23:49:14 -04:00
Eli Schwartz 9e2d4994c4
fix incorrect type annotations for coredata compile/link args
These make no sense as single strings.
2022-08-24 23:49:13 -04:00
Dylan Baker c94c492089 build: don't add targets to link_whole_targets if we took their objects
What happens is this:
 - liba is a convenience static library
 - libb is an installed static library
 - libb links in liba with --link-whole
 - libc links to libb
 - we generate a link line with libb *and* liba, even though libb is a
   strict superset of liba

This is a bug that has existed since the we stopped using link-whole to
combine convenience libraries, and to instead propagate their
dependencies up. For most linkers this is harmless, if inefficient.
However, for apple's ld64 with the addition calling `ranlib -c`, this
ends up causing multiple copies of symbols to clash (I think that other
linkers recognize that these symbols are the same and combine them), and
linking to fail.

The fix is to stop adding libraries to a target's `link_whole_targets`
when we take its objects instead. This is an all around win since it
fixes this bug, shortens linker command lines, and avoids opening
archives that no new symbols will be found in anyway.
2022-08-24 22:50:35 -04:00
Dylan Baker c02d7fe119 backend/ninja: properly track objects extracted from fortran sources
We need this to ensure that .mod files are created before we start
compiling, and to ensure that the proper include directory arguments are
generated.
2022-08-24 22:50:35 -04:00
Dylan Baker a044f42308 build: add a `uses_fortran()` convenience method 2022-08-24 22:50:35 -04:00
Dylan Baker 741de25462 build: Don't attempt to link-whole with rust convenience libraries
There are two distinct cases here that need to be considered. The first
issue is https://github.com/mesonbuild/meson/issues/10723 and
https://github.com/mesonbuild/meson/issues/10724, which means that Meson
can't actually generate link-whole arguments with rust targets. The
second is that rlibs are never valid candidates for link-whole anyway.
The promotion happens to work because of another bug in the promotion
path (which is fixed in the next commit).
2022-08-24 22:50:35 -04:00
Eli Schwartz f8ebfdf7b1
install modes should not apply sticky bit to files
This is generally a bad idea, e.g. it causes OSError on freebsd.

It also gets ignored by solaris and thus causes unittest failures.

The proper solution is to simply reject any attempt to set this, and log a
warning.

The install_emptydir function does apply the mode as well, and since it
is a directory it actually does something. This is the only place where
we don't reset the mode.

Although install_subdir also installs directories, and in theory it
could set the mode as well, that would be a new feature. Also it doesn't
provide much granularity and has mixed semantics with files. Better to
let people use install_emptydir + install_subdir.

Fixes #5902
2022-08-23 21:07:00 -04:00
Eli Schwartz b7245d3f27 tests: remove compiler requirement in various unneeded cases
Compiled languages are Meson's bread and butter, but hardly required.
This is convenient, because many test caases specifically, do not care
about testing the compiler interactions.

In such cases, we can skip doing compiler lookups which aren't used, as
they only slow down test setup.
2022-08-23 12:26:13 -04:00