summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/env2mfile.py
AgeCommit message (Collapse)Author
2025-10-14Generate Android cross files with env2mfile.Jussi Pakkanen
2025-09-29env2mfile: Use a cross vapigen on Debian if availableSimon McVittie
As with many compilers and other tools relevant to cross-compiling, an executable prefixed with the host architecture's GNU architecture tuple might or might not exist, but if it does exist, we can be quite confident that it's the appropriate executable to use for that host architecture. Vala's vapigen tool reads GIR XML files that can vary between architectures (for example GLib-2.0.gir and GstAudio-1.0.gir contain constants that take architecture-specific values), so on Debian it needs to search an architecture-specific location. Accordingly, the valac (>= 0.56.18-3) package provides a `${DEB_HOST_GNU_TYPE}-vapigen` script which wraps the vapigen binary and sets appropriate search paths. Bug-Debian: https://bugs.debian.org/1116552 Signed-off-by: Simon McVittie <smcv@debian.org>
2024-12-04env2mfile: add flag to use _FOR_BUILD envvars.Jussi Pakkanen
2024-10-22env2mfile: Use a cross valac on Debian if possibleSimon McVittie
This is functionally equivalent to the logic used to locate the cross exe_wrapper, but puts it below the "Compilers" heading rather than "Other binaries". Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-22env2mfile: Automatically set exe_wrapper on Debian if possibleSimon McVittie
Recent versions of the architecture-properties package provide a cross-exe-wrapper package containing ${DEB_HOST_GNU_TYPE}-cross-exe-wrapper, which is currently a wrapper around qemu-user but could use different emulators on each architecture if it becomes necessary in the future. Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-22env2mfile: Use Debian cross-prefixed GObject-Introspection toolsSimon McVittie
In Debian testing/unstable, there are wrappers available for various GObject-Introspection tools during cross-builds, using qemu internally. Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-22env2mfile: Generalize detection of pkg-config to have a list of toolsSimon McVittie
Cross-tools on Debian generally follow the naming convention set by Autotools AC_CHECK_TOOL, where the name is prefixed with the GNU architecture tuple for the host architecture. env2mfile was already using this for pkg-config, but there are many other tools that can be detected in the same way. Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-20Add GNU/Hurd kernel resultsSamuel Thibault
uname -s does return gnu there. Resolves: https://github.com/mesonbuild/meson/issues/13740 Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2024-10-02env2mfile: Base cpu on DEB_HOST_GNU_CPU unless DEB_HOST_ARCH is specialSimon McVittie
`DEB_HOST_ARCH` encodes both the CPU family and the OS, so using it to get the CPU type gives the wrong answer for non-Linux ports. However, `DEB_HOST_GNU_CPU` gives less detailed information about the CPU: it's `arm` for all 32-bit ARM CPUs, and doesn't distinguish between the differing baselines of `armel` (ARMv5 softfloat) and `armhf` (ARMv7 hardfloat). When cross-compiling for x86_64 Linux, this changes the `cpu()` from `amd64` to `x86_64`, which is consistent with the answer we get during native builds on that architecture. When cross-compiling for `ppc64el`, this changes the `cpu()` from `ppc64el` to `ppc64`, which is a reasonable change but is still not consistent with what we see during native builds (which is `ppc64le`): see #13741 for that. Resolves: https://github.com/mesonbuild/meson/issues/13742 Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-02env2mfile: Don't hard-code Debian as always being LinuxSimon McVittie
All official Debian release architectures use the Linux kernel, but unofficial ports like hurd-i386 and kfreebsd-amd64 use the Hurd and FreeBSD kernel, respectively. Map Linux to 'linux' and kFreeBSD ports to 'freebsd' as per the reference tables in Meson's documentation. For now, use the Debian system name such as 'hurd' for anything else (see #13740 for the question of whether Hurd should identify its kernel differently). Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-02env2mfile: Map Debian GNU/Hurd to system() -> gnuSimon McVittie
As per <https://mesonbuild.com/Reference-tables.html>, and matching what happens when running Meson for a native build on Debian GNU/Hurd. Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-02env2mfile: Add a function for mostly-identity mappings with special casesSimon McVittie
This makes the frequent pattern of things like "CPU families are the same as GNU CPUs, with a few known exceptions" less verbose. Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-02env2mfile: Split detect_cross_debianlike()Simon McVittie
Separating the part that runs dpkg-architecture from the part that interprets its results will make it easier to unit-test the latter. Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-02env2mfile: Convert MachineInfo into a dataclassSimon McVittie
This will make it easier to unit-test functions that work with a MachineInfo, by constructing the expected object in a single call. Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-27env2mfile: Fix a typoSimon McVittie
Debian cross architectures are detected via dpkg-architecture, not via dpkg-reconfigure. Signed-off-by: Simon McVittie <smcv@debian.org>
2024-04-04env2mfile: Only consume LDFLAGS for relevant languagesOle André Vadla Ravnås
It makes no sense to add them into vala_link_args, for example.
2024-02-23env2mfile: move language args to `built-in options`Ole André Vadla Ravnås
As putting them in the `properties` section is considered deprecated, and Meson would then complain when trying to consume the resulting machine file.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
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-11-01Add comments suggesting to keep shell completion scripts up-to-date near cmd ↵Luke Elliott
line argument code
2023-09-15environment, env2mfile: Don't shell split paths if they point to a valid ↵L. E. Segovia
executable Fixes #11128
2023-08-02treewide: internally avoid deprecated machine file uses of "pkgconfig"Eli Schwartz
We support this in a machine file: ``` [binaries] pkgconfig = 'pkg-config' pkg-config = 'pkg-config' ``` and you can use either one, because internally we look up both. If you only set *one* of them, this plays awkwardly with setting $PKG_CONFIG, since we don't know which one you set in the machine file and the *other* one will be initialized from the environment instead. In commit 22df45a31981874310a78dde0df59a6a7c5ebb29 we changed program lookup of config-tool style dependencies to use the regular tool names and only fall back on the strange internal names. This affected the pkg-config class too. The result is that instead of preferring `pkgconfig =` followed by $PKG_CONFIG followed by `pkg-config =`, we inverted the lookup order. This is a good idea anyway, because now it behaves consistently with `find_program('pkg-config')`. Unfortunately, we documented the wrong name in a bunch of places, and also used the wrong name in various testsuite bits, which meant that if you set $PKG_CONFIG and then ran the testsuite, it would fail. Correct these references, because they are buggy. One test case expected to find_program() a native copy for convenience of testing against natively installed glib. Force it to resolve a native copy.
2023-06-19Add kernel and subsystem properties to machine objects.Jussi Pakkanen
2023-06-12env2mfile: Take pkg-config properties from envXavier Claessens
2023-06-12env2mfile: Take binaries from env for cross file tooXavier Claessens
2023-06-12env2mfile: Not all compilers have env for flagsXavier Claessens
2023-03-28Import cpu detection fix from Debian.Jussi Pakkanen
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033579
2023-02-28Add detection code for powerpc64le.Jussi Pakkanen
Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019413
2023-02-28Add a deb_ prefix to constants that are only used in Debian system detection.Jussi Pakkanen
2023-02-28Handle a cross compilation setup that only has a C compiler.Jussi Pakkanen
2023-02-28Add Debian platform autodetect to env2mfile.Jussi Pakkanen
2023-02-01simplify instantiation of builtin type using builtins instead of functionsEli Schwartz
2022-11-22Fix writing single strings in env2mfile.Jussi Pakkanen
2022-11-12Add CMake to cross file.Jussi Pakkanen
Original patch by Helmut Grohne. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023744
2022-11-12Fix ppc64 detection in Debian.Jussi Pakkanen
Original patch by Helmut Grohne. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023744
2022-10-03pylint: enable unspecified-encodingDylan Baker
2022-09-01env2mfile: reuse logical lists of interesting facts from meson itselfEli Schwartz
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-06-13flake8: fix various whitespace nitsEli Schwartz
2022-06-10treewide: various cleanups to move imports for mypy into typechecking blocksEli Schwartz
Along the way, add __future__ annotations where lacking.
2022-04-23Fix typo that breaks g++ cross detection on Debian.Jussi Pakkanen
2022-03-09Add new env2mfile command.Jussi Pakkanen
2022-03-08Revert "Add new env2cross command."Eli Schwartz
This reverts commit e257a870fe5e676c55a2282b0e7fc9be34bba2ac. The PR adding this command had infinitely hanging CI, and now that it is merged to master we cannot get any CI on any PR to succeed.
2022-03-08Add new env2cross command.Jussi Pakkanen