- d/p/fix-build-arch-defaults.patch: fix non x86 compilation and defaults
[deb_dpdk.git] / debian / patches / fix-build-arch-defaults.patch
1 Description: Fix build and optimization issues
2  it is an upstream decision to select the minimum
3  baseline, also ppc can never use -march
4 Forwarded: no (planned if it works well)
5 Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
6 Last-Update: 2018-11-14
7 --- a/config/meson.build
8 +++ b/config/meson.build
9 @@ -7,10 +7,28 @@ if meson.is_cross_build()
10  else
11         machine = get_option('machine')
12  endif
13 +
14 +# machine type 'base' defaults to the per arch agreed common minimal baseline
15 +# That might not be the most optimized, but the most portable version while
16 +# still being able to support the cpu features required for DPDK.
17 +# This can be bumped, but it can never be an invariant like 'native'
18 +if machine == 'base'
19 +       if host_machine.cpu_family().startswith('x86')
20 +               # matches the old build systems default
21 +               machine = 'corei7'
22 +       elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
23 +               # arm manages defaults in config/arm/meson.build
24 +               machine = 'default'
25 +       elif host_machine.cpu_family().startswith('ppc')
26 +               machine = 'power8'
27 +    endif
28 +endif
29 +
30  dpdk_conf.set('RTE_MACHINE', machine)
31  machine_args = []
32 -# ppc64 does not support -march=native
33 -if host_machine.cpu_family().startswith('ppc') and machine == 'native'
34 +
35 +# ppc64 does not support -march= at all, use -mcpu and -mtune for that
36 +if host_machine.cpu_family().startswith('ppc')
37         machine_args += '-mcpu=' + machine
38         machine_args += '-mtune=' + machine
39  else