Merge tag 'upstream/18.11-rc4' into 18.11.x
[deb_dpdk.git] / debian / patches / 0002-build-establish-an-invariant-machine-type.patch
1 From e12f30d265ff63a8c9164546355f9ff42abafd50 Mon Sep 17 00:00:00 2001
2 From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
3 Date: Wed, 14 Nov 2018 12:22:35 +0100
4 Subject: [PATCH 2/2] build: establish an invariant machine type
5
6 Add the machine definition 'default' which is special compared
7 to 'native' (most optimized for current system) or any explicit
8 type (external entity has to decide on the type).
9
10 It defaults to the per arch agreed common minimal baseline
11 needed for DPDK to reasonable work.
12
13 That might not be the most optimized, but the most portable
14 version while still being able to support the CPU features
15 required for DPDK.
16
17 Going forward this can be bumped up by the DPDK project, but it
18 can never be an invariant like 'native'.
19
20 Distributions and other needing portable code are expected to
21 define the machine as 'default'.
22
23 Acked-by: Bruce Richardson <bruce.richardson@intel.com>
24 Acked-by: Luca Boccassi <bluca@debian.org>
25 Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
26
27 Forwarded: yes
28 Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
29 Last-Update: 2018-11-15
30
31 ---
32  config/meson.build | 21 +++++++++++++++++++++
33  1 file changed, 21 insertions(+)
34
35 diff --git a/config/meson.build b/config/meson.build
36 index 1af305f46..db32499b3 100644
37 --- a/config/meson.build
38 +++ b/config/meson.build
39 @@ -7,6 +7,27 @@ if meson.is_cross_build()
40  else
41         machine = get_option('machine')
42  endif
43 +
44 +# machine type 'default' is special, it defaults to the per arch agreed common
45 +# minimal baseline needed for DPDK.
46 +# That might not be the most optimized, but the most portable version while
47 +# still being able to support the CPU features required for DPDK.
48 +# This can be bumped up by the DPDK project, but it can never be an
49 +# invariant like 'native'
50 +if machine == 'default'
51 +       if host_machine.cpu_family().startswith('x86')
52 +               # matches the old pre-meson build systems default
53 +               machine = 'corei7'
54 +       elif host_machine.cpu_family().startswith('arm')
55 +               machine = 'armv7-a'
56 +       elif host_machine.cpu_family().startswith('aarch')
57 +               # arm64 manages defaults in config/arm/meson.build
58 +               machine = 'default'
59 +       elif host_machine.cpu_family().startswith('ppc')
60 +               machine = 'power8'
61 +       endif
62 +endif
63 +
64  dpdk_conf.set('RTE_MACHINE', machine)
65  machine_args = []
66  
67 -- 
68 2.17.1
69