Commit Graph

68 Commits

Author SHA1 Message Date
Jon Turney ae6fbc3ccb
CI: Fix filemode tests with cygwin 3.6.0
Put cygwin filemode tests back under the sourcedir
Remove inheritable permissions from the sourcedir

For :reasons:, the unit tests which check file mode were built in the
tempdir.

Instead, remove inheritable permissions from the working directory
(which the GitHub VM image has set for some reaons), since they can
interfere with getting exactly the file mode you asked for.

Partially reverts 04ae1cfb79

(cherry picked from commit f164ec692f)
2025-03-24 21:55:27 -04:00
Jussi Pakkanen 0279acbfe5 Condensed directory names for release. 2025-01-09 16:52:16 +02:00
Jussi Pakkanen 16cf71f051 Handle top level options set in subprojects. Closes #13847. 2024-12-16 21:12:39 +02:00
Andoni Morales Alastruey c02e0b7b1e pkgconfig: fix use of uninstalled libraries
Prepend the path of uninstalled libraries to PKG_CONFIG_PATH
so they have preference over other search paths set by the
user.

see: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3247
2024-10-23 08:04:50 -04:00
Jussi Pakkanen fbeedf4b14 Condense test directories. 2024-10-20 21:20:13 +03:00
Pierre Lamot 6797f9bc15 qt module: allow has_tools to specify which tools to check
This allows checking for tools that may not be available in older version of qt
or avoiding requesting tools that may not be necessary for a given project

Co-authored-by: Nirbheek Chauhan <nirbheek@centricular.com>
2024-09-24 10:24:47 -07:00
L. E. Segovia 761e2470d4 compilers: Allow prelinking with Apple Clang 2024-08-26 01:05:42 +03:00
Dylan Baker e808aa161c
unittests: use TestCase.addCleanup for cleaning up builddirs 2024-08-15 14:15:03 -04:00
Eli Schwartz 077d540c10
unittests: fix EncodingWarnings. minus 123 warnings collected by pytest 2024-07-30 14:13:12 -04:00
Jussi Pakkanen 61c742fae9 Remove language (AKA compiler) type from OptionKey. 2024-07-17 18:37:51 +03:00
Jussi Pakkanen 0d7bb776e2 Move OptionKey in the option source file. 2024-07-11 11:53:39 +03:00
Jussi Pakkanen 9a6fcd4d9a Replace direct indexing with named methods. 2024-06-14 17:19:53 +03:00
Jussi Pakkanen c0d86024f5 Rename option variable to optstore to make it unique. 2024-06-14 17:19:53 +03:00
Jan Alexander Steffens (heftig) 05bbe45cc2 tests: Fix unit tests with high parallelism
On Arch's shiny new 48-core/96-thread build server, the
`test_install_log_content` test fails because of an unexpected
`invalid-symlink.txt` file. Apparently the test runs in parallel with
`test_install_subdir_symlinks`, which modifies the `59 install subdir`
source directory.

To fix this, make `install_subdir_invalid_symlinks` copy the entire test
into a tmpdir before modifying it.
2024-03-15 09:24:06 -07:00
Alyssa Ross 9322a29d7f Skip pkg-config-dependent tests if it's missing 2023-12-17 16:21:11 -05:00
Dylan Baker e991c4d454 Use SPDX-License-Identifier consistently
This replaces all of the Apache blurbs at the start of each file with an
`# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing
uses to be consistent in capitalization, and to be placed above any
copyright notices.

This removes nearly 3000 lines of boilerplate from the project (only
python files), which no developer cares to look at.

SPDX is in common use, particularly in the Linux kernel, and is the
recommended format for Meson's own `project(license: )` field
2023-12-13 15:19:21 -05:00
Eli Schwartz 5f659af870
ninja backend: don't hide all compiler warnings for transpiled languages
This was originally added for vala only, with the rationale that vala
generates bad code that has warnings. Unfortunately, the rationale was
fatally flawed. The compiler warns about a number of things, which the
user can control depending on their code (or their code generator's
code), but some of those things are absolutely critical to warn about.

In particular, GCC 14 and clang 17 are updating their defaults to warn
-- and error by default for -- invalid C code that breaks the standard,
but has been silently accepted for over 20 years "because lots of people
do it". The code in question is UB, and compilers will generate faulty
machine code that behaves erroneously and probably has a mass of CVEs
waiting to happen.

Compiler warnings are NOT safe to just... universally turn off. Compiler
warnings could be either:

- coding style lints

- threatening statements that the code is factually and behaviorally wrong

There is no magic bullet to ignore the former while respecting the
latter. And the very last thing we should ever do is pass `-w`, since
that causes ALL warnings to be disabled, even the manually added
`-Werror=XXX`.

If vala generated code creates warnings, then the vala compiler can
decrease the log level by generating better code, or by adding warning
suppression pragmas for *specific* issues, such as unused functions.
2023-12-05 19:51:56 -05:00
Jussi Pakkanen 97dc8801a6 Renumber test dirs for rc3. 2023-11-12 19:18:06 +02:00
Jussi Pakkanen 3bbe66e971 Condense test directories for RC1. 2023-10-27 17:43:03 +03:00
Benjamin Redelings 84b8d257e4 Allow c++23 in gcc-11. 2023-10-09 23:53:31 +03:00
Xavier Claessens f1c35b561f pkgconfig: Set PKG_CONFIG in env for devenv and g-ir-scanner 2023-09-18 13:51:27 -04:00
Xavier Claessens 0eae4e0936 pkgconfig: Restore logging of pkg-config version
While at it, make more methods private by storing the version found on
the instance. That avoids having to call check_pkgconfig() as static
method from unittests.
2023-09-18 13:51:27 -04:00
Xavier Claessens 30d7f506c7 Remove get_pkgconfig_variable()
Make sure that pkgconfig_define is a pair of strings and not a list with
more than 2 strings.
2023-09-18 13:51:27 -04:00
Xavier Claessens 926c3a6919 Error when an installed static library links to internal custom target
When an installed static library A links to an internal static library B
built using a custom_target(), raise an error instead of a warning. This
is because to be usable, A needs to contain B which would require to
extract the archive to get its objects files.

This used to work, but was printing a warning and was installing a
broken static library, because we used to overlink in many cases, and
that got fixed in Meson 1.2.0. It now fails at link time with symbols
from the custom target not being defined. It's better to turn the
warning into a hard error at configure time.

While at it, noticed this situation can happen for any internal custom
or rust target we link to, recursively.
get_internal_static_libraries_recurse() could be called on CustomTarget
objects which do not implement it, and even if we did not call that
method, it would still fail when trying to call extract_all_objects() on
it.

Fixes: #12006
2023-08-07 05:44:08 -07:00
Xavier Claessens 183e4b8e90 PkgConfigDependency: Move CLI handling into its own abstraction
This makes the code cleaner and will allow to have other implementations
in the future.
2023-08-03 16:27:52 -04:00
Jussi Pakkanen 1cd16a7cc5
Merge pull request #11986 from williamspatrick/clang-enable-cpp23
add support for newer C++ -std= flags on Clang/GCC
2023-07-31 16:59:16 +03:00
Steven Noonan 51d04776a3 tests: add support for c++23/c++26 detection
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2023-07-14 13:29:16 -05:00
Tristan Partin 3784f72973 Silence some encoding warnings
By specifiying explicit encodings, we can silence warnings like:

 /__w/meson/meson/test cases/common/100 postconf with args/postconf.py:15: EncodingWarning: 'encoding' argument not specified
  with open(input_file) as f:

in CI.
2023-07-13 09:55:10 -07:00
Xavier Claessens 1fef03c0f0 build: dependencies should come after link_with on link command
This fixes regression caused by
3162b901ca
that changes the order in which libraries are put on the link command.

In addition, that commit was wrong because libraries from dependencies
were processed before process_compiler() is called, which that commit
wanted to avoid.
2023-07-10 23:12:24 +03:00
Xavier Claessens cd63853ad2 build: Fix linking multiple libraries and some are promoted
When a link() is promoted to link_whole() we still have to handle the
rest of the list.

Fixes: #11956
2023-07-10 23:12:24 +03:00
Jussi Pakkanen d391e5281c
Merge pull request #11742 from xclaesse/link-whole-cases
Fix niche cases when linking static libs
2023-07-05 01:10:58 +03:00
Eli Schwartz b1ddfabf8f
dependencies: defer importing a custom dependency until it is used
This lessens the amount of code imported at Meson startup by mapping
each dependency to a dictionary entry and using a programmable import to
dynamically return it.

Minus 16 files and 6399 lines of code imported at startup.
2023-06-26 13:10:33 -04:00
Xavier Claessens a78af23686 Fix niche cases when linking static libs
Case 1:
- Prog links to static lib A
- A link_whole to static lib B
- B link to static lib C
- Prog dependencies should be A and C but not B which is already
  included in A.

Case 2:
- Same as case 1, but with A being installed.
- To be useful, A must also include all objects from C that is not
  installed.
- Prog only need to link on A.
2023-05-01 12:57:45 -04:00
Jussi Pakkanen 78d8924d43 Condense test directories for rc1. 2023-03-28 17:18:57 +03:00
Eli Schwartz da23630a97
refactor pkg-config dependency to allow statically finding the program
The pkg-config dependency class has some interesting logic for finding a
good pkg-config that will be used for dependency lookups. We sometimes
need to use it, though, outside of the class. Make that possible.
2022-12-04 17:56:03 -05:00
Marvin Scholz 7cbc15b812 unittests: add and use get_meson_log_raw function
This is like get_meson_log but returns the whole contents
not split into individual lines.
2022-11-22 22:53:07 -05:00
Jussi Pakkanen 3ae89a7150 Handle freezing tests. Fixes #10752. 2022-11-21 16:44:24 +02:00
Eli Schwartz b40e4de3c6
tests: fix potential failure to verify pkg-config generation
We use a dummy project with a vague name and try to find flags for it
based on the installable pkg-config files. This sort of works,
generally, because it attempts to match `-lct` which doesn't exist
because the test case isn't installed, and that link argument is passed
directly through.

Except, sometimes that library does exist. It is provided by the
"freetds" project, which may be a dependency other tools. In that case,
Meson finds a library, and the `dependency()` resolves to
`/usr/lib/libct.so` and the test fails.

Fortunately, we do have an API to say that we really want to get back
the same flags pkg-config returned. Use this.
2022-11-17 19:10:51 -05:00
L. E. Segovia 7e5b0760ce minstall: make do_strip run with -Sx for macOS targets
This commit also adds some extra symbol noise to lib.c, in order to aid
detection of the debug information with nm.

Fixes #10943
2022-11-01 17:56:18 +02:00
Jussi Pakkanen 458dcf8aac Condense test directory numbers. 2022-10-25 00:03:32 +03:00
Dylan Baker 1917b9253e modules/gnome: make_native_glib_version an instance var
This removes the need for the use of the global statement. I've also
updated the test that overrides this to use mock.patch instead of hand
monkey patching.
2022-09-22 18:17:43 -04:00
Eli Schwartz d3dac3cfb2
compilers: don't export every compiler as a top-level property
This is wasteful and generally unneeded, since code can just use the
compiler they detected instead of manually poking at the internals of
this subpackage.

It also avoids importing an absolute ton of code the instant one runs
`from . import compilers`
2022-09-19 15:19:00 -04:00
Yang Bo 83d18d137d Use os.path.realpath for default include paths testing in -isystem.
This ensures correct removal of default include paths in -isystem
options when symbolic links are involved.

A test for this is also added.
2022-09-13 02:24:38 -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
Jussi Pakkanen befd26985c Fix test case numbers. 2022-07-07 10:04:51 -07:00
Simon McVittie 42327eacbc unittests: Skip prelinking test with gcc 8 or older
This was already skipped when running on the Ubuntu 18.04 version of gcc,
but it also fails with gcc 8.3.0 on Debian 10. Instead of hard-coding
specific versions to look for, do a version comparison.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-06 07:49:32 -04:00
Xavier Claessens 18bec0d3e3 pkgconfig: Use EnvironmentVariables to build PKG_CONFIG_* env
The new get_env() method that returns an EnvironmentVariables object
will be needed in next commit that will pass it to CustomTarget.

This has the side effect to use the proper os specific path separator
instead of hardcoding `:`. It is the obvious right thing to do here, but
has caused issues in the past. Hopefully issues have been fixed in the
meantime. If not, better deal with fallouts than keep doing the wrong
thing forever.
2022-04-30 15:01:28 -04:00
Fini Jastrow c16fdaeeca linkers: Add support for mold linker
[why]
Support for the relatively new mold linker is missing. If someone wants
to use mold as linker `LDFLAGS="-B/path/to/mold"` has to be added instead
of the usual `CC_LD=mold meson ...` or `CXX_LD=mold meson ...`.

[how]
Allow `mold' as linker for clang and newer GCC versions (that versions
that have support).

The error message can be a bit off, because it is generic for all GNU
like compilers, but I guess that is ok. (i.e. 'mold' is not listed as
possible linker, even if it would be possible for the given compiler.)

[note]
GCC Version 12.0.1 is not sufficient to say `mold` is supported. The
expected release with support will be 12.1.0.
On the other hand people that use the un-released 12.0.1 will probably
have built it from trunk. Allowing 12.0.1 is helping bleeding edge
developers to use mold in Meson already now.

Fixes: #9072

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-04-30 10:06:22 -04:00
Eli Schwartz b5a81ff634
qt dependency: adapt to the qmake command changed name
Qt now has official guidance for the symlinked names of the tools, which
is great.

Qt now officially calls the tools `fooX` instead of `foo-qtX` where the
major version of Qt is X. Which is not great, because a bit of an
unofficial standard had prior art and now needs to change, and we never
adapted.

Prefer the official name whenever looking up qmake, and in the
testsuite, specifically look only for the official name on versions of
qt which we know should have that.
2022-04-12 20:44:07 -04:00
John Ericson 01a7aa0a4d Document and test env vars a bit better 2022-04-03 10:58:03 -07:00