Commit Graph

13601 Commits

Author SHA1 Message Date
6823cabb83 extend install scripts to allow specific directory variable exports
This is useful for internal scripts that want to know about something
other than MESON_INSTALL_PREFIX and MESON_INSTALL_DESTDIR_PREFIX, which
is very specific to the prefix.
2023-05-02 19:28:35 -04:00
7c78c2b5a0 fix regression in precomputing CMAKE_SIZEOF_VOID_P
In commit 808d5934dd, compiler.sizeof was
refactored to introduce caching, but cmake subprojects did not adapt to
that API change and ended up embedding the python repr of a tuple as a
cmake variable.
2023-05-02 19:21:25 -04:00
3b1b1b5fec Log python name when not found
Fixes #11686.
2023-05-02 17:52:10 -04:00
51b9f2f1a5 Find python3.xx on windows 2023-05-02 17:52:10 -04:00
107f933b52 Ensure python fallback has the right version
Fixes #11057
2023-05-02 17:52:10 -04:00
f3635ff50d avoid re-uploading the docs when a PR is based on the upstream repo
In this case, we have the secret available, and the workflow ran even
though it wasn't on branch "master" because of the pull request trigger.

Since the change hasn't landed on master, though, we do not want to
update the website. So check for pushes to master, specifically.
2023-05-01 15:22:41 -04:00
f71c9aebfb wrap: Always pass posix paths to patch
patch on Windows is provided by MSYS, which only understands POSIX
paths, with `/`. Using Windows paths with `\` results in a "file not
found" error.

We got a little lucky here because the path is relative, so the drive
letter difference doesn't affect us.
2023-04-29 08:35:51 -04:00
6def03c787 detect_cpu: Fix mips32 detection on mips64
MIPS64 can run MIPS32 code natively, so there is a chance that a mixture
of MIPS64 kernel and MIPS32 userland exists. Before this Meson just
treats such mixture as mips64, because uname -m returns mips64.

So in this case we have to check compiler builtin defines for actual
architecture and CPU in use.

- Also fixes mips64 related detection tests in internaltests:
  Normalize mips64 as mips first, then if __mips64 is defined, return
  mips64 for mips64* machines.

  This is a bit confiusing because normally one would detect if a flag
  of 32-bit target is defined while running on a 64-bit machine. For
  mips64 it is almost just the other way around - we need to detect if
  __mips64 is set to make sure it is a mips64 environment.

Co-Authored-By: Jue Wang <maliya355@outlook.com>
2023-04-28 00:20:42 -04:00
f5fa56fdfa Don't use dyndep scanner when preprocessing
Fixes #11504
2023-04-27 15:08:46 -04:00
1fdcc30ae6 Specify c++ 11 flag as code uses c++ 11 features 2023-04-27 01:45:12 +03:00
38b35eca30 Add env kwarg to gnome.generate_gir().
Fixes #384
2023-04-26 14:51:10 -04:00
bf44120a4f Set the CC environment variable for g-ir-scanner.
Fixes #1035
2023-04-26 14:51:10 -04:00
07bd28732e Fix html coverage report generation when using clang on linux 2023-04-25 23:48:56 -04:00
e1de1bae09 yasm: Fix usage of incompatible optimization flags
Fixes #11726
2023-04-24 21:09:15 -04:00
70e2da0773 mtest: prevent parse error with gtest protocol
Replace illegal characters when reading gtest generated xml file,
to prevent a ParseError and a stacktrace.

catch et.ParseError, just in case, to prevent stopping other tests
if the xml file was malformed.
2023-04-24 15:48:31 -04:00
523204f1f1 ci: Don't error out CI if codecov upload fails 2023-04-24 11:42:40 -04:00
9cc5009a44 ci: Don't search for llvm modules with LLVM 16.0.x
See: https://github.com/mesonbuild/meson/issues/11642
2023-04-24 11:42:40 -04:00
09ec4f6e22 dependencies: allow to fallback on CMake to find the SDL2 library
On Windows, the SDL2 library is generally provided with only CMake config
files. This commit allows meson to fallback on CMake as a last resort to
find the SDL2 library.
2023-04-24 11:41:55 -04:00
18cfa545f0 Initial support for Metrowerks C/C++ compiler 2023-04-24 09:07:37 -04:00
bda799dff2 fix python.version() not working in some cases
import('python').find_installation('python').version() causes exception
because of a missing initialization, when `find_installation()` receives
a name or a path.
2023-04-23 23:03:25 -04:00
01420bf8fc rust: Add new rust_dependency_map target configuration
This allows changing the crate name with which a library ends up being
available inside the Rust code, similar to cargo's dependency renaming
feature or `extern crate foo as bar` inside Rust code.
2023-04-21 15:35:06 -04:00
474e3ea8af docs: update the Rust bindgen docs to talk about assertions
Since we now guarantee that Rust and C/C++ will have assertions both on
or both off, we can give guidance about using `cfg(debug_assertions)` to
wrap code using `#ifdef NDEBUG`.
2023-04-21 15:18:56 +05:30
73981b2c34 modules/rust: Add -DNDEBUG to bindgen if b_ndebug is false
Otherwise bindgen may generate different behavior than the compiled C
code actually has.
2023-04-21 15:18:56 +05:30
c62989ce80 rust: add support for b_ndebug
Rust has a `debug_assert!()` macro, which is designed to be toggled on
the command line. It is on by default in debug builds, and off by
default in release builds, in cargo. This matches what meson's b_ndebug
option does in `if-release` mode.
2023-04-21 15:18:56 +05:30
f80f40fa4f compilers: split code for deciding if debug is needed into a helper 2023-04-21 15:18:56 +05:30
bfce5c45a4 compilers: convert method to get assert control to a boolean
C like compilers only off `-DNDEBUG` to disable asserts. This is not a
universal paradigm however. Rust, for example has an argument that takes
a boolean. To better represent this, we allow passing a `disable`
boolean. `disable` was chosen rather than `enable` because it allowed
all existing logic to be left in place
2023-04-21 15:18:56 +05:30
c0c9f755a4 ci: Move to the codecov github action
The pypi package was suddenly removed. Not the most
confidence-inspiring deprecation/migration:

https://about.codecov.io/blog/message-regarding-the-pypi-package/
2023-04-21 13:30:45 +05:30
5eb55075ba intro: add more details to generated json files
This will help with the writing of tools to generate
VisualStudio project and solution files, and possibly
for other IDEs as well.

- Used compilers a about `host`, `build` and `target` machines
  arere listed in `intro-compilers.json`
- Informations lister in `intro-machines.json`
- `intro-dependencies.json` now includes internal dependencies,
  and relations between dependencies.
- `intro-targets.json` now includes dependencies, `vs_module_defs`,
  `win_subsystem`, and linker parameters.
2023-04-20 18:31:39 +03:00
fbab1488ae extra_files keyword in declare_dependency() 2023-04-20 18:31:39 +03:00
e2c454b86e rust: Also disallow . in Rust library target names 2023-04-20 13:53:26 +05:30
3c9817fe7f rust: Don't allow spaces/dashes in Rust library names
The library names are directly mapped to filenames by meson while the
crate name gets spaces/dashes replaced by underscores. This works fine
to a certain degree except that rustc expects a certain filename scheme
for rlibs that matches the crate name.

When using such a library as a dependency of a dependency compilation
will fail with a confusing error message.

See https://github.com/rust-lang/rust/issues/110460
2023-04-20 13:53:26 +05:30
45629466a7 rust: Don't use prefer-dynamic in case of proc-macro Rust dependencies
They're only used at build-time and whether they exist or not should not
have any effect on the final build artifact.
2023-04-19 15:12:21 -07:00
42e6c58441 Revert "cygwin CI: work around gcovr bug"
This reverts commit 0022e1863d.

The bug is long since both fixed and *released*.
2023-04-19 00:21:13 -04:00
469ed636fe CI: update cygwin cache actions to new version supporting granular save
cache/restore and cache/save now exist, and close the issue linked in
the workflow comment. The new save action runs when invoked, rather than
as a post action.
2023-04-19 00:21:13 -04:00
7bdb4a6926 pkgconfig module: fix traceback on invalid missing description
If the optional first "mainlib" argument is there, then we infer several
values. Otherwise, some of those values fall back to a generic default,
and two of them -- name and description -- fall back to being mandatory.

In commit e84f293f67, we removed
validation for description as part of refactoring that never actually
validated anything.
2023-04-18 19:42:29 -04:00
4cd4f98770 CI: cygwin coverage uploader needs to run in bash too
Like every single other command in the entire workflow, and for the same
reasons. ;)
2023-04-17 21:19:07 -04:00
8d2a9e6e5c Update Users.md [skip ci] 2023-04-17 13:03:41 -04:00
5a34505b18 Add c++23 to the list of C++ standards. 2023-04-17 13:56:31 +03:00
c39ee881a1 select the correct python_command for pyinstaller builds, even on not-Windows
Checking the executable basename sort of works, at least for Windows,
since Windows always happens to use exactly this approach. However, the
official pyinstaller documentation suggests a very different approach:

https://pyinstaller.org/en/stable/runtime-information.html

This approach is more robust since it works on any OS, and in particular
it allows me to test the PyInstaller bundle functionality on Linux, even
though we don't officially distribute it as such.
2023-04-17 11:36:55 +03:00
e66b07e6fb fix data collection with pyinstaller
pyinstaller considers .py files to not be data by default. The entire
architecture of pyinstaller is, in fact, different from zipapp or
unpacked modules -- because it actually has to use a resource loader
with on-disk files *separate* from the module itself. So just because a
file gets packaged in the application does not mean it's usable as an
importlib.resources compatible resource.

Although we collect data files in general, we need to make sure that .py
files are collected from scripts, because we may try to run them
standalone from an external process.

Fixes #11689
2023-04-17 11:36:55 +03:00
285e0d3c59 mbuild: .pdb files are created only when debug symbols are enabled
This is the same fix as the one in #10800 for shared libraries but
applied to executables instead.
2023-04-14 16:20:23 -04:00
3bc2236c59 minstall: work around broken environments with missing UIDs
Running some container-like mechanisms such as chroot(1) from sudo, can
result in a new isolated environment where the environment variables
exist but no users exist. From there, a build is performed as root but
installation fails when we try to look up the passwd database entry for
the user outside of the chroot.

Proper container mechanisms such as systemd-nspawn, and even improper
ones like docker, sanitize this and ensure those stale environment
variables don't exist anymore. But chroot is very low-level.

Avoid crashing when this happens.

Fixes #11662
2023-04-14 15:13:12 -04:00
9a77c45e41 minstall: do not drop privileges if msetup also ran under sudo
A user might run `sudo somewrapper` to build and install something with
meson, and it is not actually possible to drop privileges and build,
since the build directory is also owned by root.

A common case of this is `sudo pip install` for projects using
meson-python or other python build-backends that wrap around meson.

Fixes #11665
2023-04-14 15:12:37 -04:00
1bc3d91112 minstall: Fix install_subdir() excludes with path separators on Win
The paths in meson.build use / as path separator, however, the paths
constructed during the directory structure walk use native path
separators, thus the path never compare equal to the excluded ones.
Normalize the exclusion paths before the comparison.
2023-04-14 21:37:52 +03:00
1c00cb2550 rust: Use isinstance(d, build.StaticLibrary) instead of comparing the type name string 2023-04-14 10:27:54 -04:00
e184fc84b3 rust: Link staticlib/cdylib link targets like link targets from any other language
staticlib/cdylib only provide a C ABI, i.e. contain no Rust metadata,
and can be linked like a link target from any other language.
2023-04-14 10:27:54 -04:00
a787b0cd5f rust: Don't prefer dynamic linking of Rust libraries for cdylibs
cdylibs provide a plain C ABI to its consumers and should not be treated
like dylib/proc-macro shared libraries that provide a Rust ABI.
2023-04-14 10:27:54 -04:00
22960758aa rust: Use the corresponding rustc version when clippy-driver is chosen as Rust compiler
By default clippy-driver will report its own version, which is not very
useful to check the toolchain version. Instead make sure to extract the
actual toolchain version here.
2023-04-14 15:52:54 +05:30
c725816c81 rust: Convert dashes in crate names to underscores
Dashes can't be used as identifiers in Rust and cargo is converting
dashes in crate names to underscores for the same reason.
2023-04-14 06:22:33 -04:00
49e62877d1 rust: Don't pass dependency compile arguments to the compiler
Rust doesn't have a concept of dependency compile arguments, i.e.
something like headers. Dependencies are linked in and all required
metadata is provided by the linker flags.
2023-04-14 06:11:44 -04:00