helpers: Refactor $LIB, $PLATFORM detection
-
helpers: Open-code build files instead of generating them
Generating files in the source directory is ugly, and open-coding the build instructions that we would have generated isn't a whole lot more code.
-
helpers: Check for $LIB = lib32, lib64 generically
pressure-vessel is currently x86-only, but we want to be portable to non-x86 if it's easy to do. It's reasonably common for all architectures to use lib, lib32 or lib64 for $LIB.
-
helpers: Generically check for $LIB = lib/MULTIARCH or MULTIARCH
There's no real reason why we need to hard-code the x86 architectures here - we can do this generically across all multiarch tuples. In particular, this means we detect $LIB correctly on all Debian derivatives and in the freedesktop.org SDK, even on non-x86.
-
helpers: Make $PLATFORM detection more generic
We can make a pretty good guess at what $PLATFORM will be: on many CPU architectures, there is one well-known name for the architecture, and $PLATFORM always takes that value. We might as well try it, even on otherwise unknown architectures - the worst that can happen is that our guess was wrong.
Known exceptions include:
- ARM 32-bit (Debian's porterboxes are v7l or v8l)
- i386 (Meson calls it x86, but $PLATFORM can be i386, i486, i586 or i686)
- mips family (Debian's porterboxes are octeon2 or octeon3)
- PowerPC (Debian's porterbox is power8)
- s390x (Debian's porterbox is z900)
- x86_64 ($PLATFORM can sometimes be haswell or xeon_phi)
of which we are unlikely to care about the non-x86 cases in practice.
Followup from !297 (merged).
Merge request reports
Activity
- Resolved by Ludovico de Nittis
For example, if we wanted full support for 32-bit ARM little-endian, we'd do something like this:
--- a/helpers/meson.build +++ b/helpers/meson.build @@ -185,6 +185,8 @@ endif if host_machine.cpu_family() == 'x86' expected_platform = 'i686' +elif host_machine.cpu_family() == 'arm' and host_machine.endian() == 'little' + expected_platform = 'v7l' else # This is correct for at least aarch64 and x86_64, and a reasonable guess # everywhere else @@ -213,6 +215,8 @@ if multiarch == 'i386-linux-gnu' elif multiarch == 'x86_64-linux-gnu' subdir('haswell') subdir('xeon_phi') +elif host_machine.cpu_family() == 'arm' and host_machine.endian() == 'little' + subdir('v8l') endif # vim:set sw=2 sts=2 et:
and then add
helpers/v8l/meson.build
(and if we wanted to support Raspberry Pi v1 or Raspberry Pi Zero, we might have to addv6l
on the same basis asv8l
). I don't think that's awful.Edited by Simon McVittie
mentioned in commit c4d0037f