Skip to content
Snippets Groups Projects
Commit 06392f76 authored by Simon McVittie's avatar Simon McVittie
Browse files

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.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 8136164f
No related branches found
No related tags found
1 merge request!302helpers: Refactor $LIB, $PLATFORM detection
Pipeline #12174 passed
# Copyright 2021 Collabora Ltd.
# SPDX-License-Identifier: MIT
shared_module(
'identify-platform',
'../identify-platform.c',
c_args : ['-D_SRT_PLATFORM_VALUE="i686"',],
install : true,
install_dir : join_paths(
pkglibexecdir,
multiarch,
'i686',
)
)
......@@ -183,14 +183,35 @@ if multiarch != ''
subdir('multiarch')
endif
if host_machine.cpu_family() == 'x86'
expected_platform = 'i686'
else
# This is correct for at least aarch64 and x86_64, and a reasonable guess
# everywhere else
expected_platform = host_machine.cpu_family()
endif
# We can inline one instance of identify-platform here. All the others
# must be in a subdirectory due to Meson limitations.
shared_module(
'identify-platform',
'identify-platform.c',
c_args : ['-D_SRT_PLATFORM_VALUE="' + expected_platform + '"',],
install : true,
install_dir : join_paths(
pkglibexecdir,
multiarch,
expected_platform,
)
)
# Detect special-case $PLATFORM values on x86
if multiarch == 'i386-linux-gnu'
subdir('i386')
subdir('i486')
subdir('i586')
subdir('i686')
elif multiarch == 'x86_64-linux-gnu'
subdir('haswell')
subdir('x86_64')
subdir('xeon_phi')
endif
......
# Copyright 2021 Collabora Ltd.
# SPDX-License-Identifier: MIT
shared_module(
'identify-platform',
'../identify-platform.c',
c_args : ['-D_SRT_PLATFORM_VALUE="x86_64"',],
install : true,
install_dir : join_paths(
pkglibexecdir,
multiarch,
'x86_64',
)
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment