Skip to content

helpers: Refactor $LIB, $PLATFORM detection

Simon McVittie requested to merge wip/smcv/detect-lib-platform into master
  • 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