When only a single input file shows up in an arglist, it makes no sense
to inject `-W,--start-group -lone -Wl,--end-group`, since there is
nothing being grouped together. It's just longer command lines for
nothing.
Currently, not only Meson lacks a way to induce a "--fatal-warnings" on
LINK.exe, it is also unable to pass flags appropriately when using
clang-cl or Microsoft's stock clang.
This commit fixes it by implementing `fatal_warnings()` in the
MSVCDynamicLinker and ClangCLDynamicLinker classes, and by implementing
the requisite conversion steps in linker_to_compiler_args for
ClangCompiler.
xtools is in use on Gentoo Prefix x86_64 and ppc based Darwin installs.
Pick it up as a valid linker.
Since xtools is answering with a version to --version, as opposed to
ld64, detection of xtools in the ld64 handling block is not possible,
since --version already succeeded.
Bug: https://bugs.gentoo.org/868516
Bug: https://github.com/mesonbuild/meson/issues/10805
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
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
Emitting -undefined,error was correct,, but starting with Xcode 15 / Sonoma,
doing so triggers "ld: warning: -undefined error is deprecated". Given that
"-undefined error" is documented to be the linker's default behaviour, this
warning seems ill advised. However, it does create a lot of noise. As
"-undefined error" is the default behaviour, the least bad way to deal with
this seems to be to just not emit anything. Of course that only works as long
as nothing else injects -undefined dynamic_lookup, or such. Complain to Apple.
Fixes: https://github.com/mesonbuild/meson/issues/12450
Previously macos reported "ld: unknown option: --version" when being passed
--version, but now sometimes it reports in plural, albeit without an obvious
pattern when. To handle that, simply just check for the prefix without the :
Fixes: https://github.com/mesonbuild/meson/issues/12552
The MSVC code is extremely confusing, and it turns out it actually
constructs debug (pdb) files names/path independently in separate
places. This is really hard to parse. Instead, refactor it so that the
source of the debug filename is within the target itself
(get_debug_filename). Add a couple of generic methods to retrieve the
full path of the debug filename name in the backend and use that when
needed.
Apple's AR is old, and doesn't add externed symbols to the symbol table,
instead relying on the user calling ranlib with -c. We need to do that
for the user
Performed using https://github.com/ilevkivskyi/com2ann
This has no actual effect on the codebase as type checkers (still)
support both and negligible effect on runtime performance since
__future__ annotations ameliorates that. Technically, the bytecode would
be bigger for non function-local annotations, of which we have many
either way.
So if it doesn't really matter, why do a large-scale refactor? Simple:
because people keep wanting to, but it's getting nickle-and-dimed. If
we're going to do this we might as well do it consistently in one shot,
using tooling that guarantees repeatability and correctness.
Repeat with:
```
com2ann mesonbuild/
```
Since it's deprecated anyway, we don't really want to plumb it all the
way down into the build and backend layers. Instead, we can just turn
it into a `win_subsystem` value in the interpreter if `win_subsystem`
isn't already set.
A linker mixin has to be able to align with the base linker it will be
used for, in order to reference super(). Since they weren't inherited,
calls to super() resulted in mypy errors, which we ignored, and casting.
Use the same trick we use for compilers, and make the linker inherit
from the base linker type when running under mypy, and from object at
runtime.
* Archive shared library in AIX
This code change to ensure we archive shared libraries in AIX.
The things we do are:
Archive shared library
Install archived shared library
Build all must build the archived shared library
blibpath must have the archived shared library dependency.
* Archive shared library in AIX.
Made changes as per the review comments given in the first
PR request.
They are:-
Use self.environment.machines[t.for_machine].is_aix()
Remove trial spaces
Use of val instead of internal
Changed comments wherever requested
* Space after octothorpe
* Fixed failed test case causing build break during install section
* Moved AIX specific code to AIXDynamicLinker from backend
* Fix indentation, trailing spaces, add type annotations and Linux/macOS build break
* Remove some more trailing space issues
* Fixed the wrong return type in linkers
This saves on a 1500-line import at startup and may be skipped entirely
if no compiled languages are used. In exchange, we move the
implementation to a new file that is imported instead.
Followup to commit ab20eb5bbc.
Linkers that aren't actually ar, were refactored into a base class in
commit 253ff71e6b, which however didn't
take into account that we were doing checks for this.
The system linkers don't support this particular GNU extension on
these OS'es, so don't build them there.
Based on an OpenIndiana patch created by @alarcher. Closes#9882.
It turns out we don't generally need to proxy every compiler ever
through the top-level package. The number of times we directly poke at
one is negligible and direct imports are pretty clean.
Currently we invoke it with lang_args only, which is wrong and probably
useless.
Fixes misdetecting the linker when overridden as -fuse-ld, which led to
Meson trying to pass incompatible flags, outright failing if CFLAGS
contained flags that only work with a non-default linker, or in the most
benevolent case, having the status log report the wrong linker.
We do something similar when running get_compiler() method checks from
the DSL. This ensures that if errors happen, the log file we tell people
to check actually works.